67 Commits

Author SHA1 Message Date
Julian Seward
ba2ece03b8 This commit subtly changes the meaning of the values obtained via the
stack unwind mechanism (the function VG_(record_ExeContext) et al),
clears up some associated kludges, and makes suppression matching work
more reliably.

Prior to this commit, a stack snapshot contained, at [0], the IP of
the relevant thread, and at all positions [1] and above, the return
addresses for the open calls.

When showing a snapshot to the user (in VG_(apply_StackTrace)), and
searching the stack for stack blocks (in VG_(get_data_description)), 1
is subtracted from positions [1] and above, so as to move these return
addresses back to the last byte of the calling instruction.  This
subtraction is also done even in VG_(get_StackTrace_wrk) itself, in
order to make the stack unwinding work at all.

It turns out that suppression-vs-function-name matching requires the
same hack, and sometimes failed to match suppressions that should
match, because of this self-same problem.

So the commit changes the stack unwinder itself, so that entries [1]
and above point to the last byte of the call instruction, rather than
the return address.  The associated kludges in VG_(apply_StackTrace)
and VG_(get_StackTrace_wrk) are removed, and suppression matching is
observed to work in a case where it failed before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8818
2008-12-12 13:23:03 +00:00
Julian Seward
35c28b721f Merge Helgrind from branches/YARD into the trunk. Also includes some
minor changes to make stack unwinding on amd64-linux approximately
twice as fast as it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8707
2008-10-25 16:22:41 +00:00
Bart Van Assche
8e96150945 Merged FORMATCHECK branch (r8368) to trunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369
2008-07-07 06:49:24 +00:00
Julian Seward
f9f7ad0a45 Make sure sp[0] and fp[0] are set in a rarely-taken path. Thanks to
Bart for spotting this.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7994
2008-05-02 22:27:07 +00:00
Julian Seward
efefa3830e VG_(get_strace_wrk): don't segfault in the degenerate case fp_min =
fp_max_orig = 0.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7551
2008-03-03 22:20:51 +00:00
Julian Seward
14af4957fc Merge in the DATASYMS branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540
2008-03-03 01:35:41 +00:00
Julian Seward
5679a22410 Update copyright dates ("200X-2007" --> "200X-2008").
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398
2008-02-11 11:34:59 +00:00
Julian Seward
7cebb7d626 Include headers for VG_(register_stack) calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7396
2008-02-11 11:23:12 +00:00
Tom Hughes
2e55cfac69 Make the clone system call wrappers call VG_(register_stack) to record
the new thread's stack, then make the stack unwinder use that information
to make a better guess at the stack bounds.

This helps avoid crashes trying to unwind the stack under wine when
the starting point is a routine without a proper stack frame.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7383
2008-02-08 15:17:07 +00:00
Julian Seward
ee4b37fb8e When allocating space for the client stack on Linux, take notice of
the --max-stackframe value.  This makes it possible to run programs
with very large (primary) stack requirements simply by specifying
--max-stackframe.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7300
2007-12-15 22:13:05 +00:00
Julian Seward
75fd9878c9 Merge (from branches/THRCHECK) the following amd64-linux stack unwind
kludges^H^H^H^H^H^H^Henhancements:

r6802: For VG_(record_ExeContext) et al, add a new parameter
(first_ip_delta) which is added to the initial IP value before the
stack is unwound.  A safe value to pass is zero, which causes the
existing behaviour to be unchanged.  This is a kludge needed to work
around the incomplete amd64 stack unwind info in glibc-2.5's clone()
routine.

r7059: Add a last-ditch heuristic-hack to the amd64-linux stack
unwinder, which is used when all other methods fail.  Seems like GDB
has something similar.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7118
2007-11-09 23:02:28 +00:00
Dirk Mueller
ab6ac6192c readd right adjustment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6948
2007-10-04 21:36:40 +00:00
Dirk Mueller
76b90cdeb9 fix a few format string warnings
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6928
2007-10-01 10:33:41 +00:00
Julian Seward
b7302d9258 Get rid of the type XArrayStrings in m_clientstate and use new generic
equivalents in module m_xarray instead.  A suprisingly pervasive
change.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6616
2007-02-25 15:08:24 +00:00
Julian Seward
172505c978 Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488
2007-01-08 06:01:59 +00:00
Julian Seward
fa62ba20cb Merge r6123:
Extensions for unwinding stacks on ppc32-aix5 and ppc64-aix5.  Also,
extend the mechanism developed for ppc64-linux for fishing return
addresses out of the thread's redirection-stack when needed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6261
2006-10-17 01:31:58 +00:00
Julian Seward
ae8215b3ac Create a new module, m_vki, and move all knowledge about the kernel
interface, except for the syscall numbers, into that.  Mostly this
means moving include/vki-*.h to include/vki/vki-*.h.

include/pub_tool_basics.h previously dragged in the entire kernel
interface.  I've done away with that, so that modules which need to
see the kernel interface now have to include pub_{core,tool}_vki.h
explicitly.  This is why there are many modified .c files -- they have
all acquired an extra #include line.

This certainly breaks all platforms except x86.  Will fix shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6225
2006-10-14 19:26:10 +00:00
Nicholas Nethercote
6b99e05d71 Don't print more lines of a stack-trace than were obtained. Thanks to Bart
Van Assche for spotting.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5999
2006-08-13 04:48:25 +00:00
Julian Seward
ad67fd79fe Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954
2006-06-05 23:21:15 +00:00
Julian Seward
8ca05cc698 Get rid of VG_(x86_linux_REDIR_FOR__dl_sysinfo_int80) and do the x86-linux
stack unwind kludge another way.  This is believed to fix #108258.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5868
2006-04-29 18:03:14 +00:00
Julian Seward
27b95f28a5 Cleanup/restructure m_debuginfo, as described in
coregrind/m_debuginfo/README.txt.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5823
2006-04-04 15:12:44 +00:00
Julian Seward
87a0201107 ppc64-linux: apply the bogus-LR kludge in a second place.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5555
2006-01-19 03:47:30 +00:00
Julian Seward
8a98207bcf Make VG_(get_StackTrace2) aware of bogus LR values in
replacement/wrapper functions on ppc64-linux, which otherwise mess up
the backtraces.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5549
2006-01-18 04:25:20 +00:00
Julian Seward
5d5a72d1a9 The symbol table reader hides all that dot crazyness on ppc64-linux
now.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5538
2006-01-17 02:23:09 +00:00
Julian Seward
5e77fedd75 Fix more ppc64-linux function wrapping and symbol-table bits and pieces.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5523
2006-01-12 21:15:35 +00:00
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
Julian Seward
79bbb4ed42 Make ppc64-linux stack unwinding work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5424
2005-12-23 23:33:51 +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
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
1ff57e2e07 I couldn't resist
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5177
2005-11-17 19:40:24 +00:00
Julian Seward
20ba7adf1f Make VG_(apply_StackTrace) stop if it looks like we've overshot main().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5170
2005-11-17 15:12:34 +00:00
Julian Seward
1f93e36cf6 Separate the stack unwind logic for amd64 and x86, so that they can be
differently performance-tuned.  amd64 needs to consult CFI first and
then if that fails (unlikely) follow the %rbp chain.  On x86, the CFI
is almost never helpful, but consulting it first wastes significant
time in allocation-intensive programs.  This commit pulls the two
archs apart and puts the CFI check second on x86.  This reduces start
time for ktuberling on x86 on memcheck from 78 seconds to 75.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5126
2005-11-14 15:18:25 +00:00
Julian Seward
e3f0447592 ppc32 stack unwind: if the initial FP looks bad, don't use it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5111
2005-11-13 02:41:35 +00:00
Tom Hughes
efaaa0b74a Add a comment documenting the reason for subtracting one from the IP value
after each pass of the loop.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5012
2005-11-05 00:17:21 +00:00
Tom Hughes
64a4375b1b When unwinding the stack on x86/amd64 subtract one from the value of
ip before starting a new pass of the loop.

The reason for this is that (except for the first pass of the loop) the
value of ip is actually a return address, which is therefore after the
instruction that was executing at the time. This means that if there is
a boundary in the CFI information at that point we can wind up using the
wrong CFI data to do the next unwind if we do it based on the return
address.

This most commonly happens with a tail call where we wind up using the
data for the next function to do the unwind and getting hopelessly lost.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4996
2005-11-04 11:31:33 +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
c0f9842cf0 avoid compiler warning
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4484
2005-08-24 01:56:15 +00:00
Julian Seward
dc5f079f45 rm now-redundant macros.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4465
2005-08-19 20:23:05 +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
Nicholas Nethercote
72e156258a Reinstate stack trace printing on assertion failures. It's terrible
for the module dependency graph, but it's very useful.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4205
2005-07-20 02:41:31 +00:00
Nicholas Nethercote
925075a3cd Remove unneeded #ifdef.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4175
2005-07-19 01:22:26 +00:00
Julian Seward
aa9e22bf1f Fix up ppc32-linux stack unwinding.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4141
2005-07-09 22:51:08 +00:00
Nicholas Nethercote
e7aa6b03de Made m_debuginfo not depend on m_aspacemgr, breaking the direct circular
dependence between them.  (There's still an indirect one via m_libcmman.)

As a result, I was able to move the Segment type declaration into
pub_core_aspacemgr.h, which is a much better spot.  I was also able to
remove a couple of #includes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4025
2005-06-25 20:49:33 +00:00
Nicholas Nethercote
07965f509c avoid compiler warning
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4022
2005-06-25 19:52:02 +00:00
Nicholas Nethercote
d463dd2292 Removed the VGA_/VGO_/VGP_ prefixes for arch/OS/platform-specific
things.  These made sense when the arch/OS/platform-specific code was in
one module, but as that code got mixed in with generic code the boundary
between generic and non-generic blurred, and the distinction made less
sense.  So let's get rid of them.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4002
2005-06-23 03:27:57 +00:00
Julian Seward
b36f48842a Simplify the implementation of m_trampoline and the stuff that refers
to it.  Now there are no more offsets and no copying of code into the
stack.  We just redirect directly to entry points in m_syscalls.S.

This will mess up pointercheck, since the redirect targets are now in
Valgrind's address space, not the client's.  But pointercheck is hosed
anyway, and I'd rather back off to something simple whilst ppc32 is
stabilised.  When the address space management stuff is overhauled
then pointercheck may or may not get reinstated, and if it does then
the trampoline stuff will need revisiting.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3977
2005-06-21 01:41:34 +00:00
Nicholas Nethercote
fc38860306 Don't #include pub_core_debuginfo.h in pub_core_aspacemgr.h. So have
to #include it explicitly in lots of other places, but at least the 
dependency is clear now.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3974
2005-06-21 00:28:11 +00:00
Cerion Armour-Brown
d5f7c8aed3 Finally, valgrind on ppc32.
Plenty still to do, but simple programs like ls seem to run ok

Thanks, Paul, for having your ppc port of valgrind 2.4 to work from!




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3969
2005-06-20 15:51:07 +00:00
Nicholas Nethercote
f4d8932fc8 Remove some unnecessary #includes, comment some others.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3966
2005-06-20 03:36:51 +00:00
Nicholas Nethercote
d618b2572c Put VG_(client_trampoline_code) in m_trampoline.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3961
2005-06-19 21:49:28 +00:00