60 Commits

Author SHA1 Message Date
Mark Wielaard
461cc5c003 Cleanup GPL header address notices by using http://www.gnu.org/licenses/
Sync VEX/LICENSE.GPL with top-level COPYING file. We used 3 different
addresses for writing to the FSF to receive a copy of the GPL. Replace
all different variants with an URL <http://www.gnu.org/licenses/>.

The following files might still have some slightly different (L)GPL
copyright notice because they were derived from other programs:

- files under coregrind/m_demangle which come from libiberty:
  cplus-dem.c, d-demangle.c, demangle.h, rust-demangle.c,
  safe-ctype.c and safe-ctype.h
- coregrind/m_demangle/dyn-string.[hc] derived from GCC.
- coregrind/m_demangle/ansidecl.h derived from glibc.
- VEX files for FMA detived from glibc:
  host_generic_maddf.h and host_generic_maddf.c
- files under coregrin/m_debuginfo derived from LZO:
  lzoconf.h, lzodefs.h, minilzo-inl.c and minilzo.h
- files under coregrind/m_gdbserver detived from GDB:
  gdb/signals.h, inferiors.c, regcache.c, regcache.h,
  regdef.h, remote-utils.c, server.c, server.h, signals.c,
  target.c, target.h and utils.c

Plus the following test files:

- none/tests/ppc32/testVMX.c derived from testVMX.
- ppc tests derived from QEMU: jm-insns.c, ppc64_helpers.h
  and test_isa_3_0.c
- tests derived from bzip2 (with embedded GPL text in code):
  hackedbz2.c, origin5-bz2.c, varinfo6.c
- tests detived from glibc: str_tester.c, pth_atfork1.c
- test detived from GCC libgomp: tc17_sembar.c
- performance tests derived from bzip2 or tinycc (with embedded GPL
  text in code): bz2.c, test_input_for_tinycc.c and tinycc.c
2019-05-26 20:07:51 +02:00
Nicholas Nethercote
8b689c66d9 Implement VG_(apply_ExeContext)().
It's been declared for a long time, but was lacking a definition.
2018-10-19 16:30:42 +11:00
Philippe Waroquiers
f772902b65 Fix uninitialised epoch when recording execontext.
A fresh execontext must have a DiEpoch_INVALID()
but the epoch was left uninitialised.

This was detected by self-hosting valgrind.
2018-07-29 21:37:25 +02:00
Julian Seward
b0ef574a2e VG_(archive_ExeContext_in_range): add missing comma in message to user. 2018-03-09 19:21:30 +01:00
Julian Seward
cceed053ce Bug 79362 - Debug info is lost for .so files when they are dlclose'd. Majorly reworked by Philippe Waroquiers. 2018-01-11 19:40:12 +01:00
Ivo Raisr
38edd50c0e Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16333
2017-05-04 15:09:39 +00:00
Philippe Waroquiers
488f1cc4dc Do not capture the free stacktrace in memcheck, unless we have
either to keep the free stacktrace and/or to compute full xtree memory.

Also, properly compute avg nr of IP per execontext: the avg must
be computed using the real nr of execontext stored, not the hash
table size.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16199
2017-01-11 22:13:52 +00:00
Philippe Waroquiers
39c197ef4d Improve the outer/inner setup: have the outer reporting the inner guest stacktrace
Note: the outer now unconditionally report the inner guest stacktrace.
If that would be a problem, we might add a sim-hint no-inner-guest-stacktrace
to optionally disable such outer behaviour.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16139
2016-11-19 13:24:13 +00:00
Julian Seward
adc2dafee9 Update copyright dates, to include 2015. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15577
2015-08-21 11:32:26 +00:00
Florian Krohm
b6251821a1 Remove a few embarassing comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15169
2015-04-30 20:44:17 +00:00
Philippe Waroquiers
06b9624009 Improve --stats=yes:
* give the avg nr of IPs per execontext
 * use the newly introduced %f in m_transtab.c ratio
   and in the avg nr of execontext per list



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15041
2015-03-26 22:12:40 +00:00
Florian Krohm
a3a57c92df Constify coregrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14656
2014-10-22 22:25:30 +00:00
Florian Krohm
a584a6773c coregrind files shall use vg_assert not tl_assert.
Tool files shall use tl_assert not vg_assert.
Fix code accordingly.
Adapted check_headers_and_includes to make sure the code
stays clean in that respect.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14542
2014-09-15 20:57:45 +00:00
Philippe Waroquiers
1b7ad6225a 2 execontexts in an hash table chain are not necessarily the same size.
So, ensure that when size differs, we do not start to compare them,
as this could otherwise cause a read buffer overrun



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14097
2014-06-24 22:13:43 +00:00
Julian Seward
dbf9b63605 Update copyright dates (20XY-2012 ==> 20XY-2013)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658
2013-10-18 14:27:36 +00:00
Florian Krohm
521a1c8ec4 In an attempt to fix the accounting for dynamic memory allocation
it turned out that coregrind freely allocates memory on the tool
arena (which it should not, conceptually) and tools rely on coregrind
doing so (by VG_(free)'ing memory allocated by coregrind).
Entangling this mess is risky and provides little benefit except
architectural cleanliness. 
Thinking more about it... It isn't really all that interesting how
much memory is allocated by tool code in and by itself.  What is
interesting is the total memory impact a tool has, e.g. as compared
to running "none".
So in this patch the number of memory arenas is consolidated by
subsuming VG_AR_TOOL/ERRORS/EXECCTXT into VG_AR_CORE.
VG_(malloc) and friends have been modified to operate on VG_AR_CORE.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13575
2013-09-20 21:34:40 +00:00
Philippe Waroquiers
0ac5603a9d Implement a more efficient allocation of small blocks which are never freed.
This generalises the "perm_malloc" function which was in ms_main.c
The new VG_(perm_malloc) is used in ms_main.c
and for execontext : when there are a lot of execontext, this
can save significant memory.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13238
2013-01-18 06:19:49 +00:00
Philippe Waroquiers
213b13ec9f Comment only changes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13227
2013-01-13 15:18:51 +00:00
Philippe Waroquiers
739ae0bcb6 Implement --keep-stacktraces=alloc|free|alloc-and-free|alloc-then-free|none
The option --keep-stacktraces controls which stack trace(s) to keep for
malloc'd and/or free'd blocks. This can be used to obtain more information
for 'use after free' errors or to decrease Valgrind memory and/or cpu usage
by recording less information for heap blocks.

This fixes 312913 Dangling pointers error should also report the alloc
stack trace.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13223
2013-01-12 19:53:08 +00:00
Philippe Waroquiers
e008ba56c0 output the nr of IP in the stacktrace header produced by v.info exectxt
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13222
2013-01-11 23:48:28 +00:00
Philippe Waroquiers
6bd8cf1eae Addition of GDB server monitor command 'v.info execontext' that shows
information about the stack traces recorded by Valgrind.
This can be used to analyse one possible cause of Valgrind high
memory usage for some programs.

At work, a big set of regression tests crashed out of memory under Valgrind.

Two main causes for out of memory were identified:
1. big memory usage for stacktrace (exe contexts) recording by Valgrind
2. big number of partially initialised bytes.

This patch adds a gdbsrv monitor command that output (very) detailed
information about all the recorded exe context.

This has been used to analyse the problem 1. above,
showing the following identified causes for a (too) big nr of execontexts:

A. When the JIT handles an unknown SP update, even when --track-origins=no,
an execontext is (uselessly) created and recorded
to track the (never used) origin of some uninitialised stack memory.
This creates a whole bunch of 'one IP' execontexts.

B. same problem in handling some system calls (at least the brk system
 calls always records an origin, even when --track-origins=yes).

C. The Valgrind unwinder cannot properly unwind some stack traces.
  It unwinds a few frames, then go bezerk and stops at a "random" IP.
  This then causes the same "logical" stacktrace to be truncated
  and records thousands of times with this "differentiating" last IP.


For problem cause 2 above ( a lot of partially initialised bytes),
the idea is to similarly add another gdbsrv commands that will output
statistics about which stack traces are causing a lot of uninitialised bytes. 




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13220
2013-01-10 20:42:51 +00:00
Julian Seward
4a3633e266 Update copyright dates to include 2012.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843
2012-08-05 15:46:46 +00:00
Florian Krohm
203ba59aaa Apply first_ip_delta also when only one frame is requested
for the back-trace.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12786
2012-07-26 02:14:28 +00:00
Florian Krohm
e9a06dcf87 Pass first_ip_delta to VG_(record_depth_1_ExeContext) as the function
cannot figure it out by itself.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12775
2012-07-23 15:40:41 +00:00
Florian Krohm
5dec28d4af Increase allowed size of a back-trace to 500 frames.
This limit is large enough for all practical purposes. It exists
only to sanity check the value specified with --num-callers.
Be frugal in record_ExeContext_wrk and only allocate on the stack 
as many frames as needed. 
Testcase included.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12685
2012-06-29 21:20:52 +00:00
Julian Seward
c96096ab24 Update all copyright dates, from 20xy-2010 to 20xy-2011.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206
2011-10-23 07:32:08 +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
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
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
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
Nicholas Nethercote
5a682bb3cf Renamed various things for clarity. Added some comments. And fixed the
dubious find-minimum-loss-record loop in print_results(), which was using an
inconsistent mixture of szB and szB+indirect_szB.  

Two test results changed, just different sort orders for same-sized loss
records.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9704
2009-05-01 00:30:43 +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
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
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Julian Seward
7874b34ffb Format string fixes for ppc{32,64}-aix5.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8444
2008-07-18 18:23:24 +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
4cae5c3ed5 Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This adds
support to Memcheck for tracking the origin of uninitialised values,
if you use the --track-origins=yes flag.

This currently causes some Memcheck regression tests to fail, because
they now print an extra line of advisory text in their output.  This
will be fixed.

The core-tool interface is slightly changed.  The version number for
the interface needs to be incremented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7982
2008-05-01 20:24:26 +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
da0726854c Add a new method VG_(record_depth_1_ExeContext), a trivial derivative
of VG_(record_ExeContext), which just records the first stack frame
but does not attempt to unwind the (guest) stack.  This is useful in
situations where we suspect unwinding the stack might cause a
segfault.

Use this in m_signals, when getting a backtrace following a guest
segfault.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7304
2007-12-21 01:24:59 +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
Julian Seward
9546ed460c Dynamically expand the ExeContext hash table, rather than using a
fixed size.  Partial commit of a patch from Christoph Bartoschek.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6776
2007-08-23 10:24:30 +00:00
Julian Seward
7315effc53 Make the ExeContext hash table a whole lot bigger.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6774
2007-08-22 23:51:33 +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
b2c70d2846 Make the hashing in VG_(record_ExeContext) 64-bit clean and more
robust.  Also incrementally rearrange the hash chains during searches.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6341
2006-10-24 21:43:38 +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
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
3866282110 Remove all remaining profiling gunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5388
2005-12-19 22:48:39 +00:00
Nicholas Nethercote
85545d1a1c Changed some overflow-prone counters from UInt to ULong.
Changed some printf specifiers accordingly, plus some more that were
incorrect.

Also put commas in various output numbers, eg. the leak check stats.  
This makes them much easier to read when they get big.  One
exception is in XML number-only fields such as <leakedbytes>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4874
2005-10-06 03:32:42 +00:00
Julian Seward
40f6598ba4 Increase some sizes to deal better with the new multigigabyte world:
- on 64-bit platforms, double the size of the supported address
  space to 32G.

- Increase the size of the ExeContext table 6 times.  Some very
  large apps have been observed to have been doing a lot of 
  searching in the old 4999 entry table.  This table may be
  OSetified in the fullness of time.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4808
2005-09-28 11:50:20 +00:00