17469 Commits

Author SHA1 Message Date
Nicholas Nethercote
d7081e936e Rename a bunch of cg_annotate test files.
For more consistency.
2023-03-27 08:52:28 +11:00
Paul Floyd
c7e01d28b4 Solaris: improve syscall trace for sysfs
More than just fix the format warning
2023-03-26 18:21:42 +02:00
Paul Floyd
5fd3b8947e Regtest: put back a glibc version ofr memalign_args test
I forgot that glibc aligned_alloc really is memalign, which
changes the callstack.
2023-03-26 17:05:25 +02:00
Paul Floyd
95ac41bc58 Regtest: add a filter for aligned alloc uninit args tests
These tests generate a varying number of errors per argument
depending on the platform and compiler.

The filter just prints the first unique error stanza which
allows 8 expecteds to be removed.
2023-03-26 16:37:56 +02:00
Paul Floyd
6bbe320a1a Solaris: format warnings in syswrap functions 2023-03-26 10:48:08 +02:00
Paul Floyd
3eaac58827 Regtest: clean aligned alloc tests on FreeBSD x86
Add a filter for size_t (unsigned long on 64bit platforms and unsigned
int on 32bit ones).

Add another expected for x86.
2023-03-25 19:52:41 +01:00
Nicholas Nethercote
179fc84ba7 Add more annotated/unannotated lines at the end.
This way, all CCs are categorised, which is useful for understanding
why thing were/weren't annotated.
2023-03-23 13:20:44 +11:00
Nicholas Nethercote
05d01cd681 Change Threshold: to Thresholds:.
Because all the thresholds other than the first one were always 100, due
to historical reasons.
2023-03-23 13:00:17 +11:00
Nicholas Nethercote
3f8494c8a4 Just use one decimal place for all percentages.
Simpler, shorter, and good enough in practice.
2023-03-23 13:00:17 +11:00
Nicholas Nethercote
b8a90ee968 Improve formatting of percentage columns.
Currently their width is mostly hard-wired in a quick and dirty fashion.
This commit does them properly, so:
- all columns are always the right width, even ones with really large
  percentages
- things like `( 1.00%)` are now `(1.00%)`
- any percentages that would involve a division by zero now show as
  `(n/a)` rather than `( 0.00%)`
2023-03-23 13:00:17 +11:00
Nicholas Nethercote
e9e7b663fb Make cg_annotate work with Python 3.9, by avoiding TypeAlias. 2023-03-23 09:50:21 +11:00
Paul Floyd
bb35cd572f Make cg_annotate independent of python3 install location 2023-03-22 20:43:30 +01:00
Mark Wielaard
3bb907290a cachegrind/tests/Makefile.am EXTRA_DIST add ann3.{{post,stderr}.exp,vgtest} 2023-03-22 11:41:53 +01:00
Nicholas Nethercote
4650b7949a Rewrite cg_annotate in Python.
Perl was a reasonable choice for `cg_annotate` in 2002, but not in 2023.
Also, the existing structure of the code is not good. These two things
make it hard to modify `cg_annotate` in any significant way.

Benefits of the change:
- Now written in a language that is (a) nice, and (b) not moribund.
- Easier to maintain, due to (a) abovementioned better language, (b)
  better code structure, and (c) better language tooling, such as
  formatters, type checkers, and linters.
- The new version is a little shorter.
- It runs about 2x faster.
- Argument handling is more standard. E.g. things like `--context 2`,
  `--auto`, `--no-auto` are supported. (The old forms that require `=`
  are still supported, though the `=yes`/`=no` forms are deprecated.)

The behaviour and output of the new version is identical for typical
uses, but there are some very minor changes for edge cases, which nobody
is likely to notice. For example:
- The file format is slightly changed: I removed support for '.'
  counts, which had the same meaning as '0'. This was a feature that
  Cachegrind never used, and the old script handled it inconsistently.
- The new version will abort on a malformed data line. The old version
  would just print a warning and continue.

The commit also adds a new test `ann3` that tests many parts of
`cg_annotate` that weren't tested previously, and tweaks the existing
`ann2` test.
2023-03-22 10:12:27 +11:00
Paul Floyd
394fa9223a Solaris: fix build, another aligned alloc typo 2023-03-21 22:11:11 +01:00
Paul Floyd
022a9caf40 Bug 467482 - Build failure on aarch64 Alpine
Patch submitted by
	fanquake@gmail.com
2023-03-17 19:48:08 +01:00
Paul Floyd
50f6533612 coverity: a couple of potential buffer overruns 2023-03-12 11:12:29 +01:00
Paul Floyd
d3a49926ad coverity: printf args format mismatch 2023-03-12 09:39:35 +01:00
Paul Floyd
18c278f386 coverity: copy paste error 2023-03-12 09:22:10 +01:00
Paul Floyd
a1bb70bbf1 FreeBSD: fix a syswrap compiler warning 2023-03-12 08:21:55 +01:00
Paul Floyd
8532c8b5e4 regtest: add an s390 expected for sized_aligned_new_delete_args 2023-03-12 08:20:57 +01:00
Paul Floyd
96a66dfda6 doc: Add asan equivalent to --realloc-zero-bytes-frees to manual-core 2023-03-11 16:47:56 +01:00
Paul Floyd
036bf06734 Refactor: reorder a few structs to make them more compact
Used pahole to find candidates. Don't have any performance
measurements, but it won't do any harm.
2023-03-11 16:31:43 +01:00
Paul Floyd
678b685c7b regtest: update one expected after fixing realloc_size_zero_mismatch.cpp 2023-03-11 08:07:06 +01:00
Paul Floyd
d9a8c601af regtest: build failure on Linux ppc64le, missing header 2023-03-11 06:49:13 +01:00
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
4af62304d9 Rename memcheck/tests/sized_aligned_new_delete_args.stderr.exp-glibc
It's for GCC / libstdc++ really
2023-03-10 18:41:26 +01:00
Paul Floyd
c2a0cd6e11 darwin regtest: fix unused variable warning
Copied and paster from old posix_memalign test
2023-03-10 18:39:59 +01:00
Paul Floyd
28e4efb2b1 Mised one aligned alloc wrapper on Linux
Need different expected for GCC / libstdc++

And I think that the 32bit expected will also need updating.
2023-03-10 08:40:40 +01:00
Paul Floyd
f6ee38b419 Malloc replacements: add some C++14/17 comments
Rearrange the code to group C++ 14 operator deeltes together.
2023-03-09 20:58:12 +01:00
Paul Floyd
294894459a regtest: try to fix bad merge of memalign_args expected on ppc64 2023-03-09 08:31:12 +01:00
Paul Floyd
e29bf11d87 regtest: update sized_aligned_new_delete_args expected
Don't quite understand how I managed to generate the original
expected.
2023-03-09 08:02:19 +01:00
Paul Floyd
d4affb0ab7 Make operator new aligned more like the standalone versions
If the alignment is not a power of two return nullptr for the
nothrow overload and bomb for the throwing overload.
2023-03-08 23:10:22 +01:00
Paul Floyd
bb5e8df560 regtest: add an arm expected for memalign_args 2023-03-08 21:34:25 +01:00
Paul Floyd
a7d86da0f6 regtest: fix warning in memalign_args and add debug info to sized_aligned_new_delete_args 2023-03-08 08:59:38 +01:00
Paul Floyd
2fa68c1cc7 auxchecks: fix building on FreeBSD
FreeBSD has a sha256sum that doesn't take long args (--check)
GNU sha256sum exists as gsha256sum so add a check for that to
configure.ac
2023-03-07 23:49:22 +01:00
Paul Floyd
18ca012c08 Fix compile failure on Linux
Use SizeT rather than size_t
Also make tests quieter with -q
2023-03-07 23:19:04 +01:00
Paul Floyd
114c528dab Add 32bit version of sized_aligned_new_delete_args expected
Asl add some parens to shut up clangd
2023-03-07 22:58:57 +01:00
Paul Floyd
ceee3e8922 Add checks to all new / delete overload arguments 2023-03-07 22:47:19 +01:00
Paul Floyd
2715ad4ab5 auxchecks: use outer configure make and compilers
On FreeBSD the hard coded 'make' will switch to BSD make rather
than the outer configure make - GNU make.

Similarly for systems with gcc and clang installed then an outer
'configure CC=clang' and then make auxchecks doesn't propagate
the CC to the inner gsl configure, which will use gcc.

Still need some work on the tarball checksum calculation.
2023-03-07 08:00:03 +01:00
Paul Floyd
e8d4d64e46 Bug 466104 - aligned_alloc problems, part 1
I think that these are all now done.
This commit refactors memalign and updates manual-core.xml
to say some behaviour of Valgrind depends on the build time
OS and libraries.
2023-03-06 21:50:01 +01:00
Paul Floyd
43880cb199 Linux musl: fix code refactor that missed one usage 2023-03-05 17:41:27 +01:00
Paul Floyd
b2ca91d669 Darwin regtest: again, forgot to delete errno
Setting errno on Darwin not supported on Valgrind.
2023-03-05 17:22:59 +01:00
Paul Floyd
0fecf3914d Darwin regtest: remove test that aligned_alloc fails with huge alignment
Needs more debugging.
2023-03-05 17:20:23 +01:00
Paul Floyd
b07d068887 Linux musl: one more iteration for aligned_alloc, assert in wrong place 2023-03-05 16:49:12 +01:00
Paul Floyd
e99cd3c6a3 Linux musl: corrections for aligned_alloc test 2023-03-05 16:43:25 +01:00
Paul Floyd
15fdfa8464 Fix a compiler warning 2023-03-05 16:34:50 +01:00
Paul Floyd
dc8af61b5a Linux musl: alligned_alloc accepts alignment of zero 2023-03-05 16:30:44 +01:00
Paul Floyd
afb5867858 Solaris regtest: final iteration for aligned_alloc 2023-03-05 16:24:44 +01:00
Paul Floyd
4ca2fa7b1f Solaris: bump alignment to next power of two for aligned_alloc
I'm not changing the Valgrind allocator to fit Solaris, too bad.
2023-03-05 16:13:09 +01:00