17421 Commits

Author SHA1 Message Date
Nicholas Nethercote
b0e9fef201 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.
2023-04-19 08:41:08 +10:00
Paul Floyd
1e784548a1 Bug 468606 - build: remove "Valgrind relies on GCC" check/output 2023-04-18 22:27:55 +02:00
Carl Love
20cc0680c3 PowerPC:, Fix test test_isa_3_1_R1_RT.c, test_isa_3_1_R1_XT.c
Test adds a block of xori instructions for use with the PC relative tests.
The registers used by the xori instructions need to be saved and restored,
otherwise the register changes can impact the execution of the for loops
in the test as registers are randomly changed.  The issue occcurs when
GCC is optimizing and inlining the test functions.
2023-04-18 15:44:19 -04:00
Paul Floyd
04054f36be regtest: try to make the nightly script independent of test times 2023-04-18 21:18:12 +02:00
Paul Floyd
54982ab5c5 Forgot to add the modified file for 374596 2023-04-17 22:57:39 +02:00
Paul Floyd
1b3430761f Bug 468401 - [PATCH] Add a style file for clang-format
Patch submitted by:
	Petr Pavlu <petr.pavlu@dagobah.cz>
2023-04-17 22:05:30 +02:00
Paul Floyd
41a7f59a88 Bug 374596 - inconsistent RDTSCP support on x86_64 2023-04-17 21:53:23 +02:00
Paul Floyd
0bc69d40a5 illunmos: fix configure scf_handle_bind check
Migration to GCC 10 changes to 64bit load, see
https://github.com/omniosorg/omnios-extra/blob/master/build/valgrind/patches/libscf.patch
2023-04-16 14:27:04 +02:00
Mark Wielaard
932332e660 Use pipe in vgdb if system doesn't have pipe2
Add a configure check for pipe2. If it isn't available use pipe
and fcntl F_SETFD FD_CLOEXEC in vgdb.c.

https://bugs.kde.org/show_bug.cgi?id=468556
2023-04-16 13:18:00 +02:00
Mark Wielaard
03d9229f0b Fixup vgdb --help message
The --valgrind and the --vargs were missingin the OPTIONS summary.
A \n was missing after the --vargs description.
2023-04-16 01:55:55 +02:00
Mark Wielaard
5383480042 Set version to 3.21.0-RC1 2023-04-15 03:49:15 +02:00
Mark Wielaard
68cf3b5dbf Add bug 467036 Add time cost statistics for Regtest to NEWS 2023-04-15 01:04:23 +02:00
Mark Wielaard
f7ddfc7cfd Regtest: add time cost statistics
Add running time of each (sub) directory in seconds

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

Contributed-by: Jojo R <rjiejie@linux.alibaba.com>
2023-04-15 00:59:34 +02:00
Mark Wielaard
16be0ca4ba tests fdleak.h close all open file descriptors > 2
Use sysconf (_SC_OPEN_MAX) to find the upper limit. Or use 1024
if that fails.

https://bugs.kde.org/show_bug.cgi?id=467714
2023-04-15 00:14:01 +02:00
Mark Wielaard
fb6fbe4e84 gdbserver_tests: Improve compatibility of library directory name
Some linux os make softlink from customized directory like lib64xxx
into standard system lib64 directory.

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

Contributed-by: JojoR <rjiejie@gmail.com>
2023-04-15 00:00:36 +02:00
Earl Chew
d387566dd7 Support Linux syscall 434 pidfd_open 2023-04-14 23:06:48 +02:00
Paul Floyd
1e42338863 regtest: add new multi option to cmdline2 help output expecteds 2023-04-14 08:15:40 +02:00
Alexandra Petlanova Hajkova
0432ce486d vgdb: implement the extended-remote protocol
Executing vgdb --multi makes vgdb talk the gdb extended-remote
protocol. This means that the gdb run command is supported and
vgdb will start up the program under valgrind. Which means you
don't need to run gdb and valgrind from different terminals.
Also vgdb keeps being connected to gdb after valgrind exits. So
you can easily rerun the program with the same breakpoints in
place.

vgdb now implements a minimal gdbserver that just recognizes
a few extended-remote protocol packets. Once it starts up valgrind
it sets up noack and qsupported then it will forward packets
between gdb and valgrind gdbserver. After valgrind shutsdown it
resumes handling gdb packets itself.

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

Co-authored-by: Mark Wielaard <mark@klomp.org>
2023-04-14 00:08:53 +02:00
Paul Floyd
0ae17c117e FreeBSD: auxv changes for FreeBSD 13.2 2023-04-13 22:45:46 +02:00
Paul Floyd
b66f25877c FreeBSD: Helgrind suppression for std::__1::__thread_local_data on FreeBSD 13.2 2023-04-13 22:10:56 +02:00
Paul Floyd
ec1049b5d1 regtest: update filter_stanza so that sized_aligned_new_delete_args works on 32bit platforms 2023-04-13 22:06:34 +02:00
Nicholas Nethercote
57dbcacfdb Make --cache-sim=no the default for Cachegrind.
Also, don't print cache simulation details in the `desc:` line when the
cache simulation is disabled.

Docs changes are yet to come.
2023-04-12 11:08:15 +10:00
Nicholas Nethercote
8765b3358f Overhaul cg_annotate output.
Most notable, the "Function summary" section, which printed one CC for each
`file:function` combination, has been replaced by two sections, "File:function
summary" and "Function:file summary".

These new sections both feature "deep CCs", which have an "outer CC" for the
file (or function), and one or more "inner CCs" for the paired functions (or
files).

Here is a file:function example, which helps show which files have a lot of
events, even if those events are spread across a lot of functions.
```
> 12,427,830 (5.4%, 26.3%)  /home/njn/moz/gecko-dev/js/src/ds/LifoAlloc.h:
   6,107,862 (2.7%)           js::frontend::ParseNodeVerifier::visit(js::frontend::ParseNode*)
   3,685,203 (1.6%)           js::detail::BumpChunk::setBump(unsigned char*)
   1,640,591 (0.7%)           js::LifoAlloc::alloc(unsigned long)
     711,008 (0.3%)           js::detail::BumpChunk::assertInvariants()
```
And here is a function:file example, which shows how heavy inlining can result
in a machine code function being derived from source code from multiple files:
```
>  1,343,736 (0.6%, 35.6%)  js::gc::TenuredCell::isMarkedGray() const:
     651,108 (0.3%)           /home/njn/moz/gecko-dev/js/src/d64/dist/include/js/HeapAPI.h
     292,672 (0.1%)           /home/njn/moz/gecko-dev/js/src/gc/Cell.h
     254,854 (0.1%)           /home/njn/moz/gecko-dev/js/src/gc/Heap.h
```
Previously these patterns were very hard to find, and it was easy to overlook a
hot piece of code because its counts were spread across multiple non-adjacent
entries. I have already found these changes very useful for profiling Rust
code.

Also, cumulative percentages on the outer CCs (e.g. the 26.3% and 35.6% in the
example) tell you what fraction of all events are covered by the entries so
far, something I've wanted for a long time.

Some other, related changes:
- Column event headers are now padded with `_`, e.g. `Ir__________`. This makes
  the column/event mapping clearer.
- The "Cachegrind profile" section is now called "Metadata", which is
  shorter and clearer.
- A few minor test tweaks, beyond those required for the output changes.
- I converted some doc comments to normal comments. Not standard Python, but
  nicer to read, and there are no public APIs here.
- Roughly 2x speedups to `cg_annotate` and smaller improvements for `cg_diff`
  and `cg_merge`, due to the following.
  - Change the `Cc` class to a type alias for `list[int]`, to avoid the class
    overhead (sigh).
  - Process event count lines in a single split, instead of a regex
    match + split.
  - Add the `add_cc_to_ccs` function, which does multiple CC additions in a
    single function call.
  - Better handling of dicts while reading input, minimizing lookups.
  - Pre-computing the missing CC string for each CcPrinter, instead of
    regenerating it each time.
2023-04-11 09:58:43 +10:00
Paul Floyd
ab6d3928a5 regtest: warning cleanup
All for clang and mostly Apple clang
There are still numerous deprecated warnings on macOS 10.13
(sem* functions, syscall, sbrk, i386, PIEi, OSSpinLocki, swapcontext, getcontext)
2023-04-10 10:33:54 +02:00
Nicholas Nethercote
81c7be88b2 Improve pylintrc.
- Move it to `auxprogs/`, alongside `pybuild.sh`.
- Disable the annoying design lints, instead of just modifying the
  values (which often requires modifying them again later).
2023-04-06 09:29:08 +10:00
Paul Floyd
1db98dbdb1 Callgrind: make scripts independent of perl installation path 2023-04-04 08:32:36 +02:00
Paul Floyd
4e3439f28d Another minor README change
There's only one exp- and seven tools now (not counting
none and lackey).
2023-04-04 08:23:15 +02:00
Nicholas Nethercote
004ba8c0da cg_annotate: Remove support for user-annotated files.
They're of little use, and removing them opens the possibility of adding
`cg_merge`'s profile-merging functionality into `cg_annotate` itself.
2023-04-04 12:12:48 +10:00
Nicholas Nethercote
3d0d7a1924 Some tiny README fixes. 2023-04-04 08:06:41 +10:00
Paul Floyd
0641a27ffb Darwin regtest: update strchr filter 2023-04-02 15:28:21 +02:00
Paul Floyd
b32875d20c Darwin: more suppressions for Darwin 17, and another strchr wrapper 2023-04-02 15:22:54 +02:00
Paul Floyd
28a164761f Darwin: missed removing a couple of delete wrappers 2023-04-02 14:05:40 +02:00
Paul Floyd
e27f24c165 Darwin and FreeBSD: new / delete wrappers
A few typos in the FreeBSD soname wrappers
Many missing Darwin wrappers
And no need to repeat that GNU mangling is used
2023-04-02 13:43:14 +02:00
Paul Floyd
421693f432 Darwin: add support for setting errno from alloc wrappers 2023-04-02 11:06:18 +02:00
Paul Floyd
708d0eb6b4 Regtest: fixes for callgrind tests referring to cachegrind reference files
cachegrind/tests/cgout-test was renamed to ann1.cgout but the
two tests in callgrind that use it weren't updated.
2023-04-02 10:12:17 +02:00
Mark Wielaard
03e36bc36e Commit access and try branches 2023-04-01 23:58:20 +02:00
Paul Floyd
3f4052623c Darwin: try to improve posix_memalign / zone_memalign wrapper
It still doesn't set errno though.
2023-04-01 22:28:36 +02:00
Paul Floyd
e105ce0d8f Darwin regtest: another test using aligned_alloc
I added this test because I wanted to check the behaviour of
aligned_alloc on current macOS, but Valgrind doesn't support it
yet.
2023-04-01 21:11:58 +02:00
Paul Floyd
abf513febd Darwin regtest: fix building on older OS versions
aligned_alloc was added to macOS 10.15 and 10.13 is the latest
that we support.
2023-04-01 20:55:22 +02:00
Paul Floyd
81e51f9469 MUSL regtest: fix a comple of build problems building regression tests on Alpine 2023-03-31 13:39:34 +02:00
Paul Floyd
37edf8fbda Regtest: fix a couple of unused variable warnings
Copy & paste leftovers
2023-03-31 13:17:10 +02:00
Paul Floyd
78d0dc51c0 Remove source file added to EXTRA_DIST in error 2023-03-31 12:41:40 +02:00
Paul Floyd
3c0405a63d Add missing entries to cachegrind EXTRA_DIST 2023-03-31 12:09:45 +02:00
Mark Wielaard
f32cc294e3 Propagate memory allocation failure to out_of_memory_NORETURN
Provide the user with a hint of what caused an out of memory error.
And explain that some memory policies, like selinux deny_execmem
might cause Permission denied errors.

Add an err argument to out_of_memory_NORETURN. And change
am_shadow_alloc to return a SysRes (all three callers were already
checking for errors and calling out_of_memory_NORETURN).
2023-03-31 01:31:25 +02:00
Nicholas Nethercote
2d97182f0d cg_annotate: use <unspecified> for an unspecified filename.
Users shouldn't ever see this, but it's useful to distinguish this
malformed data file case from the missing symbol case (which is still
shown as `???`).
2023-03-29 09:15:56 +11:00
Nicholas Nethercote
6436be0a3f cg_annotate.in: fix a small bug in the printing of past-the-end lines. 2023-03-28 17:22:42 +11:00
Nicholas Nethercote
ca44cbbd7b Fix some problems in cachegrind/tests/Makefile.am. 2023-03-28 16:30:01 +11:00
Nicholas Nethercote
e95328b12c Simpler and more consistent cachegrind/tests/*.vgtest files.
- Always use `python3`, never `python`.
- Avoid unnecessary `../cachegrind/` in paths.
2023-03-28 15:44:34 +11:00
Nicholas Nethercote
551874920f Rewrite cg_merge in Python.
It's currently written in C, but `cg_annotate` and `cg_diff` are written in
Python. It's better to have them all in the same language.

The good news is that the Python code is 4.5x shorter than the C code.
The bad news is that the Python code is roughly 3x slower than the C
code. But `cg_merge` isn't used that often, so I think it's a reasonable
trade-off.
2023-03-28 14:54:27 +11:00
Nicholas Nethercote
8a75eecbad Rewrite cg_diff in Python.
For all the same reasons I rewrote `cg_annotate` in Python.

The commit also moves the Python "build" steps into
`auxprogs/pybuild.sh`, for easy sharing.

Finally, it very slightly tweaks the whitespace in the output of
`cg_annotate`.
2023-03-28 14:54:25 +11:00