17442 Commits

Author SHA1 Message Date
Paul Floyd
869e6e28b1 regtest: filter error address from dhat/tests/user_histo1 2023-04-21 23:10:51 +02:00
Paul Floyd
dc5209d42b Add missing user_histo1.stdout.exp to EXTRA_DIST 2023-04-21 22:57:09 +02:00
Paul Floyd
424340403c Bug 464103 - Enhancement: add a client request to DHAT to mark memory to be histogrammed 2023-04-21 21:21:23 +02:00
Mark Wielaard
6fc239ed47 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.
2023-04-21 18:13:31 +02:00
Mark Wielaard
9d6d45cfde Add cachegrind/tests/ann-diff4b-aux/w.rs
Missing testfile from commit 1fdf0e728a047f0aab4de805576b6a3a84f37b79
"Add diff and merge capability to `cg_annotate`."
2023-04-21 16:15:19 +02:00
Nicholas Nethercote
b12703598a Fix two xmllint errors. 2023-04-21 23:00:39 +10:00
Nicholas Nethercote
c2e62127ad 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.
2023-04-21 22:18:10 +10:00
Nicholas Nethercote
24932ed449 Update NEWS about recent Cachegrind changes. 2023-04-21 22:18:10 +10:00
Nicholas Nethercote
15a11f98f5 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.
2023-04-21 22:18:09 +10:00
Nicholas Nethercote
2cccba7cae Tweak printing of I refs and D refs lines.
Because `--cache-sim=no` is the default now, and `I   refs:` looks weird
by itself.
2023-04-21 22:18:09 +10:00
Nicholas Nethercote
307f96a519 Reorder options in Cachegrind's -h output.
Put the commonly used ones first.
2023-04-21 22:18:09 +10:00
Nicholas Nethercote
1fdf0e728a 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`.
2023-04-21 22:18:09 +10:00
Paul Floyd
a2af9adec4 Bug 397083 - Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and __wmemcmp_avx2_movbe 2023-04-20 22:11:31 +02:00
Mark Wielaard
e1684bc775 Add 436413 Warn about realloc of size zero to NEWS 2023-04-20 21:17:46 +02:00
Mark Wielaard
9fcac92ab3 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.
2023-04-20 15:04:03 +02:00
Alexandra Hájková
56ccb1e36c 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.
2023-04-20 14:29:45 +02:00
Mark Wielaard
0ead4c39f0 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.
2023-04-20 13:00:49 +02:00
Mark Wielaard
6effd73e90 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
2023-04-20 12:46:55 +02:00
Mark Wielaard
d270b7b15b 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>
2023-04-20 00:49:28 +02:00
Igor Nunes
b8a9da078b Enable getcpu on arm 32
https://bugs.kde.org/show_bug.cgi?id=419054
2023-04-19 23:54:28 +02:00
Carl Love
19c9e2418c 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.
2023-04-19 14:43:48 -04:00
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