404 Commits

Author SHA1 Message Date
Tom Hughes
48f8c22e44 Get core dumping working again - the architecture specific code that
was in the sigframe module has been moved into the coredump module 
where it belongs and things fixed up to compiler again.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4970
2005-10-31 17:05:21 +00:00
Julian Seward
9432f46e02 rm the skiplist module, as it has been superseded by the AVL-tree
based m_oset module.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4952
2005-10-20 00:09:11 +00:00
Julian Seward
1813e8fdcd Change the core-tool interface so that tools are fully aware of both
the guest extents for the presented translation and also its original
un-redirected guest address.  These changes are needed in particular
to make cachegrind's code cache management work properly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4943
2005-10-18 12:04:18 +00:00
Nicholas Nethercote
b32a66a35f augment comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4939
2005-10-16 17:48:09 +00:00
Nicholas Nethercote
6218bef661 Comment-only changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4934
2005-10-15 17:50:02 +00:00
Julian Seward
5740bf2f53 Redo the way cachegrind generates instrumentation code, so that it can
deal with any IR that happens to show up.  This makes it work on ppc32
and should fix occasionally-reported bugs on x86/amd64 where it bombs
due to having to deal with multiple date references in a single
instruction.

The new scheme is based around the idea of a queue of memory events
which are outstanding, in the sense that no IR has yet been generated
to do the relevant helper calls.  The presence of the queue --
currently 16 entries deep -- gives cachegrind more scope for combining
multiple memory references into a single helper function call.  As a
result it runs 3%-5% faster than the previous version, on x86.

This commit also changes the type of the tool interface function
'tool_discard_basic_block_info' and clarifies its meaning.  See
comments in include/pub_tool_tooliface.h.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4903
2005-10-12 10:09:23 +00:00
Julian Seward
4ce62c9445 If the launcher can't figure out what it's own name is, don't bail
out.  Instead, print a warning message, continue, and cause any
attempt to trace into a child process to fail with ECHILD.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4861
2005-10-04 23:07:33 +00:00
Tom Hughes
65bd3eb367 Create a new SkShmC segment type for shared memory segments so that we
can ensure they are never merged with adjacent segments. This makes
sure that we can find the right piece of memory to release when the
shmdt system call occurs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4854
2005-10-04 15:59:54 +00:00
Tom Hughes
760dbdc42a Get the SHM_RDONLY test the right way round. Fixes bug #113796.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4852
2005-10-04 12:04:06 +00:00
Julian Seward
b7cd9cb3de Plumb 64-bit file offsets throughout the address space manager.
Untested.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4844
2005-10-02 17:01:41 +00:00
Julian Seward
68ccd98f62 Get rid of some macros used only by the old aspacemgr, and tidy up
m_main even more.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4802
2005-09-28 01:36:01 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00
Nicholas Nethercote
eb51a9ff0d Fix incorrect computation of miss rates due to Int/Long mixups <sigh>.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4769
2005-09-25 19:11:45 +00:00
Nicholas Nethercote
ca38159b2d Don't print the client's argv[i] if it's null, and related changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4629
2005-09-13 00:46:27 +00:00
Tom Hughes
cf8c1b047f Handle the SCTP_GET_LOCAL_ADDRS and SCTP_GET_PEER_ADDRS getsockopt
calls correctly. Fix to bug #111231.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4549
2005-08-28 10:16:29 +00:00
Nicholas Nethercote
9d7e8b9ab2 Move some kernel constants to the right place.
Also reinstated SF_DEVICE, which is used to ensure we don't try and
leakcheck a page that is mapped from a device.  This got lost in the
2.x-to-3.x transition, or some time after.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4538
2005-08-27 17:20:53 +00:00
Nicholas Nethercote
ed0bcea859 Rename vg_preload_core.so to vgpreload_core.so to be consistent with
tool preload modules, which are called vgpreload_<tool>.so.  Also
fixed a couple of comments relating to this.

(This need not be merged into 3_0_X.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4514
2005-08-25 22:53:57 +00:00
Julian Seward
ae8dfb4531 Incorporate a patch from Craig Chaney which gives better stack
snapshots on ppc32-linux in the presence of functions subject to
leaf-function optimisations.

At the same time, simplify the stack unwinding logic by basically
implementing it separately for each target.  Having a single piece of
logic for amd64 and x86 was tenable, but merging ppc32 into it is too
confusing.  So now there is an x86/amd64 unwinder and a ppc32
unwinder.

This requires plumbing a link-register value into
VG_(get_StackTrace2), and that in turn requires passing it around
several other stack-trace-related functions.  Hence 7 changed files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4464
2005-08-19 16:02:59 +00:00
Julian Seward
6ff0f83342 vki_stat64 as defined in the 2.6.10 sources looks significantly
different from our rendition, so update the latter.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4446
2005-08-18 11:55:37 +00:00
Nicholas Nethercote
64974a1033 Added VG_(OSet_LookupWithCmp)(), which can be useful.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4444
2005-08-17 21:06:07 +00:00
Nicholas Nethercote
fcdc60441e Something I realised recently: in C, iterators are much better than
higher-order functions for traversing data structures.  The higher-order
approach is too clumsy due to the lack of polymorphism and closures;  you
have to use void* too much and it is more verbose than it should be.

Hence, I replaced all the uses of HT_first_match() and
HT_apply_to_all_nodes() with equivalent uses of the hashtable iterator.
Also replaced higher-order traversal functions for Memcheck's freed-list
and the thread stacks with iterators.  That last change changes the
core/tool interface, so I've increased the version number.







git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4415
2005-08-15 01:52:02 +00:00
Nicholas Nethercote
89163ecf45 Added new module, m_oset, which provides a generic data structure, OSet,
which is a sorted set with no duplicates.  This is derived from
m_skiplist, which it will hopefully replace.  The interface has the
following improvements:

- Avoided all mention of how the data structure is implemented in the
  interface, so it could be replaced with another data structure without
  changing external code.
- Two kinds of comparison:  fast -- use the first word of each element
  for comparison;  slow -- use a custom function.  The custom function
  compares a key with an element, so non-overlapping interval lists can
  be supported easily.  m_skiplist only supports the slow variant, and it
  makes things almost 2x faster.
- Users pass in malloc() and free() functions, so m_oset.c it doesn't
  rely on any particular allocator.
- It has a Destroy() function which will deallocate all the nodes.
- It allows variable-sized nodes.
- No static constructor;  I needed the flexibility of being able to
  execute arbitrary code in the constructor.  This also means no type
  internals are exposed.

No part of Valgrind actually uses OSet yet, although I've privately
converted several data structures, and so I'm confident that the
interface is basically sound.  Some functions may be added later.
  
The implementation uses AVL trees, and has the following
characteristics:

- Lookup is much faster than for skiplists -- around 3x.  This is
  because the inner lookup loop is much tighter.
- Insertion and removal is similar speed to skiplists, maybe a little
  slower, but there's still some fat to be trimmed.
- The code is a bit longer and more complex than the skiplist code.

This was intended to replace the need for the VgHashTable type.  But my
experiments have shown that VgHashTable is really fast, faster than both
AVL trees and skiplists in all but extreme cases (eg. if the hashtable
becomes way too full):  insertion takes constant time, because you always
prepend to chains;  lookup depends on chain length, but the inner loop
is so tight that you need about 20 elements per chain before it gets
worse than the AVL tree;  removal is similar to lookup.  And because
insertion uses prepending, any locality in accesses will help things.  If
VgHashTable had its interface cleaned up to look like OSet's, and was made
to auto-resize when it got too full, it might be a better OSet (although
it's not sorted).

So, it's currently unclear exactly how the AVL tree OSet will be used.
The skiplist could be converted to the new interface (I have a 90%
complete version which I used in the comparison experiments).  If
VgHashTable was converted to the same interface (or as close as
possible) it would make direct comparison of important places (eg.
Memcheck's malloc_lists) simple.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4410
2005-08-14 22:13:00 +00:00
Nicholas Nethercote
4f064ec81b Added an iterator to VgHashTable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4407
2005-08-14 17:42:35 +00:00
Nicholas Nethercote
5d07a9ad26 Changed many, but not all, of the VgHashNode* parameters and return
types in m_hashtable.c to void*.  This requires no changes to code
already using VgHashTables, but it allows some previously-required casts
to be removed.  I also changed Memcheck and Massif by removing some of
these now-unnecessary casts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4404
2005-08-14 06:24:20 +00:00
Nicholas Nethercote
7f8c275c59 Give variable a better name.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4378
2005-08-11 00:06:36 +00:00
Tom Hughes
5636f53a8c If the pre-handler for the execve system call fails to state the file
being executed then propagate the error from the stat instead of just
return ENOACCES all the time. Fixes bug #110208.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4330
2005-08-05 07:46:32 +00:00
Tom Hughes
cca571d1c9 Handle the TIOCMGET ioctl.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4291
2005-07-28 16:26:34 +00:00
Tom Hughes
1dc053205f Handle the HDIO_GETGEO ioctl. Secondary problem found from bug #109780.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4290
2005-07-28 16:13:42 +00:00
Tom Hughes
e7a2d4c9cd Define extra block device ioctls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4289
2005-07-28 16:10:42 +00:00
Nicholas Nethercote
50db609e82 Removed dead declaration.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4284
2005-07-27 20:31:57 +00:00
Julian Seward
0965fe7cb0 Make VG_(clo_vex_control) tool-visible so tools can control how
aggressive Vex is, if they need to do that.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4276
2005-07-26 23:47:00 +00:00
Julian Seward
6789f6542e A commit which is almost all trivial change.
- m_main: if --log-file-qualifier applies, do not add ".pid"
  at the end of the name

- Fix the logic which detected whether the just-devised name
  already existed.  This was broken (by me) because it could not
  distinguish the reasons for failing to open the logfile.

  Doing this required changing the return type of VG_(open)
  from Int to SysRes (to make failure reasons visible) and 
  that's the cause of most of the changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4228
2005-07-23 09:18:34 +00:00
Tom Hughes
a74aa1e74d Yet more system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4227
2005-07-22 15:04:14 +00:00
Nicholas Nethercote
f9ad9b5ad8 Remove bogus legacy declarations, from the time when the AMD64
version of VALGRIND_MAGIC_SEQUENCE printed a message and exited.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4226
2005-07-22 13:03:20 +00:00
Tom Hughes
ed055c7ea2 Bring the vki_sigevent_t definition into line with current kernels.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4216
2005-07-20 13:45:43 +00:00
Nicholas Nethercote
e71b6dab8b Move config.h inclusion from pub_tool_basics.h to pub_core_basics.h so it's
not seen by external tools.  This was requested by Josef W.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4215
2005-07-20 13:18:23 +00:00
Julian Seward
59bfcbf43c New command line option: --xml-user-comment=XMLTEXT, which allows
copying of arbitrary bits of XML text to the XML output.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4186
2005-07-19 14:18:56 +00:00
Tom Hughes
0fef787853 Handle the BLKGETSIZE64 ioctl. Fixes bug #104797.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4161
2005-07-18 13:26:55 +00:00
Nicholas Nethercote
234a4c5d54 Fix comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4148
2005-07-17 16:12:59 +00:00
Julian Seward
f13ea11bf8 Clean up endianness macros a bit. Now pub_tool_basics.h defines
VG_LITTLEENDIAN or VG_BIGENDIAN and that's what should be used.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4142
2005-07-10 00:53:42 +00:00
Nicholas Nethercote
91c18e835e Add a simple random number generator to m_libcbase so we don't have
to use the one from glibc.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4130
2005-07-08 04:08:59 +00:00
Nicholas Nethercote
fdeaecb9e1 Rename VG_(get_obj)() as VG_(find_seginfo) to be more consistent
with the other function names.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4114
2005-07-06 13:19:11 +00:00
Nicholas Nethercote
0c328e0636 Comment changes only.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4102
2005-07-03 20:22:07 +00:00
Nicholas Nethercote
e67b65d0eb Changed m_hashtable.c to allow the size of the hash table to be specified
when it is created.  Fortunately this didn't affect code outside this
module except for the calls to VG_(HT_construct)().

As a result, we save some memory because not all tables have to be as big
as the ones needed for malloc/free tracking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4100
2005-07-03 17:53:11 +00:00
Nicholas Nethercote
fbf8653c8b Removed the remnants of the attempt at an ARM port, because it had
bit-rotted badly and was clogging up the code.

I put the useful remnants in docs/porting-to-ARM in case anyone ever
wants to try porting to ARM again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4092
2005-07-02 23:13:59 +00:00
Nicholas Nethercote
4e8bcf9076 Move the last remaining tests out of corecheck.
Also introduced VG_(showing_core_errors)() to make core error display
more consistent.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4073
2005-07-01 04:15:36 +00:00
Nicholas Nethercote
f6fdbbf06d Don't use non-ansi features in valgrind.h in case it's used in a file
compiled with -ansi.  Added a regtest for it.  Fixed bug #103182.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4044
2005-06-28 19:44:10 +00:00
Nicholas Nethercote
1273f0df14 Combine the percentify() functions from Cachegrind and m_transtab into
a single more general one exported from m_libcprint.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4034
2005-06-26 18:43:40 +00:00
Nicholas Nethercote
4b4e694fef Avoid m_redir.c importing priv_symtab.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4024
2005-06-25 20:22:43 +00:00
Nicholas Nethercote
58b0509c03 Rename functions to make the type involved clearer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4021
2005-06-25 19:51:33 +00:00