87 Commits

Author SHA1 Message Date
Julian Seward
ad7de5b336 Delete the AIX5 port. The last release this worked for is 3.4.1,
and then only on AIX 5.2 and 5.3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11842
2011-06-28 07:25:29 +00:00
Julian Seward
b3827d6c33 Create new module m_libcsetjmp, which wraps up uses of
__builtin_setjmp and __builtin_longjmp so that they can be selectively
replaced, on a platform by platform basis.  Does not change any
functionality.  Related to #259977.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11687
2011-04-11 16:17:51 +00:00
Julian Seward
6107fd666c Add a port to IBM z/Architecture (s390x) running Linux -- Valgrind
side components. (Florian Krohm <britzel@acm.org> and Christian
Borntraeger <borntraeger@de.ibm.com>).  Fixes #243404.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11604
2011-03-07 16:05:35 +00:00
Julian Seward
cb3fbb46d7 The amd64-linux unwinder rejects stacks of smaller than 512 bytes as
bogus, and produces essentially useless traces from them.  With
gcc-4.4 and later, some valid thread stacks really are smaller than
this.  Hence change the limit down to 256 bytes.  Investigated by
Evgeniy Stepanov, eugeni.stepanov@gmail.com.
See bug 243270 comment 21.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11403
2010-10-06 22:45:18 +00:00
Julian Seward
0bb6f49531 On arm-linux, add r7 to the set of registers that the CFI unwinder
knows how to unwind.  This is important when unwinding Thumb code
the CFA is often stated as being at some offset from r7.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11377
2010-09-23 22:05:59 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Julian Seward
6a9a4015c7 Various minor fixups to make ppc32/64-linux work again following
recent ARM-Linux merge.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10992
2010-01-02 13:24:58 +00:00
Julian Seward
9249a3eae7 Unbreak stack unwinding on x86-linux and amd64-linux following merge
of ARM CFI unwinding in r10986.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10987
2010-01-01 19:55:17 +00:00
Julian Seward
6bc7295264 Make the Dwarf3 CFI stack unwinding machinery work on arm-linux
too.  This is a first step towards making not be completely
x86/amd64-linux specific, and so replaces some x86/amd64-specific
stuff with more general constructions:

* structure 'DiCfSI', into which the info is summarised, has been
  made target-specific (ugh), since the sets of registers to be
  unwound differ on different targets.

* enum CfiReg and the CFIC_ constants have been expanded
  accordingly, to handle both arm and x86/amd64 registers.

  The abbreviation "IA" (Intel Architecture) has been used in a
  few places where the x86 and amd64 definitions are shared.

* the CFI reader/summariser in readdwarf.c has been expanded &
  generalised appropriately.

* the DiCfSI evaluator in debuginfo.c, VG_(use_CFI_info), has
  also been generalised appropriately.

  The main change is that instead of passing around triples
  of (IP, SP, BP) values, a new structure 'D3UnwindRegs' is
  passed around instead.  This is defined differently for IA and
  ARM and succeeds in hiding at least some of the differences
  where we don't care about them.

  Note also, D3UnwindRegs duplicates, in purpose and structure,
  structure 'RegSummary' in priv_d3basics.h.  This will be tidied
  up in due course.

This commit almost certainly breaks stack unwinding on amd64-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10986
2010-01-01 18:46:41 +00:00
Julian Seward
e9de458500 Merge from branches/ARM, all parts of the ARM-Linux port except for
the changes to do with reading and using ELF and DWARF3 info.
This breaks all targets except amd64-linux and x86-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10982
2010-01-01 11:59:33 +00:00
Tom Hughes
9ecb11ce23 Fix stack unwinding on PPC to store the correct frame pointer for
frames other than the first one found.

This is taken from Jakub Jelinek's second patch on bug #210479.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10938
2009-11-12 13:19:41 +00:00
Julian Seward
5b1edb07f6 When generating XML output for suppressions, print the suppression
both wrapped up in XML tags (as before) but also in plain text in a
sequence of CDATA blocks.  Normally only one, but in the worst case
the raw data will have ]]> in it, in which case it needs to be split
across two CDATA blocks.

This apparently simple change involved a lot of refactoring of the
suppression printing machinery:

* in the core-tool iface, change "print_extra_suppression_info" (which
  prints any auxiliary info) to "get_extra_suppression_info", which
  parks the text in a caller-supplied buffer.  Adjust tools to match.

* VG_(apply_StackTrace): accept a void* argument, which is passed to
  each invokation of the functional parameter (a poor man's closure
  implementation).

* move PRINTF_CHECK into put_tool_basics.h, where it should have been
  all along

* move private printf-into-an-XArray-of-character functions from
  m_debuginfo into m_xarray, and make them public

* gen_suppression itself: use all the above changes.  Basically we
  always generate the plaintext version into an XArray.  In text mode
  that's just printed.  In XML mode, we print the XMLery as before,
  but the plaintext version is dumped into a CDATA block too.

* update the Protocol 4 specification to match all this.

This still isn't 100% right in the sense that the CDATA block data
needs to be split across multiple blocks if it should ever contain the
CDATA end mark "]]>".  The Protocol 4 spec has this right even though
the implementation currently doesn't.

Fixes #191189.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10822
2009-08-15 22:41:51 +00:00
Julian Seward
e7dde85a24 Merge coregrind/ changes from branches/MESSAGING_TIDYUP r10464.
This commit tidies up and rationalises what could be called the
"messaging" system -- that part of V to do with presenting output to
the user.  In particular it brings significant improvements to XML
output.

Changes are:

* XML and normal text output now have separate file descriptors,
  which solves longstanding problems for XML consumers caused by
  the XML output getting polluted by unexpected non-XML output.

* This also means that we no longer have to hardwire all manner
  of output settings (verbosity, etc) when XML is requested.

* The XML output format has been revised, cleaned up, and made
  more suitable for use by error detecting tools in general
  (various Memcheck-specific features have been removed).  XML
  output is enabled for Ptrcheck and Helgrind, and Memcheck is
  updated to the new format.

* One side effect is that the behaviour of VG_(message) has been
  made to be consistent with printf: it no longer automatically
  adds a newline at the end of the output.  This means multiple
  calls to it can be used to build up a single line message; or a
  single call can write a multi-line message.  The ==pid==
  preamble is automatically inserted at each newline.

* VG_(message)(Vg_UserMsg, ..args..) now has the abbreviated form
  VG_(UMSG)(..args..); ditto VG_(DMSG) for Vg_DebugMsg and
  VG_(EMSG) for Vg_DebugExtraMsg.  A couple of other useful
  printf derivatives have been added to pub_tool_libcprint.h,
  most particularly VG_(vcbprintf).

* There's a small change in the core-tool interface to do with
  error handling: VG_(needs_tool_errors) has a new method
  void (*before_pp_Error)(Error* err)  which, if non-NULL, is
  called just before  void (*pp_Error)(Error* err).  This is to
  give tools the chance to look at errors before any part of them
  is printed, so they can print any XML preamble they like.

* coregrind/m_errormgr.c has been overhauled and cleaned up, and
  is a bit simpler and more commented.  In particular pp_Error
  and VG_(maybe_record_error) are significantly changed.

The diff is huge, but mostly very boring.  Most of the changes
are of the form

-   VG_(message)(Vg_UserMsg, "this is a message %d", n);
+   VG_(message)(Vg_UserMsg, "this is a message %d\n", n);

Unfortunately as a result of this, it touches a large number
of source files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10465
2009-07-15 14:48:32 +00:00
Nicholas Nethercote
07045477ca Merge the DARWIN branch onto the trunk.
I tried using 'svn merge' to do the merge but it did a terrible job and
there were bazillions of conflicts.  So instead I just took the diff between
the branch and trunk  at r10155, applied the diff to the trunk, 'svn add'ed
the added files (no files needed to be 'svn remove'd) and committed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156
2009-05-28 01:53:07 +00:00
Nicholas Nethercote
98386a7102 Fix up some stack trace inconsistencies:
- When printing suppressions, never print more entries than there are in the
  stack.  This avoids bogus suppressions in some cases!  (I haven't seen
  them on Linux, but I have seen them on Darwin.)

- When getting a stack trace, stop if we get an IP of zero or one;  that
  means we've hit the end of the stack.  And don't include that entry in the
  stack trace, because it's a guaranteed "???" if it's ever printed which is
  useless.

- In VG_(apply_StackTrace), we can now rely entirely on the n_ip parameter
  rather than looking for 0 or -1, because that check is done when the stack
  trace is first obtained.  In other words, stack traces all use an n_ip
  parameter to record their size, whereas previously they used an odd
  mixture of n_ip and null-termination.

- Rename 'n_ips' variables as 'max_n_ips' where appropriate;  those left as
  'n_ips' truly describe how many IPs there are in the stack trace.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9793
2009-05-07 23:08:10 +00:00
Julian Seward
779bbb61c6 Add support for reading Windows PDB debug info (symbols and line
numbers) when Valgrind is running Wine.  Modified version of a
patch by John Reiser (vgsvn+wine-load-pdb-debuginfo.patch) with
extensions to read a second format of line number tables.

Wine uses a new client request, VG_USERREQ__LOAD_PDB_DEBUGINFO,
to tell Valgrind when to read PDB info.  Wine's implementation
of module loading is vastly different from that used by
ld-linux.so, and it is too difficult to recognize what is going
on just by observing the calls to mmap and mprotect.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9580
2009-04-22 22:42:10 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Nicholas Nethercote
01a6838e61 Cleaned up the demangling mess:
- Now more clearly distinguishing between C++-demangling, Z-demangling, and
  below-main renaming, particularly in 'get_sym_name'.
  
- --demangle=no no longer prevents Z-demangling, which makes more sense,
  although it's unlikely to affect anyone.

- Broke the circular dependency between m_demangle and m_debuginfo by moving
  below-main renaming into m_debuginfo.

- Renamed some get_fnname_* functions to make their effect clearer, and
  improved their comments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9138
2009-02-11 06:06:10 +00:00
Nicholas Nethercote
a8c9970a34 Cleaned up the mess that was the treatment of "below main" functions such as
'__libc_start_main', in Massif, m_debuginfo and m_stacktrace.  As part of
this, --show-below-main is now visible to tools, and Massif pays attention
to it.

Improved the description of --show-below-main=yes in the manual.

Replaced some instances of "__libc_start_main" in the test *.exp files with
"(below main)", which is what will actually be seen.  Also updated
scalar.stderr.exp*, which should make it get closer to actually passing.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9131
2009-02-10 06:48:00 +00:00
Julian Seward
cc781fbfbd VG_(apply_StackTrace): following r8818, we should regard an entry of -1
as denoting the logical end of the stack.  This change stops printing
of a lot of junk below the logical "-1" end mark.  See added comments
for details.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9051
2009-01-24 00:07:53 +00:00
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