1117 Commits

Author SHA1 Message Date
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
60303f4316 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-04 22:01:08 +01:00
Philippe Waroquiers
39a063513c Implement front end GDB commands for Valgrind gdbserver monitor commands.
This commit implements in python a set of GDB commands corresponding to the
Valgrind gdbserver monitor commands.

Basically, the idea is that one GDB command is defined for each valgrind
gdbserver subcommand and will generate and send a monitor command to valgrind.

The python code is auto-loaded by GDB as soon as GDB observes that the valgrind
preload core shared lib is loaded (e.g. vgpreload_core-amd64-linux.so).
This automatic loading is done thanks to the .debug_gdb_scripts section
added in vg_preloaded.c file.

Sadly, the auto-load only happens once valgrind has started to execute the code
of ld that loads this vg_preload file.

I have tried 2 approaches to have the python code auto-loaded when attaching at
startup to valgrind:
  * have valgrind gdbserver reporting first to GDB that the executable file is
    the tool executable (with a .debug_gdb_scripts section) and then reporting
    the real (guest) executable file.
    The drawback of this approach is that it triggers a warning/question in GDB
    according to the GDB setting 'set exec-file-mismatch'.
  * have valgrind gdbserver pretending to be multiprocess enabled, and report
    a fake process using the tool executable with a .debug_gdb_scripts section.
    The drawback of this is that this always creates a second inferior in GDB,
    which will be confusing.

Possibly, we might complete the below message :
  ==2984378== (action at startup) vgdb me ...
  ==2984378==
  ==2984378== TO DEBUG THIS PROCESS USING GDB: start GDB like this
  ==2984378==   /path/to/gdb /home/philippe/valgrind/littleprogs/some_mem
  ==2984378== and then give GDB the following command
  ==2984378==   target remote | /home/philippe/valgrind/git/improve/Inst/libexec/valgrind/../../bin/vgdb --pid=2984378
  ==2984378== --pid is optional if only one valgrind process is running

with:
  ==2984378== GDB valgrind python specific commands will be auto-loaded when execution begins.
  ==2984378== Alternatively, you might load it before with the GDB command:
  ==2984378==   source /abs/path/to/valgrind/install/libexec/valgrind/valgrind-monitor.py

The following GDB setting traces the monitor commands sent by a GDB valgrind
command to the valgrind gdbserver:
  set debug valgrind-execute-monitor on

How to use the new GDB valgrind commands?
-----------------------------------------

The usage of the GDB front end commands is compatible with the
monitor command as accepted today by Valgrind.

For example, the memcheck monitor command "xb' has the following usage:
 xb <addr> [<len>]

With some piece of code:
   'char some_mem [5];'
xb can be used the following way:
  (gdb) print &some_mem
  (gdb) $2 = (char (*)[5]) 0x1ffefffe8b
  (gdb) monitor xb 0x1ffefffe8b 5
  		    ff	  ff	  ff	  ff	  ff
  0x4A43040:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

The same action can be done with the new GDB 'memcheck xb' command:
  (gdb) memcheck xb 0x1ffefffe8b 5
  		    ff	  ff	  ff	  ff	  ff
  0x1FFEFFFE8B:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

At this point, you might ask yourself: "what is the interest ?".

Using GDB valgrind commands provides several advantages compared to
the valgrind gdbserver monitor commands.

Evaluation of arguments by GDB:
-------------------------------
For relevant arguments, the GDB command will evaluate its arguments using
the usual GDB evaluation logic, for example, instead of printing/copying
the address and size of 'some_mem', the following will work:
  (gdb) memcheck xb &some_mem sizeof(some_mem)
  		    ff	  ff	  ff	  ff	  ff
  0x1FFEFFFE8B:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

or:
  (gdb) p some_mem
  $4 = "\000\000\000\000"
  (gdb) memcheck xb &$4
  		    ff	  ff	  ff	  ff	  ff
  0x1FFEFFFE8B:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

This is both easier to use interactively and easier to use in GDB scripts,
as you can directly use variable names in the GDB valgrind commands.

Command completion by GDB:
--------------------------
The usual command completion in GDB will work for the GDB valgrind commands.
For example, typing TAB after the letter 'l' in:
  (gdb) valgrind v.info l
will show the 2 "valgrind v.info" subcommands:
  last_error  location
  (gdb) valgrind v.info l

Note that as usual, GDB will recognise a command as soon as it is unambiguous.

Usual help and apropos support by GDB:
--------------------------------------
The Valgrind gdbserver provides an online help using:
  (gdb) monitor help
However, this gives the help for all monitor commands, and is not searchable.
GDB provides a better help and documentation search.
For example, the following commands can be used to get various help
or search the GDB Valgrind command online documentation:
   help valgrind
   help memcheck
   help helgrind
   help callgrind
   help massif
to get help about the general valgrind commands or the tool specific commands.

Examples of searching the online documentation:
  apropos valgrind.*location
  apropos -v validity
  apropos -v leak

User can define aliases for the valgrind commands:
--------------------------------------------------
The following aliases are predefined:
  v and vg for valgrind
  mc for memcheck
  hg for helgrind
  cg for callgrind
  ms for massif

So, the following will be equivalent:
   (gdb) valgrind v.info location &some_mem
   (gdb) v v.i lo &some_mem
   (gdb) alias Vl = valgrind v.info location
   (gdb) Vl &some_mem

Thanks to Hassan El Karouni for the help in factorising the python
code common to all valgrind python commands using a decorator.
2023-01-08 16:00:57 +01:00
Philippe Waroquiers
56971834a7 Small improvement to documentation. 2023-01-02 23:05:35 +01:00
Philippe Waroquiers
c8bb6a62ca Add clo option -scheduling-quantum=<number> to control scheduler time slice.
This option can be useful when tracking race conditions which are sensitive
to thread scheduling.
2022-12-30 16:28:23 +01:00
Paul Floyd
5ab1e53f07 Manual: add FreeBSD to section about Linux stack cache
Use macOS rather than Mac OS X
2022-11-13 07:41:25 +01:00
Philippe Waroquiers
e489f31974 Add abexit in --vgdb-stopat. fix 459031 --error-exitcode doc. Add lwpid in thread_wrapper tracing.
Note that this modifies files on darwin/solaris/bsd but I only did a linux
build so possibly this commit might cause a compilation error, that should
then be trivial to fix.

Also added memmem test in the list of ignored files.
2022-09-17 22:54:05 +02:00
Mark Wielaard
614252608a Replace git:// URLs with https:// URLs
For unauthenticated git clones it is slightly more secure to use the https
link because the site certificate will be checked. Also https might be more
accessible from all places than the git protocol port.
2022-08-29 10:13:47 +02:00
Aaron Merey
8d4eb6be20 Add --enabled-debuginfod command line option
Currently debuginfod is enabled in Valgrind when the $DEBUGINFOD_URLS
environment variable is set and disabled when it isn't set.

This patch adds an --enable-debuginfod=<yes|no> command line option
to provide another level of control over whether Valgrind attempts
to download debuginfo. "yes" is the default value.

$DEBUGINFOD_URLS must still contain debuginfod server URLs in order
for this feature to work when --enable-debuginfod=yes.

https://bugs.kde.org/show_bug.cgi?id=453602
2022-05-20 02:48:53 +02:00
Mark Wielaard
8d3c8034b8 -> 3.19.0 final. 2022-04-11 15:29:18 +02:00
Randy MacLeod
2c0fb66569 Fix out of tree builds.
The paths to these files need to be fully specified in
the out of tree build case. glibc-2.X.supp is a generated file so the
full path is deliberately not specified in that case.

Also adjust the mpi include dir location as valgrind.h is
generated as well and needs to be taken out of build dir.

Also adjust the location of generated xml file. And the search paths
for the xmllint, xsltproc and xmlto programs.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
2022-04-07 23:44:02 +02:00
Mark Wielaard
0cf05f82d4 Set version to 3.19.0.GIT in configure.ac
And update docs/internals/release-HOWTO.txt.
2021-10-28 14:10:56 +02:00
Mark Wielaard
5aca524f5a Set version once in configure.ac, use in valgrind.h andvg-entities.xml
Currently the version is updated in 3 places, configure.ac,
include/valgrind.h and docs/xml/vg-entities.xml. This goes wrong from
time to time. So only define the version (and release date) once in
configure.ac and update both other places at configure time.
2021-10-17 23:14:50 +02:00
Mark Wielaard
20abe9e148 -> 3.18.0.RC1 2021-10-12 23:57:00 +02:00
Paul Floyd
a6096335c3 FreeBSD support, patch 8a
docs directory
2021-10-07 08:30:33 +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
Andreas Arnez
1bee3ab757 s390x: Wrap up misc-insn-3 and vec-enh-2 support
Wrap up support for the miscellaneous-instruction-extensions facility 3
and the vector-enhancements facility 2: Add 'case' statements for the
remaining unhandled arch13 instructions to 'guest_s390_toIR.c', document
the new support in 's390-opcodes.csv', adjust 's390-check-opcodes.pl', and
announce the new feature in 'NEWS'.
2021-09-01 14:47:10 +02:00
Julian Seward
997b3b5b96 -> 3.17.0 final. 2021-03-19 09:50:54 +01:00
Julian Seward
d695fb68e5 -> 3.17.0.RC1 2021-03-13 20:52:01 +01:00
Aaron Merey
fd4e3fb0ff PR432215 Add debuginfod functionality
debuginfod is an HTTP server for distributing ELF/DWARF debugging
information.  When a debuginfo file cannot be found locally, Valgrind
is able to query debuginfod servers for the file using its build-id.

readelf.c: Add debuginfod_find_debug_file(). Spawns a child process to
exec `debuginfod-find` in order to query servers for the debuginfo
file. Also add helper debuginfod_find_path().

pub_core_pathscan.h: Moved from priv_initimg_pathscan.h in order to use
VG_(find_executable)() in readelf.c.

docs: Add information regarding debuginfod to valgrind.1

memcheck/tests/linux: Add new test debuginfod-check.

tests/vg_regtest.in: Clear $DEBUGINFOD_URLS before running any tests.

https://bugs.kde.org/show_bug.cgi?id=432215
2021-02-26 01:38:42 +01:00
Mark Wielaard
c9781cc97e PR140939 --track-fds reports leakage of stdout/in/err and doesn't respect -q
Make --track-fds=yes not report on file descriptors 0, 1, and 2 (stdin,
stdout, and stderr) by default. Add a new option --track-fds=all that does
report on the std file descriptors still being open. Update testsuite and
documentation.

Original patch by Peter Kelly <pmk@cs.adelaide.edu.au>
Updated by Daniel Fahlgren <daniel@fahlgren.se>

https://bugs.kde.org/show_bug.cgi?id=140939
2021-02-10 19:37:08 +01:00
Andreas Arnez
159f132289 Bug 404076 - s390x: Implement z14 vector instructions
Implement the new instructions/features that were added to z/Architecture
with the vector-enhancements facility 1.  Also cover the instructions from
the vector-packed-decimal facility that are defined outside the chapter
"Vector Decimal Instructions", but not the ones from that chapter itself.

For a detailed list of newly supported instructions see the updates to
`docs/internals/s390-opcodes.csv'.

Since the miscellaneous instruction extensions facility 2 was already
addressed by Bug 404406, this completes the support necessary to run
general programs built with `--march=z14' under Valgrind.  The
vector-packed-decimal facility is currently not exploited by the standard
toolchain and libraries.
2020-12-08 19:37:39 +01:00
Philippe Waroquiers
c6bb6c8954 Document format of suppression files comment lines and blank lines.
Seems this was not documented.
2020-08-15 16:45:54 +02:00
Mark Wielaard
ab85a40053 docs: Always generate UTF-8 encoding 2020-06-09 12:59:40 +02:00
Mark Wielaard
a489f40f78 docs: Make sure all elements that need it have an id tag.
When generating HTML it is useful if every element that can be referenced
has a stable id. If it doesn't a random one is generated which makes it
harder to link to parts of the manual on the website. It also generates
spurious diffs. Explicitly add an id tag for the sect2 and sect3 elements
in dh-manual, a unique id for each legalnotice element and for each
FAQ question and answer.
2020-06-09 11:23:46 +02:00
Julian Seward
5902175ae9 -> 3.16.0 final
(cherry picked from commit 108b4a0880bc04f9db6133f79a8e4a98dcfc0cd0)
2020-06-08 19:56:55 +02:00
Mark Wielaard
4facc497bd doc/Makefile.am: Turn valid-manual and valid-manpages into real targets
Make valid-manual and valid-manpages real, separate make targets.
This means they can be run in parallel and they will only be run
once when doing make check, unless one of the manual and manpages
files has been touched.
2020-06-08 15:14:04 +02:00
Julian Seward
940ec1ca69 -> 3.16.0.RC1 2020-05-18 18:50:27 +02:00
Mark Wielaard
a2ef3fcf6a Explicitly set stylesheet to use with xmlto. 2020-05-15 12:30:00 +02:00
Mark Wielaard
5f4a5783aa Move to xmlto with fop for print-docs.
Default to using fop for pdf generation.
pdfxmltex is known to be broken by default.
xmlto can also use pdfxmltex or dblatex if available.
2020-05-15 01:12:44 +02:00
Mark Wielaard
052cc97416 Run xmllint on make check.
Now that we have valid docbookx xml lets try to keep it that way.
If the user has xmllint installed then run it on make check.
2020-05-15 00:44:52 +02:00
Mark Wielaard
21ceb09d5d Set refmiscinfo class to version in all manpages.
Otherwise xsltproc will complain while producing the manpage that
it doesn't know how to interpret the release string.
2020-05-14 19:11:26 +02:00
Mark Wielaard
de93a35139 Make Execution Trees references available in both manual and man pages.
Both the manual and the man pages reference xtrees. Create some shared
entities so both can reference the section.
2020-05-14 17:50:52 +02:00
Mark Wielaard
28b8d8b5a1 Turn manpages-index.xml into a "real" book, so it can be validated.
manpages-index.xml is just to easily get at each individual man page
with xsltproc. It wasn't a complete docbookx xml file. Now that it is
we can validate it with xmllint. It doesn't fully validate, but we
are close.
2020-05-14 16:10:27 +02:00
Mark Wielaard
555ddc4753 Use DTD DocBook XML V4.5 everywhere.
This makes the rule for xmllint easier since it doesn't need to
override the DTD to validate against. It also helps with other tools
tryinf to process the docbookx xml files.
2020-05-14 15:12:02 +02:00
Mark Wielaard
47660cc83d manual-core-adv.xml: listitems contain paras, not plain CDATA. 2020-05-13 15:46:16 +02:00
Mark Wielaard
014bcea452 manual-core.xml: Fix various xmllint issues.
Wrap bare CDATA text in a para and make sure that all listitems contain
paras.
2020-05-13 15:37:13 +02:00
Mark Wielaard
9e87b109a0 valgrind-manpage.xml: arg cannot contain a program, use replaceable. 2020-05-13 15:27:57 +02:00
Mark Wielaard
14c818557c Make manual-writing-tools.xml xmllint clean. 2020-05-13 14:08:19 +02:00
Mark Wielaard
ec37306c12 Make FAQ.xml xmllint clean. 2020-05-13 14:03:27 +02:00
Mark Wielaard
d772e25995 Remove SGcheck from documentation.
Since the SGcheck tool was removed for 3.16.0, also remove it from the
manual intro and core sections and the xml-output-protocol4 description.
2020-05-02 16:21:58 +02:00
Julian Seward
40187fcd61 Remove the exp-sgcheck tool.
It only ever worked on x86 and amd64, and even on those it had a high false
positive rate and was slow.  Everything it does, ASan can do faster, better,
and on more architectures.  So there's no reason to keep this tool any more.
2020-04-17 19:25:32 +02:00
Julian Seward
afe1d87762 Update bug status. 2020-04-17 16:18:37 +02:00
Andreas Arnez
942a48c1db Bug 417281 - s390x: Fix register usage of conditional moves
The s390x register usage callback marks the target register of a
conditional move as HRmWrite only.  It fails to mention the fact that the
target register is also an input to the insn (unless the condition is
"never" or "always").

This was discovered while investigating "grail" failures on s390x and
fixes the majority of them.
2020-03-18 19:28:24 +01:00
Julian Seward
95bde34862 Update bug status. 2020-03-13 14:35:59 +01:00
Julian Seward
6ef04b3818 Update bug status. 2020-03-09 09:08:28 +01:00
Philippe Waroquiers
fe9c80daa2 Add option -T to vgdb to output timestamps in vgdb information/error messages
Also cleanup some trailink blanks.
2020-02-08 13:01:24 +01:00
Andreas Arnez
e83c28e10c Bug 416301 - s390x: Support "compare and signal" instructions
Add VEX support for the s390x "compare and signal" instructions KEBR,
KDBR, KXBR, KEB, and KDB.  For now, let them behave exactly like their
non-signalling counterparts.  Enhance the bfp-4 test case to cover these
instructions as well.  Update the list of supported instructions in
s390-opcodes.csv.  Add a disclaimer to README.s390, explaining that FP
signalling is not handled accurately on s390x at the moment.
2020-02-06 12:28:19 +01:00
Andreas Arnez
dcceae252a s390x: Fix some typos in s390-opcodes.csv
Some lines in s390-opcodes.csv contain entries that look like this:

    ...,"arch12"implemented",...

They are probably introduced by some cut-and-paste error.  This is fixed.
2020-01-27 16:46:20 +01:00
Julian Seward
2052837a3e Update bug status. 2020-01-26 16:40:40 +01:00