58 Commits

Author SHA1 Message Date
Mark Wielaard
3392155359 Upgrade to GNU General Public License version 3
- Update COPYING and VEX/LICENSE.GPL to version 3.
- Update README, NEWS, docs/manual license and contributing text.
- Update file headers to say either version 3 of the License,
  or (at your option) any later version.
- Leave tests and perf file headers as is, unless the code is derived
  from Valgrind/VEX.
- Leave valgrind.h, cachegrind.h, callgrind.h, drd.h, helgrind.h,
  memcheck.h and dhat.h Hybrid-BSD licensed.
2025-10-18 00:55:07 +02:00
Mark Wielaard
d68d584cea core errors suppression support
Add two new functions core_get_extra_suppression_info and
core_get_error_name as alternatives for tool suppression callbacks.
These functions are used in gen_suppression.

Instead of a tool name, a core error component name is "CoreError".

Two new suppression kinds FdBadCloseSupp and FdNotClosedSupp
were added. Corresponding to the FdBadClose and FdNotClosed
error kinds.

core_error_matches_suppression matches these suppression kinds
with error kinds.

core_get_extra_suppression_info and core_print_extra_suppression_use
are noops for core errors.

is_suppressible_error, supp_matches_error, load_one_suppressions_file
and show_used_suppressions have been adjusted to work with core
error kinds.

A new function VG_(found_or_suppressed_errs) helps to not output
an empty error summary if only core errors are requested, but no
errors were detected.

VG_(clo_track_fds) has been moved from pub_core_options.h to
pub_tool_options.h. And VG_(needs_core_errors) now takes a Bool
that can be set to false in the tool post_clo_init handler. This
is used in the none tool to request core errors, but disable all
reporting if no option has been given that enables such errors.

This make sure only the none/tests/fdleak_ipv4.stderr.exp needs
adjustment. For all other tests the output is exactly as before.

https://bugs.kde.org/show_bug.cgi?id=485778
2024-04-20 03:10:12 +02:00
Bart Van Assche
01f01fd910 drd: Update copyright notices 2020-10-10 18:11:31 -07:00
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
Julian Seward
5b7b6662f2 Add some initialisations that seemed to be required as a result of an LTO build with a gcc 8 prerelease. 2018-07-14 15:39:59 +02: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
Mark Wielaard
be052139d6 Don't require the current working directory to exist. Bug #369209.
At startup valgrind fetches the current working directory and stashes
it away to be used later (in debug messages, read config files or create
log files). But if the current working directory didn't exist (or there
was some other error getting its path) then valgrind would go in an
endless loop. This was caused by assuming that any error meant a larger
buffer needed to be created to store the cwd path (ERANGE). However
there could be other reasons calling getcwd failed.

Fix this by only looping and resizing the buffer when the error is
ERANGE. Any other error just means we cannot fetch and store the current
working directory. Fix all callers to check get_startup_wd() returns
NULL. Only abort startup if a relative path needs to be used for
user supplied relative log files. Debug messages will just show
"<NO CWD>". And skip reading any config files from the startup_wd
if it doesn't exist.

Also add a new testcase that tests executing valgrind in a deep,
inaccessible and/or non-existing directory (none/tests/nocwd.vgtest).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15989
2016-10-01 11:54:38 +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
b790e08474 Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15495
2015-08-05 14:38:57 +00:00
Florian Krohm
7a474c9455 Fix typos in source code. Patch by Dmitriy (olshevskiy87@bk.ru).
Fixes BZ #349874


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15394
2015-07-05 21:53:33 +00:00
Florian Krohm
ac3b22e6af Merge revisions 14445 and 14446 from the BUF_REMOVAL branch to trunk.
Two things:
- remove the buffer argument from VG_(DebugInfo_sect_kind)
- allocate AddrInfo::SectKind::objname dynamically


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14719
2014-11-13 21:41:28 +00:00
Florian Krohm
9d16aabb17 Constify the tool interface.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14642
2014-10-20 19:02:38 +00:00
Florian Krohm
5929994d48 Merge revisions 14230, 14602, and 14604 from the BUF_REMOVAL branch to trunk.
The change eliminates the fixed size buffers in gen_suppression and
show_used_suppressions. This is achieved by changing the return type from
VG_TDICT_CALL(tool_get_extra_suppression_info and
VG_TDICT_CALL(tool_print_extra_suppression_use from Bool to SizeT.
A return value of 0 indicates that nothing (except the terminating '\0'
which is always inserted) was written to the buffer. This corresponds to the
previous False return value. A return value which is equal to the buffer
size (that was passed in as function argument) indicates that the buffer was
not large enough. The caller then resizes the buffer and retries.
Otherwise, the buffer was large enough.
Regtested with a resize value of 1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14606
2014-10-07 14:28:52 +00:00
Florian Krohm
c88dc7f039 Tidy up m_xarray.c.
VG_(newXA) and VG_(cloneXA) never return NULL. Remove pointless asserts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14539
2014-09-15 18:50:17 +00:00
Philippe Waroquiers
619be966db Allow tools to provide some statistics in suppression list produced at the end
Option -v outputs a list of used suppressions. This only gives
the nr of times a suppression was used.
For a leak search, this only gives the nr of loss records that
have been suppressed, but it does not give additional needed details
to understand more precisely what has been suppressed
(i.e. nr of blocks and nr of bytes).

=> Add in the tool interface update_extra_suppression_use and
print_extra_suppression_info functions to allow the tool to record
additioonal use statistics for a suppression. These statistics
can be done depending on the error (and its data) which is suppressed.

Use this in memcheck for the leak suppressions, to maintain and output
the nr of blocks and bytes suppressed by a suppression during
the last leak search.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13651
2013-10-17 22:10:41 +00:00
Bart Van Assche
0dabd6dfd3 drd: Update copyright notice
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13613
2013-10-04 05:55:30 +00:00
Philippe Waroquiers
4c9052b4d6 fix incorrect lineno in supp error msgs+ -v give filename+lineno of used supp.
If a suppression file contains an error, the lineno reported could be wrong.
Also, give filename and lineno of the used suppressions in -v debugging output.

The fix consists in ensuring that tool specific read_extra function gets
the Int* lineno pointer, together with other VG_(get_line) parameters.






git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13469
2013-07-22 22:00:13 +00:00
Florian Krohm
d0aa69c331 Fix more Char/HChar mixups. Closing in...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13119
2012-11-10 22:29:54 +00:00
Florian Krohm
5337376bf2 More Char/HChar fixes and constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088
2012-10-27 18:39:11 +00:00
Florian Krohm
79b79d6388 First round of Char/HChar fixups for coregrind and memcheck.
Little bit of ripple in tools, too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13074
2012-10-21 19:43:43 +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
Bart Van Assche
12ec9d298a Remove emacs modeline and/or local variables from DRD source files
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12279
2011-12-04 15:54:19 +00:00
Bart Van Assche
45e4d0e7ee drd, XML tracing: move newline generation into DRD_(trace_msg)() / change tracing output format slightly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12146
2011-10-13 18:04:30 +00:00
Bart Van Assche
a1bf83f581 drd, XML: more XML output consistency improvements
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12145
2011-10-13 16:47:53 +00:00
Bart Van Assche
ef91802c74 drd, XML: make the XML output a little easier to parse
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12144
2011-10-13 16:42:49 +00:00
Bart Van Assche
539cdca4a5 drd, XML: Use proper XML syntax
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12140
2011-10-13 16:10:49 +00:00
Bart Van Assche
b7a5b789ef drd: Enable XML output. See also #282949. To do: document the output format.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12137
2011-10-11 19:08:39 +00:00
Bart Van Assche
9d1823dac9 DRD, refactoring: Introduce DRD_(trace_msg)()
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12120
2011-10-08 08:29:29 +00:00
Bart Van Assche
e53eb1ec0c Updated modeline and copyright statement in DRD source files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11642
2011-03-13 12:02:44 +00:00
Bart Van Assche
ad86d78a6c E-mail address update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11420
2010-10-10 18:07:31 +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
Bart Van Assche
d14798e66e Resynchronized client requests with the latest version of TSan's header file
<dynamic_annotations.h>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11096
2010-03-21 17:28:10 +00:00
Bart Van Assche
e5f5573f88 Changes:
- Generalized the behavior of happens-before / happens-after annotations such
  that not only 1:1 but also n:m patterns are supported.
- Dropped support for invoking happens-before / happens-after annotations on
  POSIX condition variables (pthread_cond_t).
- Report the details about the offending synchronization object in generic
  errors.
- Converted a few tl_assert() statements into error messages.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11073
2010-03-07 10:54:21 +00:00
Bart Van Assche
d0bb010178 Removed trailing whitespace in C source and header files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11052
2010-02-21 14:52:59 +00:00
Bart Van Assche
f291b29d30 Fixed a typo.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10874
2009-08-27 06:16:24 +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
Bart Van Assche
80fdc5a9e9 - Made the ANNOTATE_RWLOCK_*() macros binary compatible with Helgrind.
- Added two additional regression tests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10819
2009-08-15 10:50:35 +00:00
Bart Van Assche
e42e9fb0e2 Report mutex errors for each different mutex even if the call stacks are identical.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10681
2009-07-31 18:45:49 +00:00
Julian Seward
d7ed7f6a13 (almost completely just function renaming):
* VG_(find_seginfo): incrementally rearrange the DebugInfo list, like
  most of the other list-searching functions do.

* rename all VG_(*seginfo*) functions exported from m_debuginfo to
  VG_(*DebugInfo*).  "seginfo" was a historical name which was mostly
  but not completely, done away with some time back.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10678
2009-07-31 09:41:29 +00:00
Bart Van Assche
f4fcc00330 Only consider two error contexts as equivalent if the contexts have another
type than "data race error" or if both data race error contexts refer to the
same access type and the same access size.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10675
2009-07-31 08:45:02 +00:00
Bart Van Assche
fd574c0b25 Report an error message instead of triggering an assertion failure when a non-existing thread ID is passed to pthread_join() or pthread_cancel().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10674
2009-07-31 08:26:17 +00:00
Bart Van Assche
4854264dfa - Moved printing the thread number to the function that prints the
preamble.
- Matching suppression types with error contexts does now work properly.
- Cleanup: added more comments, renamed some functions, removed an unused
  function argument.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10634
2009-07-27 14:17:33 +00:00
Bart Van Assche
3770e93570 Made the error reporting behavior of DRD similar to that of other
Valgrind tools: if the same kind of error has been detected a second
time with an identical call stack, count it as an error but do not print
it a second time. The total number of detected errors remains unchanged
but the number of error contexts is now reported correctly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10633
2009-07-27 14:04:46 +00:00
Nicholas Nethercote
05c08fc86c Fix a compile warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10582
2009-07-24 07:54:51 +00:00
Bart Van Assche
511096144e DRD no longer prints the thread ID's assigned by the Valgrind core but only those assigned by DRD itself.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10488
2009-07-19 17:53:56 +00:00
Julian Seward
c020a7e3b6 Merge drd/ changes from branches/MESSAGING_TIDYUP r10464.
See trunk r10465 commit message for details.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10466
2009-07-15 14:49:17 +00:00
Bart Van Assche
e73284e37f - Added support for most of the ANNOTATE_...() macro's supported by
ThreadSanitizer.                                                              
- Modified DRD's error reporting code such that it does no longer let           
  the Valgrind core print the Valgrind thread ID but that it now prints         
  the DRD thread ID and name. Updated expected output files where               
  necessary.                                                                    
- Modified drd/test/Makefile.am such that the tests using gcc's built-in        
  functions for atomic memory access such that these are only compiled when     
  the gcc version in use supports these built-in functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10186
2009-05-31 18:53:54 +00:00
Bart Van Assche
219e77b9bc - Reindented code such that it uses three spaces for indentation instead
of two. The indentation of the DRD source code is now consistent with
  the other Valgrind source files.
- Added emacs mode line with indentation settings.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9496
2009-03-26 19:07:15 +00:00
Bart Van Assche
aaef6d016e Changes:
- pthread_barrier_wait() intercept now passes the information to the DRD
  tool whether or not this function returned
  PTHREAD_BARRIER_SERIAL_THREAD. This information is now displayed when
  the command-line option --trace-barrier=yes has been specified.
- Changed the cleanup functions for client objects that are called just
  before a thread stops into callback functions.
- Added DRD_(clientobj_delete_thread)().
- Removed DRD_(clientobj_resetiter)(void) and DRD_(clientobj_next)().
- Added test for race conditions between pthread_barrier_wait() and
  pthread_barrier_destroy() calls. An error message is now printed if
  this condition has been detected.
- Bug fix: pthread_barrier_delete() calls on barriers being waited upon
  are now reported.
- Removed DRD_() wrapper from around the name of some static variables and
  functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9211
2009-02-21 15:27:04 +00:00