]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
23 months agoAdd some client requests to Cachegrind. users/njn/try-cachegrind-cl-reqs
Nicholas Nethercote [Thu, 10 Aug 2023 04:10:36 +0000 (14:10 +1000)] 
Add some client requests to Cachegrind.

23 months agoFix an error in `docs/README`.
Nicholas Nethercote [Wed, 23 Aug 2023 06:45:23 +0000 (16:45 +1000)] 
Fix an error in `docs/README`.

23 months agoUpdate Cachegrind description in the usage message and header comments.
Nicholas Nethercote [Thu, 10 Aug 2023 04:19:36 +0000 (14:19 +1000)] 
Update Cachegrind description in the usage message and header comments.

This matches an earlier change to the description in the user manual.

And fix indentation of the license in a couple of files.

23 months agoCorrect an error in Cachegrind's usage message.
Nicholas Nethercote [Wed, 23 Aug 2023 04:20:42 +0000 (14:20 +1000)] 
Correct an error in Cachegrind's usage message.

23 months agoBug 473604 - Fix bug472219.c compile failure with Clang 16
Paul Floyd [Tue, 22 Aug 2023 19:35:00 +0000 (21:35 +0200)] 
Bug 473604 - Fix bug472219.c compile failure with Clang 16

23 months agoAdd bug 426751 to NEWS
Paul Floyd [Tue, 22 Aug 2023 19:23:00 +0000 (21:23 +0200)] 
Add bug 426751 to NEWS

23 months agogdb --multi mode stdout redirecting to stderr
Mark Wielaard [Thu, 17 Aug 2023 13:40:30 +0000 (15:40 +0200)] 
gdb --multi mode stdout redirecting to stderr

When in stdio mode (talking to gdb through stdin/stdout, not
through a socket), redirect stdout to stderr and close stdin
for the inferior. That way at least some output can be seen,
but there will be no input.

This is workaround till we have real terminal handling.

     * coregrind/vgdb.c (main): Pass in_port to do_multi_mode.
     (do_multi_mode): Pass in_port to fork_and_exec_valgrind.
     (fork_and_exec_valgrind): Close stdin, redirect stdout to
     stderr if in_port <= 0.

https://bugs.kde.org/show_bug.cgi?id=471311

23 months agomusl: enable libstdc++ freeres
Paul Floyd [Sun, 20 Aug 2023 13:24:25 +0000 (15:24 +0200)] 
musl: enable libstdc++ freeres

Both libc and libstdc++ freeres were disabled for musl.
That means that libstdc++ was showing still reachable
memory on systems like Alpine.

23 months agoFreeBSD: try to make eventfd2 testcase deterministic
Paul Floyd [Sun, 20 Aug 2023 07:04:17 +0000 (09:04 +0200)] 
FreeBSD: try to make eventfd2 testcase deterministic

Add a sleep to give child 1 a chance to run.
Flush stdout every time.

23 months agoFreeBSD: complete loading debuginfo if entering capability mode
Paul Floyd [Sun, 20 Aug 2023 06:52:36 +0000 (08:52 +0200)] 
FreeBSD: complete loading debuginfo if entering capability mode

23 months agoAlways cleanup on exit from ML_(read_elf_object)
Paul Floyd [Sat, 19 Aug 2023 19:37:33 +0000 (21:37 +0200)] 
Always cleanup on exit from ML_(read_elf_object)

I'm still a but baffled as to why this wasn't seen earlier.
A FreeBSD testcase started failing with kernel 13.2 patch 2,
which is quite a minor change. The testcase gets an fd from
pdfork and the parent does a printf with the fd then zaps the
process with pdkill. Standalone the fd is 3, and that's what
the expected contains. However, when it started failing I saw
with lsof that fds 3 and 4 were associated with the guest exe
and ld-elf.so.1.

23 months agoSolaris: explain configure detection of scf repository door version
Paul Floyd [Fri, 18 Aug 2023 06:12:53 +0000 (08:12 +0200)] 
Solaris: explain configure detection of scf repository door version

23 months agoBug 472963 - Broken regular expression in configure.ac
Paul Floyd [Thu, 17 Aug 2023 20:05:47 +0000 (22:05 +0200)] 
Bug 472963 - Broken regular expression in configure.ac

Was extracting the last two decimal digits from a hex humber.

I switched to using grep and sed because the proposed solution
didn't work on Solaris 11.3.

23 months agoSupport lazy reading and downloading of DWARF debuginfo
Aaron Merey [Fri, 30 Jun 2023 22:31:42 +0000 (18:31 -0400)] 
Support lazy reading and downloading of DWARF debuginfo

Currently valgrind attempts to read DWARF .debug_* sections as well
as separate debuginfo files for ELF binaries as soon as a shared library
is loaded.  This might also result in the downloading of separate debuginfo
files via debuginfod.

This is inefficient when some of this debuginfo never ends up being used
by valgrind while running the client process.

This patch adds support for lazy reading and downloading of DWARF
debuginfo.  When an ELF shared library is loaded, the reading of .debug_*
sections as well as separate or alternate debuginfo is deferred until
valgrind handles an instruction pointer corresponding to a text segment
of the shared library.  At this point the deferred sections and separate
debug files are loaded.

This feature is only supported on ELF platforms.

https://bugs.kde.org/show_bug.cgi?id=471807

ChangeLog
* debuginfo.c (di_notify_ACHIEVE_ACCEPT_STATE): Replace
read_elf_debug_info with read_elf_object.
(addr_load_di): New function.  Attempts to load deferred debuginfo
associated with a given address.
(load_di): New function.  Attempts to load a given deferred
debuginfo associated with a given address.
(describe_IP): Add calls to load_di and addr_load_di.
(find_DiCfSI): Add call to load_di.

* priv_readelf.h (read_elf_object): New declaration.
(read_elf_debug): Ditto.

* priv_storage.h (struct _DebugInfo): New field 'bool deferred'.

* readelf.c (read_elf_debug_info): Split into read_elf_object and
read_elf_debug.
(read_elf_object): Read non .debug_* section from an ELF binary.
(read_elf_debug): Read .debug_* sections from an ELF binary as
as well any separate/alternate debuginfo files.

* storage.c (canonicaliseSymtab): Remove assert in order to support
canonicalization of deferred _DebugInfo.
(finish_CFSI_arrays): Add early return if _DebugInfo is
deferred in order to avoid freeing memory that will be needed
when reading debuginfo at a later time.
(canonicaliseTables): Ditto.

* pub_core_debuginfo.h (addr_load_di): New declaration.
(load_di): New declaration.

2 years agoBug 472219 - Syscall param ppoll(ufds.events) points to uninitialised byte(s)
Paul Floyd [Mon, 24 Jul 2023 20:06:00 +0000 (22:06 +0200)] 
Bug 472219 - Syscall param ppoll(ufds.events) points to uninitialised byte(s)

Add checks that (p)poll fd is not negative. If it is negative, don't check
the events field.

2 years agoSolaris: add a configure test for getaddrinfo
Paul Floyd [Mon, 24 Jul 2023 19:32:45 +0000 (21:32 +0200)] 
Solaris: add a configure test for getaddrinfo

Not available on Solaris 11.3

2 years agoFreeBSD: Add a DRD supppression for getaddrinfo
Paul Floyd [Sun, 23 Jul 2023 17:22:51 +0000 (19:22 +0200)] 
FreeBSD: Add a DRD supppression for getaddrinfo

On FreeBSD 13.2 x86

2 years agoBug 470132 - s390x: Increase test coverage for VGM
Andreas Arnez [Mon, 22 May 2023 17:49:08 +0000 (19:49 +0200)] 
Bug 470132 - s390x: Increase test coverage for VGM

Add more tests for the VGM instruction, to verify the fix for the VGM
wrap-around case.  Also test setting unused bits in the I2 and I3 fields,
to check that Valgrind ignores them as it should.

2 years agoBug 470132 - s390x: Fix the wrap-around case in VGM
Andreas Arnez [Mon, 22 May 2023 16:57:35 +0000 (18:57 +0200)] 
Bug 470132 - s390x: Fix the wrap-around case in VGM

Valgrind's implementation of VGM is incomplete:

* It doesn't support generating a wrap-around bit mask.  Such a mask
  should result when the ending bit position is smaller than the starting
  bit position.  Valgrind runs into an assertion failure instead.

* It doesn't ignore unused bits in the I2 and I3 fields of the
  instruction, as it should.

Fix this by re-implementing the main logic in s390_irgen_VGM().

2 years agoFreeBSD: add default to configure.ac FreeBSD 13 versions
Paul Floyd [Sun, 2 Jul 2023 10:59:40 +0000 (12:59 +0200)] 
FreeBSD: add default to configure.ac FreeBSD 13 versions

Also add comment to README.freebsd about ensuring that
jails set "uname -r" to be something compatible with the
normal RELEASE/STABLE/CURRENT releases.

2 years agoBug 470978 - s390x: Link the tools with -Wl,--s390-pgste
Andreas Arnez [Thu, 15 Jun 2023 15:24:53 +0000 (17:24 +0200)] 
Bug 470978 - s390x: Link the tools with -Wl,--s390-pgste

Programs that require the PGSTE mode to be enabled may currently fail
under Valgrind.  In particular this affects qemu-kvm.

While it is also possible to enable the PGSTE mode globally with

  sysctl vm.allocate_psgte=1

the problem can more easily be prevented by linking the Valgrind tools
with -Wl,--s390-pgste.  Add a configure check if the linker supports this,
and activate the flag if it does.

To verify the intended result, the following shell command can be used to
list the executables having this flag set:

  find . -type f -perm -u+x -execdir \
       /bin/sh -c 'readelf -lW $0 2>/dev/null | grep PGSTE' {} \; -print

2 years agoDon't print action vgdb me ... and continuing ... in vgdb --multi mode
Mark Wielaard [Fri, 9 Jun 2023 13:21:57 +0000 (15:21 +0200)] 
Don't print action vgdb me ... and continuing ... in vgdb --multi mode

Guard each (action) vgdb me ... VG_(umsg) printing with
  !(VG_(clo_launched_with_multi))

https://bugs.kde.org/show_bug.cgi?id=470830

2 years agos390x: Replace absolute jump for a relative one
Tulio Magno Quites Machado Filho [Wed, 14 Jun 2023 14:28:38 +0000 (11:28 -0300)] 
s390x: Replace absolute jump for a relative one

The bne instruction expects an absolute target address and it isn't
best-suited for implementing a short range jump, such as the one in
XCHG_M_R().
Replace it with jne which expects a relative address that can be
correctly computed a link time.

Interestingly, the jump is almost never taken. If it would, this would
crash the test.  However, linkers may complain when relacating the
target address used in bne.

2 years ago470121 - Can't run callgrind_control with valgrind 3.21.0 because of perl errors
Paul Floyd [Fri, 9 Jun 2023 11:17:58 +0000 (13:17 +0200)] 
470121 - Can't run callgrind_control with valgrind 3.21.0 because of perl errors

2 years agoMerge error, missing continuation in Makefile.am
Paul Floyd [Wed, 7 Jun 2023 20:54:22 +0000 (22:54 +0200)] 
Merge error, missing continuation in Makefile.am

2 years agoBug 470713 - Failure on the Yosys project: valgrind: m_libcfile.c:1802 (Bool vgPlain...
Paul Floyd [Wed, 7 Jun 2023 20:27:08 +0000 (22:27 +0200)] 
Bug 470713 -  Failure on the Yosys project: valgrind: m_libcfile.c:1802 (Bool vgPlain_realpath(const HChar *, HChar *)): Assertion 'resolved' failed

    When using sysctl kern proc pathname with the pid of the guest or -1
    we need to intercept the call otherwise the syscall will return the path
    of the memcheck tool and not the path of the guest.

    This uses VG_(realpath), which asserts if it doesn't get valid
    input pointers.

    sysctl kern proc pathname can use a NULL pointer in order to
    determine the length of the path (so users can allocate the minumum
    necessary). The NULL pointer was being passed on to VG_(realpath)
    without being checked, resulting in an assert.

2 years agomemcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)
Mark Wielaard [Thu, 1 Jun 2023 14:10:56 +0000 (16:10 +0200)] 
memcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)

When an realloc size zero error is emitted MC_(eq_Error) is called to
see if the errors can be deduplicated. This crashed since
Err_ReallocSizeZero wasn't handled. Handle it like Err_Free.

Also add a testcase for this case and test with both
--realloc-zero-bytes-frees=yes and
--realloc-zero-bytes-frees=no.
Which will report a different number of errors.

https://bugs.kde.org/show_bug.cgi?id=470520

2 years agoAdd --with-gdbscripts-dir=PATH configure option
Mark Wielaard [Sun, 14 May 2023 21:34:05 +0000 (23:34 +0200)] 
Add --with-gdbscripts-dir=PATH configure option

Currently the gdb valgrind scripts are installed under VG_LIBDIR
which is normally pkglibexecdir which is likely not in the default
gdb safe-path (a list of directories from which it is safe to
auto-load files). So users will have to add the directory to their
.gdbinit file.

This patch adds a --with-gdbscripts-dir=PATH configure option that
sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if
not given). A user can also configure --without-gdbscripts-dir to
disable adding a .debug_gdb_scripts section to the vgpreload library
and installing the valgrind-monitor python scripts completely.

Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor
python files and pass it with CPPFLAGS when building vg_preloaded.c
and vgdb.c to use instead of VG_LIBDIR.

https://bugs.kde.org/show_bug.cgi?id=469768

2 years agoAdd epoll_pwait2
Olli Vanhoja [Mon, 10 Oct 2022 09:44:22 +0000 (11:44 +0200)] 
Add epoll_pwait2

The only difference between epoll_pwait and epoll_pwait2 is the
timeout argument. For epoll_pwait2 this is a timespec (which is
always 64bit).

https://bugs.kde.org/show_bug.cgi?id=460192

2 years agoTypo in massif tests Makefile.am
Paul Floyd [Wed, 17 May 2023 06:09:39 +0000 (08:09 +0200)] 
Typo in massif tests Makefile.am

2 years agoLinux regtest: fixes for building on musl x86
Paul Floyd [Tue, 16 May 2023 06:20:59 +0000 (08:20 +0200)] 
Linux regtest: fixes for building on musl x86

2 years agoDRD: Make libgomp suppression work for any destdir
Paul Floyd [Sat, 13 May 2023 18:44:46 +0000 (20:44 +0200)] 
DRD: Make libgomp suppression work for any destdir

2 years agos390x: XC instruction: clear in 8-byte increments if possible
Andreas Arnez [Thu, 26 Jan 2023 16:41:18 +0000 (17:41 +0100)] 
s390x: XC instruction: clear in 8-byte increments if possible

The XC instruction is frequently executed in many programs, mainly for
clearing memory.  It can target from 1 to 256 bytes.  If the size is
constant and XC is actually used for clearing memory, Valgrind implements
it as a byte-wise loop and rolls out the loop for <= 8 bytes.

Instead of clearing byte-wise, it is more efficient to clear in 64-bit
increments, so do this for sizes >= 8 bytes.  Roll out the loop for up to
32 bytes.  Overall, this reduces the number of insns by a few percent and
provides a slight performance improvement for some programs.

2 years agos390x: Optimize CLC for 1, 2, 4, and 8 bytes
Andreas Arnez [Fri, 5 May 2023 15:48:31 +0000 (17:48 +0200)] 
s390x: Optimize CLC for 1, 2, 4, and 8 bytes

The CLC instruction compares two memory areas with sizes from 1 up to 256
bytes.  Currently Valgrind always implements it with a bytewise loop.

Add special handling for the sizes 1, 2, 4, and 8.  Realize CLC with an
8-, 16-, 32-, and 64-bit integer comparison, respectively, in those cases.
Apart from a slight optimization this also improves the diagnostics for
uninitialized values since it avoids the manufactured conditional jump
that breaks out of the loop over the individual bytes.

2 years agos390x: Update information in README.s390
Andreas Arnez [Tue, 24 Jan 2023 15:11:12 +0000 (16:11 +0100)] 
s390x: Update information in README.s390

Refresh some of the information in README.s390:

* update links to Principles of Operation and Reference Summary

* no longer recommend compiling with '-fno-builtin', since there are no
  known false positives due to builtin string operations anymore

* don't mention callgrind as being unsupported, since there are no known
  issues with it

2 years agoBug 465782 - s390x: Avoid __builtin_setjmp
Andreas Arnez [Wed, 15 Feb 2023 17:02:37 +0000 (18:02 +0100)] 
Bug 465782 - s390x: Avoid __builtin_setjmp

Currently Clang doesn't support __builtin_setjmp() on s390x.  Since
Valgrind already has an alternate implementation of setjmp/longjmp for
many other platforms, just add one for s390x as well, to get rid of this
dependency.

2 years agoBug 465782 - s390x: Adjust inline assemblies for Clang
Andreas Arnez [Tue, 14 Feb 2023 14:35:48 +0000 (15:35 +0100)] 
Bug 465782 - s390x: Adjust inline assemblies for Clang

Some s390x inline assemblies are written in such a way that they are
understood by GCC but not by Clang:

* use of "f" constraint for unsigned long variable

* use of "b" modifier when passing a constant

* use of the register notation "r11" in ".cfi_def_cfa"

Adjust the affected inline assemblies to avoid these constructs.

2 years agoBug 465782 - s390x: Drop -mzarch -march=z900 from assembler options
Andreas Arnez [Thu, 1 Sep 2022 13:03:01 +0000 (15:03 +0200)] 
Bug 465782 - s390x: Drop -mzarch -march=z900 from assembler options

The -mzarch flag is unsupported by Clang, and it is redundant on 64-bit
build systems.  Remove it.

Also remove '-march=z900', since it is unsupported by Clang as well.  It
would only be needed on build systems with a default architecture lower
than z900.  Such systems are out of service for some time now.

2 years agomusl: another fix for building testcases
Paul Floyd [Tue, 9 May 2023 20:13:28 +0000 (22:13 +0200)] 
musl: another fix for building testcases

2 years agoUpdate libiberty demangler
Mark Wielaard [Tue, 9 May 2023 11:15:26 +0000 (13:15 +0200)] 
Update libiberty demangler

Update the libiberty demangler using the auxprogs/update-demangler
script to gcc git commit 1719fa40c4ee4def60a2ce2f27e17f8168cf28ba.

This update includes:

- Update copyright years.
- ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): Add __.
- demangler: Templated lambda demangling
- cp-demangle.h (D_BUILTIN_TYPE_COUNT): Increment.
- cp-demangle.c (cplus_demangle_builtin_types): Add std::bfloat16_t
  entry.
- cp-demangle.c (cplus_demangle_type): Demangle DF16b.
- libiberty: Demangling 'M' prefixes
- libiberty: Demangle variadic template lambdas
- demangle.h (enum demangle_component_type): Add
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
- demangle.h (struct demangle_component): Add u.s_extended_builtin
  member.
- cp-demangle.c (d_dump): Handle
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
  DEMANGLE_COMPONENT_FIXED_TYPE.
- cp-demangle.c (d_make_extended_builtin_type): New function.
- cp-demangle.c (cplus_demangle_builtin_types): Add _Float entry.
- cp-demangle.c(cplus_demangle_type): For DF demangle it as _Float<N>
  or _Float<N>x rather than fixed point which conflicts with it.
- cp-demangle.c (d_count_templates_scopes): Handle
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
  DEMANGLE_COMPONENT_FIXED_TYPE.
- cp-demangle.c (d_find_pack): Handle
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
  Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
- cp-demangle.c (d_print_comp_inner): Likewise.
- cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
- rust-demangle.c (demangle_const): Add a missing goto pass_return
  at the end of the function.
- rust-demangle.c (demangle_path_maybe_open_generics): Add
  recursion limit.
- rust-demangle.c (demangle_const): Add recursion limit.
- libiberty: remove FINAL and OVERRIDE from ansidecl.h
- demangler: C++ modules support
- demangler: Reorganize for module demangling
- demangler: Structured Bindings
- Remove non-ANSI C macros in ansidecl.h.
- Remove non-ANSI C path in ansidecl.h.

2 years agoFreeBSD: update auxv test for x86
Paul Floyd [Tue, 9 May 2023 06:42:07 +0000 (08:42 +0200)] 
FreeBSD: update auxv test for x86

2 years agoFreeBSD: add Helgrind suppression for getaddrinfo
Paul Floyd [Mon, 8 May 2023 20:27:40 +0000 (22:27 +0200)] 
FreeBSD: add Helgrind suppression for getaddrinfo

Testcase was failing on x86

2 years agoregtest: remove FreeBSD version of expected for memcheck memalign_test
Paul Floyd [Sun, 7 May 2023 19:42:21 +0000 (21:42 +0200)] 
regtest: remove FreeBSD version of expected for memcheck memalign_test

During recent aligned allocations cleanup, the output became more
consistend and this is no longer needed.

2 years agoregtest: Deactivate tall call optimization in Massif bug469146
Paul Floyd [Sun, 7 May 2023 10:02:54 +0000 (12:02 +0200)] 
regtest: Deactivate tall call optimization in Massif bug469146

This optimization truncates the callstack causing fails on some platforms

2 years agoHelgrind Linux: make nss gethostbyname4 suppression cover all variants
Paul Floyd [Sun, 7 May 2023 10:01:06 +0000 (12:01 +0200)] 
Helgrind Linux: make nss gethostbyname4 suppression cover all variants

2 years agoLinux Helgrind: broaden _nss_dns_gethostbyname4_r to also cover _nss_files_gethostbyn...
Paul Floyd [Sun, 7 May 2023 08:11:08 +0000 (10:11 +0200)] 
Linux Helgrind: broaden _nss_dns_gethostbyname4_r to also cover _nss_files_gethostbyname4_r

2 years agoLinux Helgrind: add another suppression for intermittent failure in dl lookup
Paul Floyd [Sun, 7 May 2023 08:00:48 +0000 (10:00 +0200)] 
Linux Helgrind: add another suppression for intermittent failure in dl lookup

2 years agoLinux Helgrind: add suppression for intermittent failure in getaddrinfo regtest
Paul Floyd [Sun, 7 May 2023 07:54:50 +0000 (09:54 +0200)] 
Linux Helgrind: add suppression for intermittent failure in getaddrinfo regtest

Causes intermittent failure on gcc110 ppc

2 years agoFreeBSD regtest: add small hack to mcclean_after_fork gdb script
Paul Floyd [Sat, 6 May 2023 11:30:44 +0000 (13:30 +0200)] 
FreeBSD regtest: add small hack to mcclean_after_fork gdb script

As far as I can tell this was a regression in FreeBSD gdb around
Aug 2022 when the default install upgraded from 11.2 to 12.1

2 years agoBug 469049 - link failure on ppc64 (big endian) valgrind 3.20
Paul Floyd [Sat, 6 May 2023 05:54:45 +0000 (07:54 +0200)] 
Bug 469049 - link failure on ppc64 (big endian) valgrind 3.20

2 years agoBug 469146 - massif --ignore-fn does not ignore inlined functions
Paul Floyd [Sat, 6 May 2023 05:45:47 +0000 (07:45 +0200)] 
Bug 469146 - massif --ignore-fn does not ignore inlined functions

2 years agoFreeBSD: deactivate helgrind/tests/tls_threads
Paul Floyd [Sat, 6 May 2023 05:28:51 +0000 (07:28 +0200)] 
FreeBSD: deactivate helgrind/tests/tls_threads

No libc tunable, and I haven't seen any way to hack the libc
internals via debuginfo as was previously done on Linux.

2 years agoAdd Helgrind and DRD tests and suppressions for getaddrinfo on Linux
Paul Floyd [Fri, 5 May 2023 20:05:36 +0000 (22:05 +0200)] 
Add Helgrind and DRD tests and suppressions for getaddrinfo on Linux

Bump version to 3.22.0.GIT

The testcase was posted on the freebsd-hackers mailing list.
I had time to get suppressions for FreeBSD into 3.21 but
ran out of time for the test and Linux suppressions.

I did take a look at how thread sanitizer handles this.
Basically it intercepts the call, turns off checking,
calls the resl function then turns checking back on.

I don't see many other similar examples. Might be worth
looking at dlopen and atexit.

2 years ago-> 3.21.0 final VALGRIND_3_21_0
Mark Wielaard [Fri, 28 Apr 2023 15:30:04 +0000 (17:30 +0200)] 
-> 3.21.0 final

2 years agoAdd bug 469049 (--enable-lto=yes) to known issues
Mark Wielaard [Fri, 28 Apr 2023 15:27:35 +0000 (17:27 +0200)] 
Add bug 469049 (--enable-lto=yes) to known issues

2 years agoSupport SCV_FLAG also on VGP_ppc64be_linux
Mark Wielaard [Fri, 28 Apr 2023 11:34:48 +0000 (13:34 +0200)] 
Support SCV_FLAG also on VGP_ppc64be_linux

Running on a kernel that supports the SCV instruction (sets
PPC_FEATURE2_SCV in auxv AT_HWCAPS2) valgrind will assert: valgrind:
m_syswrap/syswrap-main.c:549 (getSyscallArgsFromGuestState): Assertion
'gst->guest_syscall_flag == SC_FLAG' failed.

Removing that assert makes most things work. But also filter out
PPC_FEATURE2_SCV from AT_HWCAPS2 for the client, so it shouldn't try
using the SCV instruction.

https://bugs.kde.org/show_bug.cgi?id=469097

2 years agoOnly do git configuration if in a git repo.
Nicholas Nethercote [Fri, 28 Apr 2023 00:28:30 +0000 (10:28 +1000)] 
Only do git configuration if in a git repo.

2 years agodhat: remove initial count value from access count histogram user requests
Paul Floyd [Thu, 27 Apr 2023 07:19:46 +0000 (09:19 +0200)] 
dhat: remove initial count value from access count histogram user requests

Based on feedback from Nick Nethercote.

2 years agoFreeBSD: add libc suppressions for Helgrind and DRD
Paul Floyd [Wed, 26 Apr 2023 20:17:16 +0000 (22:17 +0200)] 
FreeBSD: add libc suppressions for Helgrind and DRD

2 years agovgdb: Use --wait argument in multi mode
Alexandra Hájková [Tue, 25 Apr 2023 15:28:52 +0000 (17:28 +0200)] 
vgdb: Use --wait argument in multi mode

when waiting for valgrind to start.

2 years agoFix typos in NEWS and valgrind-monitor-def.py
Mark Wielaard [Wed, 26 Apr 2023 19:31:13 +0000 (21:31 +0200)] 
Fix typos in NEWS and valgrind-monitor-def.py

NEWS: who_point_at -> who_points_at
valgrind-monitor-def.py: MEN -> LEN

2 years agoClarify try push instructions.
Nicholas Nethercote [Wed, 26 Apr 2023 07:00:32 +0000 (17:00 +1000)] 
Clarify try push instructions.

2 years agoAdd a .git-blame-ignore-revs file.
Nicholas Nethercote [Wed, 26 Apr 2023 06:11:26 +0000 (16:11 +1000)] 
Add a .git-blame-ignore-revs file.

This prevents large-scale changes (e.g. auto-formatting) from negatively
affecting `git blame`.

2 years agoAdd new DHAT userreqs to NEWS
Paul Floyd [Tue, 25 Apr 2023 05:36:10 +0000 (07:36 +0200)] 
Add new DHAT userreqs to NEWS

2 years agoFix spelling in NEWS
Paul Floyd [Mon, 24 Apr 2023 18:56:16 +0000 (20:56 +0200)] 
Fix spelling in NEWS

2 years agoAdd memfd_create.stderr.exp-fcntl64 to EXTRA_DIST
Paul Floyd [Mon, 24 Apr 2023 18:53:13 +0000 (20:53 +0200)] 
Add memfd_create.stderr.exp-fcntl64 to EXTRA_DIST

2 years agoAdd a memfd_create.stderr.exp-fcntl64 variant
Mark Wielaard [Mon, 24 Apr 2023 12:35:21 +0000 (14:35 +0200)] 
Add a memfd_create.stderr.exp-fcntl64 variant

On 32bit systems a glibc fcntl call results in a fcntl64 syscall.

2 years agosolaris: aligned allocation issues
Paul Floyd [Sun, 23 Apr 2023 11:51:37 +0000 (13:51 +0200)] 
solaris: aligned allocation issues

Solaris 11.3 doesn't have aligned_alloc - add a configure time test
memalign does not accept either a size or an alignment of zero

2 years agovgdb: Always check the result from asprintf and write calls
Mark Wielaard [Sat, 22 Apr 2023 16:02:25 +0000 (18:02 +0200)] 
vgdb: Always check the result from asprintf and write calls

2 years agoTypo in NEWS
Paul Floyd [Sat, 22 Apr 2023 14:31:45 +0000 (16:31 +0200)] 
Typo in NEWS

(Try again, without a ton of changes from testing clang-format)

Thanks Tobias, on valgrind-developers

2 years agoRevert "Typo in NEWS"
Paul Floyd [Sat, 22 Apr 2023 14:29:27 +0000 (16:29 +0200)] 
Revert "Typo in NEWS"

This reverts commit bf347551c99313a4af9c38bdeda9b946c9795945.

2 years agoTypo in NEWS
Paul Floyd [Sat, 22 Apr 2023 14:08:28 +0000 (16:08 +0200)] 
Typo in NEWS

Thanks Tobias, on valgrind-developers

2 years agoregtest: add C++11 flag to build of user_histo1.cpp
Paul Floyd [Sat, 22 Apr 2023 07:37:25 +0000 (09:37 +0200)] 
regtest: add C++11 flag to build of user_histo1.cpp

For old compilers that don't default to C++11 or later

2 years agoAdd helgrind/tests/garbage.filtered.out to .gitignore
Mark Wielaard [Sat, 22 Apr 2023 01:41:04 +0000 (03:41 +0200)] 
Add helgrind/tests/garbage.filtered.out to .gitignore

2 years agoSet version to 3.21.0-RC2
Mark Wielaard [Sat, 22 Apr 2023 01:00:27 +0000 (03:00 +0200)] 
Set version to 3.21.0-RC2

2 years agoregtest: dhat/tests/user_histo1 filter out summary
Paul Floyd [Fri, 21 Apr 2023 21:35:37 +0000 (23:35 +0200)] 
regtest: dhat/tests/user_histo1 filter out summary

Too system dependent.

2 years agoregtest: add another expected for dhat/tests/user_histo1
Paul Floyd [Fri, 21 Apr 2023 21:17:32 +0000 (23:17 +0200)] 
regtest: add another expected for dhat/tests/user_histo1

2 years agoregtest: filter error address from dhat/tests/user_histo1
Paul Floyd [Fri, 21 Apr 2023 21:10:51 +0000 (23:10 +0200)] 
regtest: filter error address from dhat/tests/user_histo1

2 years agoAdd missing user_histo1.stdout.exp to EXTRA_DIST
Paul Floyd [Fri, 21 Apr 2023 20:57:09 +0000 (22:57 +0200)] 
Add missing user_histo1.stdout.exp to EXTRA_DIST

2 years agoBug 464103 - Enhancement: add a client request to DHAT to mark memory to be histogrammed
Paul Floyd [Fri, 21 Apr 2023 19:21:23 +0000 (21:21 +0200)] 
Bug 464103 - Enhancement: add a client request to DHAT to mark memory to be histogrammed

2 years agoAdd use strict and use warnings to perl callgrind scripts
Mark Wielaard [Fri, 21 Apr 2023 16:13:14 +0000 (18:13 +0200)] 
Add use strict and use warnings to perl callgrind scripts

This way we can simply use #! /usr/bin/env perl and don't need env -S
and perl -w flags which might confuse some packaging utilities.

2 years agoAdd cachegrind/tests/ann-diff4b-aux/w.rs
Mark Wielaard [Fri, 21 Apr 2023 14:15:15 +0000 (16:15 +0200)] 
Add cachegrind/tests/ann-diff4b-aux/w.rs

Missing testfile from commit 1fdf0e728a047f0aab4de805576b6a3a84f37b79
"Add diff and merge capability to `cg_annotate`."

2 years agoFix two xmllint errors.
Nicholas Nethercote [Fri, 21 Apr 2023 13:00:39 +0000 (23:00 +1000)] 
Fix two xmllint errors.

2 years agoRewrite Cachegrind docs.
Nicholas Nethercote [Thu, 20 Apr 2023 21:20:11 +0000 (07:20 +1000)] 
Rewrite Cachegrind docs.

For all the changes I've made recently. And also various other changes
that occurred over the past 20 years that didn't previously make it into
the docs.

Also, this change de-emphasises the cache and branch simulation aspect,
because they're no longer that useful. Instead it emphasises the
precision and reproducibility of instruction count profiling.

2 years agoUpdate NEWS about recent Cachegrind changes.
Nicholas Nethercote [Thu, 20 Apr 2023 21:06:06 +0000 (07:06 +1000)] 
Update NEWS about recent Cachegrind changes.

2 years agoGet rid of cache config warnings with `--cache-sim=no`.
Nicholas Nethercote [Fri, 21 Apr 2023 06:12:33 +0000 (16:12 +1000)] 
Get rid of cache config warnings with `--cache-sim=no`.

By not configuring the caches in that case. This requires moving a few
assertions around, because they currently assume that the caches are
configured.

2 years agoTweak printing of `I refs` and `D refs` lines.
Nicholas Nethercote [Thu, 20 Apr 2023 23:33:04 +0000 (09:33 +1000)] 
Tweak printing of `I refs` and `D refs` lines.

Because `--cache-sim=no` is the default now, and `I   refs:` looks weird
by itself.

2 years agoReorder options in Cachegrind's `-h` output.
Nicholas Nethercote [Fri, 21 Apr 2023 05:59:39 +0000 (15:59 +1000)] 
Reorder options in Cachegrind's `-h` output.

Put the commonly used ones first.

2 years agoAdd diff and merge capability to `cg_annotate`.
Nicholas Nethercote [Wed, 12 Apr 2023 00:02:13 +0000 (10:02 +1000)] 
Add diff and merge capability to `cg_annotate`.

And deprecate the use of `cg_diff` and `cg_merge`.

Because `cg_annotate` can do a better job, even annotating source files
when doing diffs in some cases.

The user requests merging by passing multiple cgout files to
`cg_annotate`, and diffing by passing two cgout files to `cg_annotate`
along with `--diff`.

2 years agoBug 397083 - Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and...
Paul Floyd [Thu, 20 Apr 2023 20:11:31 +0000 (22:11 +0200)] 
Bug 397083 - Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and __wmemcmp_avx2_movbe

2 years agoAdd 436413 Warn about realloc of size zero to NEWS
Mark Wielaard [Thu, 20 Apr 2023 19:17:46 +0000 (21:17 +0200)] 
Add 436413 Warn about realloc of size zero to NEWS

2 years agovgdb --multi: fix various typos, indentation and such (followup)
Mark Wielaard [Thu, 20 Apr 2023 13:04:03 +0000 (15:04 +0200)] 
vgdb --multi: fix various typos, indentation and such (followup)

commit 56ccb1e36c4722b56e3e602b986bc45025cb685d missed a few small
fixlets:

- one more comment at the top describing the three usages of vgdb.
- fixed up a few places where tabs were used for indentation (we are
  not very consistent in that either, after the release we'll look
  into adopting something like clang-format so you don't have to do
  all this by hand).
- Add a missing newline in coregrind/m_main.c to make
  none/tests/cmdline2 pass.

2 years agovgdb --multi: fix various typos, indentation and such
Alexandra Hájková [Thu, 20 Apr 2023 12:17:29 +0000 (14:17 +0200)] 
vgdb --multi: fix various typos, indentation and such

Remove --launched-with-multi from --help-debug output since it is not
a real user option. Do add a comment in m_main.c explaining the
internal usage.

Add a top-level comment describing the three usages of vgdb.

Fix comment description of decode_hexstring, create_packet,
split_hexdecode.

Consistently use 3 space indention in send_packet and receive_packet
and next_delim_string and split_hexdecode, count_delims,
do_multi_mode.

Fix return type of count_delims to size_t.

Add a note in coregrind/m_gdbserver/server.c to sync qSupported
replies with coregrind/vgdb.c.

Use vgdb (all lowercase) and GDB (all caps) consistently in the
manual.

2 years agovgdb: Handle EAGAIN in read_buf
Mark Wielaard [Thu, 20 Apr 2023 10:59:02 +0000 (12:59 +0200)] 
vgdb: Handle EAGAIN in read_buf

The file descriptor is on non-blocking mode and read_buf should only
be called when poll gave us an POLLIN event signaling the file
descriptor is ready for reading from. Still sometimes we do get an
occasional EAGAIN. Just do as told in that case and try to read again.

Also fix an ERROR errno in getpkt. This has never been observed, but
not getting the actual errno if the write fails in that case would be
really confusing.

2 years agogdbserver_tests/hginfo.vgtest: Use --ignore-thread-creation=yes
Mark Wielaard [Wed, 19 Apr 2023 13:53:53 +0000 (15:53 +0200)] 
gdbserver_tests/hginfo.vgtest: Use --ignore-thread-creation=yes

The testcase might notice an extra lock created by pthread_create.

https://bugs.kde.org/show_bug.cgi?id=444487

2 years agoBug 439685 compiler warning in callgrind/main.c
Mark Wielaard [Wed, 19 Apr 2023 22:42:40 +0000 (00:42 +0200)] 
Bug 439685 compiler warning in callgrind/main.c

main.c: In function 'vgCallgrind_post_syscalltime':
main.c:1779:25: warning: '*((void *)&ts_now+8)'
    may be used uninitialized in this function [-Wmaybe-uninitialized]
     struct vki_timespec ts_now;
main.c:1779:25: warning: 'ts_now'
    may be used uninitialized in this function [-Wmaybe-uninitialized]

In function collect_time the conditional expression in the switch
statement has type int (after integral promotions). GCC assumes that
it may have values other than the ones listed in the enumerated type
it was promoted from.  In that case the memory pointed to by its 1st
argument remains unintialised.  Later on vki_timespec_diff will read
the contents of ts_now undoditionally.  Hence the warning.

Using the default case for the tl_assert () removes the warning and
makes the code more robust should another enumerator ever be added to
Collect_Systime.

Contributed-by: Florian Krohm <florian@eich-krohm.de>
2 years agoEnable getcpu on arm 32
Igor Nunes [Fri, 20 Mar 2020 17:12:13 +0000 (17:12 +0000)] 
Enable getcpu on arm 32

https://bugs.kde.org/show_bug.cgi?id=419054

2 years agoPowerPC:, Update test test_isa_3_1_R1_RT.c, test_isa_3_1_R1_XT.c
Carl Love [Wed, 19 Apr 2023 17:45:19 +0000 (13:45 -0400)] 
PowerPC:, Update test test_isa_3_1_R1_RT.c, test_isa_3_1_R1_XT.c

The commit:

  commit 20cc0680c3491e062c76605b24e76dc02e16ef47
  Author: Carl Love <cel@us.ibm.com>
  Date:   Mon Apr 17 17:12:25 2023 -0400

      PowerPC:, Fix test test_isa_3_1_R1_RT.c, test_isa_3_1_R1_XT.c

Fixes an issue with the PAD_ORI used in the the tests by explicitly adding
SAVE_REGS and RESTORE_REGS macros.  The macros ensure that the block of
immediate OR instructions don't inadvertently change the contents of the
registers.

John Reiser suggested that the PAD_ORI asm statements in the PAD_ORI
macro be updated to inform the compiler which register the ori instruction
is clobbering.  The compiler will then generate the code to save and
restore the register automatically.  This is a cleaner solution then
explicitly adding the macros to store and restore the registers.  It is
functionally cleaner in that the value fetched by the instruction under
test is not modified by the PAD_ORI instructions.

This patch removes the SAVE_REG and RESTORE_REG macros and updates the
PAD_ORI macro.

2 years agocg_annotate: Remove the `-I`/`--include` option. users/njn/try-rm-I
Nicholas Nethercote [Sun, 16 Apr 2023 23:34:11 +0000 (09:34 +1000)] 
cg_annotate: Remove the `-I`/`--include` option.

For much the same reasons that I removed user annotations recently: it's
rarely/never used, and complicates things.

2 years agoBug 468606 - build: remove "Valgrind relies on GCC" check/output
Paul Floyd [Tue, 18 Apr 2023 20:27:55 +0000 (22:27 +0200)] 
Bug 468606 - build: remove "Valgrind relies on GCC" check/output