425 Commits

Author SHA1 Message Date
Nicholas Nethercote
bf162724b9 Merge in r5435 from COMPVBITS. Also added a note to
docs/internals/performance.txt about it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5438
2005-12-25 06:34:04 +00:00
Nicholas Nethercote
7683c8c703 Fix a nasty 64-bit-uncleanness bug in OSet spotted by Julian -- for fast
comparisons it was only considering the bottom 32-bits of the key.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5427
2005-12-24 03:10:56 +00:00
Julian Seward
d188c6df73 ppc64 ELF allows the 288 bytes below the stack pointer to be accessed.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5425
2005-12-23 23:34:51 +00:00
Julian Seward
803a8f2100 Deal with function pointer vs function entry crazyness on ppc64-linux.
Memcheck is done, but any tool which generates IR helper calls will
need to be similarly adulterated.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5418
2005-12-23 02:29:58 +00:00
Nicholas Nethercote
1eb0c46b9f Add comment about log2().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5408
2005-12-22 19:50:45 +00:00
Nicholas Nethercote
1decf7621a Add a destructor function to OSet_Destroy() which can be called for each
node.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5402
2005-12-22 06:20:59 +00:00
Nicholas Nethercote
e1a645cce6 Renamed coregrind.h to pub_core_clreq.h and introduced pub_tool_clreq.h to
be consistent with the module naming scheme.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5398
2005-12-21 20:22:52 +00:00
Nicholas Nethercote
3866282110 Remove all remaining profiling gunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5388
2005-12-19 22:48:39 +00:00
Cerion Armour-Brown
b714685c63 Take ppc64 startup further along the road
- fixed launcher.c to recognise ppc32/64-linux platforms properly
 - lots of assembly fixes to handle func descriptors, toc references, 64bit regs.
 - fixed var types in vki-ppc64-linux

Now gets as far as VG_(translate), but dies from a case of invalid orig_addr.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5299
2005-12-06 19:07:08 +00:00
Nicholas Nethercote
fe3cc3bdf9 Change hp2ps to output .ps files in the same dir that the .hp input files
are in.  This fixes bug #117686.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5287
2005-12-05 20:45:59 +00:00
Julian Seward
8ba9a34088 Add framework for ppc64 support. Apologies in advance for the
inevitable breakage to other platforms.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5250
2005-11-29 13:05:56 +00:00
Nicholas Nethercote
7f18ebbc33 comment-only change
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5199
2005-11-18 21:32:18 +00:00
Tom Hughes
2f49a0d567 Removed vki_ntohs definition and the infrastructure that supported
it as it is no longer used.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5164
2005-11-17 12:14:42 +00:00
Tom Hughes
e9b07e443e Move VG_(am_get_filename) to the tool accessible aspacemgr header file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5141
2005-11-16 00:11:14 +00:00
Tom Hughes
39e6ec034f Handle some ALSA ioctls that don't have size or direction hints.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5131
2005-11-14 17:03:54 +00:00
Tom Hughes
09d3b7060d Add named constants for si_code values to replace the magic numbers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5092
2005-11-12 00:13:20 +00:00
Nicholas Nethercote
3035e5abee Cachegrind was aborting if it hit a client request. Now it doesn't.
This fixes #116057, I think.  I added a regtest so it won't regress again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5072
2005-11-10 15:20:37 +00:00
Tom Hughes
fb53b628e2 Do ptrace_setregs in a ppc32 compatible way instead of a ppc64 way.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5052
2005-11-09 08:52:56 +00:00
Julian Seward
5f3a7540c1 Try to fill in ptrace_setregs. Dunno if it's right.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5046
2005-11-08 20:59:14 +00:00
Tom Hughes
db732ea188 Handle the PROT_GROWSDOWN and PROT_GROWSUP mprotect flags properly
which stops glibc falling over when a program requires an executable
stack and glibc has been built to assume that PROT_GROWSDOWN will work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5041
2005-11-08 16:51:55 +00:00
Julian Seward
4050d0bd10 Handle sys_sigaction on ppc32-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5028
2005-11-07 15:48:31 +00:00
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