B.9. Changes in Valgrind

Red Hat Developer Toolset 3.0 is distributed with Valgrind 3.9, which provides a number of bug fixes over the version included in Red Hat Enterprise Linux and the previous version of Red Hat Developer Toolset. Below is a comprehensive list of new features in this release.

B.9.1. Changes Since Red Hat Developer Toolset 2.1 and Red Hat Enterprise Linux 6.6

The following features have been added since the release of Valgrind 3.8.1 included in Red Hat Developer Toolset 2.1 and Red Hat Enterprise Linux 6.6:

B.9.1.1. Changes in Tools

Memcheck
  • A new command line option, --partial-loads-ok[=argument], has been added. The option accepts the yes or no arguments. The default is no. The option can be used to significantly reduce the number of false error reports when handling vectorised code.
  • New command line options, --show-leak-kinds[=argument] and --errors-for-leak-kinds[=argument], have been added. Both options accept a comma-separated list of the following arguments: definite, indirect, possible, reachable, as well as all or none. The default setting for both options is equivalent to passing the definite and possible arguments.
    The options allow you to exercise a finer control over the leak checker by specifying the kinds of leaks that are to be shown or suppressed in a full leak search and that are to count as errors in a full leak search. Optionally, you can also specify the kinds of leaks to suppress directly in the suppressions file using the match-leak-kinds: line. Note that the generated suppressions files now include this line by default, which makes them more specific. To get the old behavior, remove the line prior to using the suppressions file.
  • A new command line option, --leak-check-heuristics[=argument], has been added. The option accepts a comma-separated list of the following arguments: stdstring, length64, newarray, multipleinheritance, as well as all or none. The default is none. The option improves the way the leak checker reports on possible leaks by specifying which interior pointers are considered valid.
  • A new command line option, --keep-stacktraces[=argument], has been added. The option accepts one of the following arguments: alloc, free, alloc-and-free, alloc-then-free, as well as none. The default is alloc-then-free. The option controls which stack traces to keep for blocks allocated using malloc() or freed using free(). This produces more usable errors and causes Valgrind to consume less resources.
  • Using the -v (or --verbose) option now provides more detailed information about the use of leak suppressions. For each suppression, the number of blocks and bytes it suppressed during the last leak search is now shown, as well as the file name and line number where the suppression is defined.
Helgrind
  • The use of statically initialized mutexes and condition variables (such as PTHREAD_MUTEX_INITIALISER) no longer results in false errors.
  • The use of the pthread_cond_wait() function that times out no longer results in false errors.

B.9.1.2. Other Changes

The space required by Valgrind now better corresponds with the expected capabilities of the target:
  • A new command line option, --num-transtab-sectors=number, has been added. The option can be used to specify the maximum number of sectors in the translation cache. The default number of sectors has been increased to 16 in order to accommodate applications that need to store large amounts of code. This improves performance because Valgrind does not need to re-translate and re-instrument machine code so often. The number of memory-mapped segments that can be tracked has been increased by a factor of 6.
The way Valgrind reads debugging information has been improved:
  • Valgrind no longer uses excessive amounts of virtual memory when reading debuginfo from large shared objects. Instead of temporarily mapping entire objects for reading, Valgrind now uses only a small, fixed buffer.
  • A new command line option, --debuginfo-server=ipaddress:port, has been added. This option allows you to instruct Valgrind to read debuginfo from objects stored on a different machine and served by a debuginfo server, which needs to be accessible on the specified IP address and port.
  • A new command line option, --allow-mismatched-debuginfo=argument, has been added. The option accepts the yes and no arguments. The default is no. Using this option, you can instruct Valgrind to ignore inconsistencies between main and debuginfo objects. Use with caution, as Valgrind may not be stable when main and debugging objects do not match.
A new command line option, --merge-recursive-frame=number, has been added. The option allows you to instruct Valgrind to detect and merge recursive algorithms, thus saving memory used to store the recorded stack traces. The value supplied to this option determines the complexity of the recursive calls to be merged.
A new command line option, --sigill-diagnostics=argument, has been added. This option accepts the yes and no arguments. The default is yes. Use this option to control whether Valgrind displays a warning when encountering an instruction it is unable to decode or translate.
In order to be able to run applications that natively require up to 35 GB of memory, Valgrind can now use 64 GB of memory on 64-bit targets.
GDB Server Monitor
  • A new client request, VALGRIND_MONITOR_COMMAND, has been added to valgrind.h. Use it to run gdbserver monitor commands from client programs.
  • A new monitor command, v.info open_fds, has been added. It provides a list of open file descriptors. Note that this is only available if the --track-fds=yes option was passed on startup.
  • It is now possible to pass an optional message with the v.info n_errs_found [message] monitor command, so that a comment can be inserted into process outputs. This helps to separate errors reported with different tests.
  • A new monitor command, v.info exectxt, has been added. It displays information about stack traces (executable contexts) recorded by Valgrind.
  • A new monitor command, v.do expensive_sanity_check_general, has been added. It runs various consistency checks. The command can be used to verify the sanity of the Valgrind heap.