1007 Commits

Author SHA1 Message Date
Paul Floyd
50bded71b2 Bug 436413 - Warn about realloc of size zero
Adds a new warning to memcheck when realloc is used with a size of 0.
For a long time this has been "implementation defined" and so
non-portable. With C23 it will become UB.

Also adds a switch to turn off the error generation and a
second switch to select between the most common
"implementation" behaviours. The defaults for this second
switch are baked in at build time.
2023-03-10 21:55:14 +01:00
Paul Floyd
3a92995a85 DRD aarch64: Add some suppressions for DRD libstdc++
Also fix building drd/tests/std_mutex, needs -pthread.
2023-02-17 22:25:41 +01:00
Paul Floyd
add5fe9832 DRD regtest: try to make timed_mutex more reliable
On RHEL 7.6 ARM I see this with the lock returning false
but without the 11 second timeout. Try adding some sleeps.
2023-02-03 19:27:39 +01:00
Paul Floyd
dfaf018733 DRD regtesat: update suppression file for std_threads2
On RHEL 7.6 ARM glibc 2.17 is used which doesn't match the 2.2*
wildard, so widen the wildcard to just 2.*
2023-02-03 19:10:50 +01:00
Paul Floyd
cdabd4ba74 Regtest: foix warning from drd test pth_mutex_signal.c
GCC on RHEL 7.6 ARM complains about the empty init list.

I also noticed that we are using the SA_NOTIFY form of sigaction
(with that union member and handler prototype) but not setting the
SA_NOTIFY flag. Seems harmless in this case as we don't use
the siginfo or context.
2023-02-03 13:48:22 +01:00
Bart Van Assche
4978c9f657 drd/tests/pth_mutex_signal: Port to Darwin
This patch includes a revert of commit 2e873534bb49 ("macOS: drd
pth_mutex_signal test doesn't build").
2023-01-29 15:26:11 -08:00
Paul Floyd
2e873534bb macOS: drd pth_mutex_signal test doesn't build
pth_mutex_signal.c:50:13: error: use of undeclared identifier 'SIGRTMAX'
  sigaction(NATIVE_IO_INTERRUPT_SIGNAL, &signalAction, NULL);

Put this target under a condition for the moment.
2023-01-29 18:00:59 +01:00
Paul Floyd
a1f3651505 Remove one lingering trace of tilegx 2023-01-28 22:08:29 +01:00
Mark Wielaard
3155bacf26 tsan_thread_wrappers_pthread.h: Only include cstdint for C++11
Fixes build on older g++.
2023-01-28 21:54:03 +01:00
Paul Floyd
dee222c6e8 Bug 464859 - Build failures with GCC-13 (drd tsan_unittest)
Patch submitted by
	Khem Raj <raj.khem@gmail.com>
2023-01-27 08:30:41 +01:00
Paul Floyd
ded1adc432 FreeBSD: small change for pthread mutex types
It seems what is 'normal' and 'default' is not
portable.

And a bit more debuginfo mmap comment fixing
2023-01-21 13:51:50 +01:00
Paul Floyd
3c9cb7a711 Remove execute bit from drd tests std_string.cpp 2023-01-14 16:24:00 +01:00
Paul Floyd
99dfad28a5 Cleanup warnings
Now no warnings on Fedora 36
For a short while
2023-01-09 23:57:01 +01:00
Paul Floyd
1cea0e151b Cleanup of warnings, mostly -Wno-unused-but-set-variable 2023-01-08 17:51:37 +01:00
Paul Floyd
ab1eb2cb74 Update modified hg04 reference for DRD. 2022-12-29 20:59:25 +01:00
Bart Van Assche
72b556ab15 drd: Improve barrier support
Make test drd/tests/pth_barrier_thr_cr pass on Fedora 38.
2022-12-24 15:32:15 -08:00
Paul Floyd
ac6d9faf4b Bug 351857 - confusing error message about valid command line option
Added code to handle missing "=something".
2022-11-12 21:02:07 +01:00
Paul Floyd
807ea10a5c Fix typo in added EXTRA_DIST expected 2022-05-27 15:45:25 +02:00
Paul Floyd
b8eddd0226 Forgot to push Makefile.am with EXTRA_DIST for new expecteds 2022-05-27 14:49:25 +02:00
Paul Floyd
60d2018d7c Add new expecteds for drd/tests/annotate_trace_memory[_xml]
With clang13 x86 there is a code gen difference wrt GCC:

gcc:
  i64 = 9;
 8048a6f:       c7 05 68 9f 04 08 09    movl   $0x9,0x8049f68
 8048a76:       00 00 00
 8048a79:       c7 05 6c 9f 04 08 00    movl   $0x0,0x8049f6c
 8048a80:       00 00 00
  i64 += 0x12345678ULL;
 8048a83:       a1 68 9f 04 08          mov    0x8049f68,%eax
 8048a88:       8b 15 6c 9f 04 08       mov    0x8049f6c,%edx
 8048a8e:       05 78 56 34 12          add    $0x12345678,%eax
 8048a93:       83 d2 00                adc    $0x0,%edx
 8048a96:       a3 68 9f 04 08          mov    %eax,0x8049f68
 8048a9b:       89 15 6c 9f 04 08       mov    %edx,0x8049f6c

 clang:
   i64 = 9;
  401ae2:       c7 05 64 3f 40 00 00    movl   $0x0,0x403f64
  401ae9:       00 00 00
  401aec:       c7 05 60 3f 40 00 09    movl   $0x9,0x403f60
  401af3:       00 00 00
  i64 += 0x12345678ULL;
  401af6:       8b 15 60 3f 40 00       mov    0x403f60,%edx
  401afc:       81 c2 78 56 34 12       add    $0x12345678,%edx
  401b02:       83 15 64 3f 40 00 00    adcl   $0x0,0x403f64
  401b09:       89 15 60 3f 40 00       mov    %edx,0x403f60
  401b0f:       8d 85 1c ff ff ff       lea    -0xe4(%ebp),%eax

This inversion of the order of the low and high 32bits
of the 64bit word causes a difference in traced loads
and stores reported by DRD.
2022-05-27 14:18:18 +02:00
Paul Floyd
1f1abc9ec3 Add check for DRD OMP tests for FreeBSD 2022-05-10 20:08:43 +02:00
Paul Floyd
184e3ba052 Bug 453055 shared_timed_mutex drd test fails with "Lock shared failed" message
Patch submited by Jesus Checa jcheca@redhat.com
2022-04-27 21:13:45 +02:00
Paul Floyd
68ac5ca0ea Fix building on macOS
Adds a feature check for clockid_t

Also fix a typo in a macro affecting pthread_mutex_clocklock on Linux.
2022-04-11 22:32:45 +02:00
Paul Floyd
01048e33df FreeBSD sigreturn arg names again
Also make drd/tests/shared_timed_mutex more robust
Already not great using time delays, but the test seems
to fail intermittently due to spurious wakeups. So instead
of railing straight away, make it "three strikes and you're out".
2021-12-09 22:54:23 +01:00
Paul Floyd
c2607e093c Bug 446139 DRD/Helgrind with std::shared_timed_mutex::try_lock_until and try_lock_shared_until false positives
also
Bug 446138 DRD/Helgrind with std::timed_mutex::try_lock_until false positives
2021-12-02 00:03:27 +01:00
Mark Wielaard
5db4f35edf drd-manual.xml: Fix link to libstdc++ manual GLIBCXX_FORCE_NEW reference. 2021-11-21 15:25:14 +01:00
Bart Van Assche
bf0579a44a drd: Add a test program that interrupts pthread_mutex_lock()
This test fails, probably due to differences between native signal handling
and signal handling in the Valgrind core.
2021-11-20 14:28:05 -08:00
Paul Floyd
9abfed23c0 Bug 445504 Using C++ condition_variable results in bogus "mutex is locked simultaneously by two threads" warning(edit)
Add intercepts for pthread_cond_clockwait to DRD and Helgrind
Also testcase from bugzilla done by Bart, with configure check
2021-11-19 08:34:53 +01:00
Mark Wielaard
95468b34f1 Remove executable bits from source files (drd_main.c, pub_tool_machine.h) 2021-10-15 18:02:25 +02:00
Paul Floyd
22857ddd1d filter_stderr also needs to handle FreeBSD libthr 2021-10-12 19:31:04 +02:00
Mark Wielaard
df838bccab drd/tests: Extract start_thread which can come from libpthread or libc
The drd/tests/tc21_pthonce and drd/tests/annotate_barrier tests
would fail if start_thread came from libc (as it does in glibc 2.34)
instead of from libpthread. Extract start_thread in filter_stderr.in
and update the backtraces in annotate_barrier.stderr.exp and in
tc21_pthonce.stderr.exp

Tested against glibc 2.34, 2.33 and 2.17 on x86_64.
2021-10-12 18:51:23 +02:00
Paul Floyd
2269aeb76c Dnother iteration for getting the right expected line numbers. 2021-10-11 08:16:32 +02:00
Paul Floyd
8c0f72667e Fix the ramaining easily fixable warnings with clang
There's one remaining
memalign2.c:29:9: warning: unused variable 'piece' [-Wunused-variable]
because of a block of #if FreeBSD for memalign that looks unnecessary

Otherwise all that is left is a few like

warning: unknown warning option '-Wno-alloc-size-larger-than'; did you mean '-Wno-frame-larger-than='? [-Wunknown-warning-option]

because there is no standard for compiler arguments.
2021-10-10 21:56:49 +02:00
Paul Floyd
d187106a76 Updating a few expecteds based on valgrind-testresults
I tried to work out what the expecteds should be based on the changes to
the testcase source so there may be a bit more to do.
2021-10-10 12:03:38 +02:00
Paul Floyd
85bbe2853e FreeBSD support, patch 5
drd and helgrind tests
2021-10-07 21:33:45 +02:00
Mark Wielaard
f22758d6da Fix make distcheck by removing references to uncommitted files
Some files for the freebsd port have not yet committed, but were
already referenced in the Makefiles. Remove those references for
now to make distcheck happy.

	* coregrind/Makefile.am (valgrind_SOURCES): Remove
	launcher-freebsd.c
	* drd/tests/Makefile.am (check_PROGRAMS): Remove
	thread_name_freebsd.
	* none/tests/Makefile.am (SUBDIRS): Remove freebsd.
	(DIST_SUBDIRS): Likewise.
	* none/tests/freebsd/filter_stderr: Removed.
2021-10-07 13:43:19 +02:00
Paul Floyd
e2583c02a5 FreeBSD support, patch 2
Files in the root directory
Several Makefile.am files that have dependencies on FreeBSD autoconf
variables. Included a few new filter files to act as placeholders
to create new freebsd subdirectories.

Updated NEWS with the FreeBSD bugzilla items plus a couple of other
items fixed indirectly.
2021-10-07 08:18:47 +02:00
Paul Floyd
7074904a37 FreeBSD support, patch 4
DRD code
Mainly just intercepts, but also a hairy fix for early acces to
pthread_self()
2021-10-06 21:50:49 +02:00
Yi Fan Yu
4c8c4a9c3a drd/tests/swapcontext: Add SIGALRM handler to avoid stacktrace
During testing for oe-core build on QEMU,
SIGALRM can trigger during nanosleep.
This results a different stderr output than expected.

```
==277== Process terminating with default action of signal 14 (SIGALRM)
==277==    at 0x36C74C3943: clock_nanosleep@@GLIBC_2.17 (clock_nanosleep.c:43)
==277==    by 0x36C74C8726: nanosleep (nanosleep.c:25)
```

This stacktrace printing will not occur
if we add a handler that simply exits.

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

Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
2021-04-09 15:55:31 -07:00
Bart Van Assche
c9e88f3459 configure, drd: Only build the swapcontext test if swapcontext() is available
Add a configure test for swapcontext() since MUSL does not provide a
swapcontext() implementation. See also
https://bugs.kde.org/show_bug.cgi?id=434775 .
2021-03-22 19:21:15 -07:00
Paul Floyd
c136213d46 Keep on churning.
Without #define _XOPEN_SOURCE macports clang 9.0.1 on OSX 10.7.5 was
giving me

In file included from swapcontext.c:12:
/usr/include/ucontext.h:43:2: error: The deprecated ucontext routines require
      _XOPEN_SOURCE to be defined
 ^
swapcontext.

So I added #define _XOPEN_SOURCE

But that gives, on Solaris 11.3

In file included from /usr/include/limits.h:12:0,
                 from /usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/include-fixed/limits.h:168,
                 from /usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/include-fixed/syslimits.h:7,
                 from /usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/include-fixed/limits.h:34,
                 from swapcontext.c:7:
/usr/include/sys/feature_tests.h:354:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^

So make the #define _XOPEN_SOURCE conditional on darwin.
2021-03-03 08:53:51 +01:00
Paul Floyd
8fd6de1cfe Fix compilation on OS X 2021-03-02 17:41:47 +01:00
Paul Floyd
e42badd060 Bug 388787 - Support for C++17 new/delete
These over-aligned new and delete operators were added in C++ 17.
2021-03-02 13:32:22 +01:00
Mark Wielaard
9c9b909cbf Make the dwarf3 reader more robust and less chatty when things go wrong
Skip some stuff when seeing an unknown language, be less chatty about
parser issues.

All the issues seem to come from the multi-file, that is the shared
(supplementary or alt) file containing debuginfo shared by all the
gcc/runtime libraries.

There are a couple of issues that this patch works around:

- The multifile contains entries for the 'D' language, which has some
  constructs we don't expect.
- We don't read partial units correctly, which means we often don't know
  the language we are looking at.
- The parser is very chatty about issues it didn't expect (even if they
  are ignored, it will still output something)

It only shows up with --read-var-info=yes which some tests enable, but
which is disabled by default.

Also increate the timeout of drd/tests/pth_cleanup_handler.c because
DWARF reading is so slow.

https://bugs.kde.org/show_bug.cgi?id=433500
2021-02-26 02:34:32 +01:00
Paul Floyd
871f786535 Hopefully the last small changes for the drd swapcontext test 2021-02-24 11:01:13 +01:00
Bart Van Assche
caf05d5ca9 drd/tests/swapcontext: Improve the portability of this test further
- Remove the VALGRIND_STACK_REGISTER() invocation for the initial thread
  stack since it is superfluous. Remove the pthread_attr_getstack() call
  that became superfluous by this change.
- Change SIGINT into SIGALRM for FreeBSD since pthread_kill(..., SIGINT)
  causes the application to return a SIGINT status.
- Reduce the stack size of the threads created by this test.
2021-02-23 11:49:14 -08:00
Mark Wielaard
610973c79d swapcontext.vgtest fails with glibc-debuginfo installed
With debuginfo installed the backtace contains the swapcontext.S
source file. Filter that out, like the clone.S source file is in
drd/tests/filter_stderr.
2021-02-21 15:18:58 +01:00
Bart Van Assche
719d23b7a9 drd/tests/swapcontext: Improve portability 2021-02-20 14:51:15 -08:00
Mark Wielaard
7aac53c6d0 Fix valgrind.h include in drd/tests/swapcontext.c
In tree tests should include "valgrind.h" not <valgrind/valgrind.h>
the later might pick up the system installed valgrind.h and doesn't
work when srcdir != builddir.
2021-02-20 20:05:42 +01:00
Bart Van Assche
0062f2b519 drd/tests/swapcontext: Add a swapcontext() test 2021-02-20 08:44:50 -08:00