1VALGRIND(1)                     Release 3.14.0                     VALGRIND(1)
2
3
4

NAME

6       valgrind - a suite of tools for debugging and profiling programs
7

SYNOPSIS

9       valgrind [valgrind-options] [your-program] [your-program-options]
10

DESCRIPTION

12       Valgrind is a flexible program for debugging and profiling Linux
13       executables. It consists of a core, which provides a synthetic CPU in
14       software, and a series of debugging and profiling tools. The
15       architecture is modular, so that new tools can be created easily and
16       without disturbing the existing structure.
17
18       Some of the options described below work with all Valgrind tools, and
19       some only work with a few or one. The section MEMCHECK OPTIONS and
20       those below it describe tool-specific options.
21
22       This manual page covers only basic usage and options. For more
23       comprehensive information, please see the HTML documentation on your
24       system: $INSTALL/share/doc/valgrind/html/index.html, or online:
25       http://www.valgrind.org/docs/manual/index.html.
26

TOOL SELECTION OPTIONS

28       The single most important option.
29
30       --tool=<toolname> [default: memcheck]
31           Run the Valgrind tool called toolname, e.g. memcheck, cachegrind,
32           callgrind, helgrind, drd, massif, lackey, none, exp-sgcheck,
33           exp-bbv, exp-dhat, etc.
34

BASIC OPTIONS

36       These options work with all tools.
37
38       -h --help
39           Show help for all options, both for the core and for the selected
40           tool. If the option is repeated it is equivalent to giving
41           --help-debug.
42
43       --help-debug
44           Same as --help, but also lists debugging options which usually are
45           only of use to Valgrind's developers.
46
47       --version
48           Show the version number of the Valgrind core. Tools can have their
49           own version numbers. There is a scheme in place to ensure that
50           tools only execute when the core version is one they are known to
51           work with. This was done to minimise the chances of strange
52           problems arising from tool-vs-core version incompatibilities.
53
54       -q, --quiet
55           Run silently, and only print error messages. Useful if you are
56           running regression tests or have some other automated test
57           machinery.
58
59       -v, --verbose
60           Be more verbose. Gives extra information on various aspects of your
61           program, such as: the shared objects loaded, the suppressions used,
62           the progress of the instrumentation and execution engines, and
63           warnings about unusual behaviour. Repeating the option increases
64           the verbosity level.
65
66       --trace-children=<yes|no> [default: no]
67           When enabled, Valgrind will trace into sub-processes initiated via
68           the exec system call. This is necessary for multi-process programs.
69
70           Note that Valgrind does trace into the child of a fork (it would be
71           difficult not to, since fork makes an identical copy of a process),
72           so this option is arguably badly named. However, most children of
73           fork calls immediately call exec anyway.
74
75       --trace-children-skip=patt1,patt2,...
76           This option only has an effect when --trace-children=yes is
77           specified. It allows for some children to be skipped. The option
78           takes a comma separated list of patterns for the names of child
79           executables that Valgrind should not trace into. Patterns may
80           include the metacharacters ?  and *, which have the usual meaning.
81
82           This can be useful for pruning uninteresting branches from a tree
83           of processes being run on Valgrind. But you should be careful when
84           using it. When Valgrind skips tracing into an executable, it
85           doesn't just skip tracing that executable, it also skips tracing
86           any of that executable's child processes. In other words, the flag
87           doesn't merely cause tracing to stop at the specified executables
88           -- it skips tracing of entire process subtrees rooted at any of the
89           specified executables.
90
91       --trace-children-skip-by-arg=patt1,patt2,...
92           This is the same as --trace-children-skip, with one difference: the
93           decision as to whether to trace into a child process is made by
94           examining the arguments to the child process, rather than the name
95           of its executable.
96
97       --child-silent-after-fork=<yes|no> [default: no]
98           When enabled, Valgrind will not show any debugging or logging
99           output for the child process resulting from a fork call. This can
100           make the output less confusing (although more misleading) when
101           dealing with processes that create children. It is particularly
102           useful in conjunction with --trace-children=. Use of this option is
103           also strongly recommended if you are requesting XML output
104           (--xml=yes), since otherwise the XML from child and parent may
105           become mixed up, which usually makes it useless.
106
107       --vgdb=<no|yes|full> [default: yes]
108           Valgrind will provide "gdbserver" functionality when --vgdb=yes or
109           --vgdb=full is specified. This allows an external GNU GDB debugger
110           to control and debug your program when it runs on Valgrind.
111           --vgdb=full incurs significant performance overheads, but provides
112           more precise breakpoints and watchpoints. See Debugging your
113           program using Valgrind's gdbserver and GDB for a detailed
114           description.
115
116           If the embedded gdbserver is enabled but no gdb is currently being
117           used, the vgdb command line utility can send "monitor commands" to
118           Valgrind from a shell. The Valgrind core provides a set of Valgrind
119           monitor commands. A tool can optionally provide tool specific
120           monitor commands, which are documented in the tool specific
121           chapter.
122
123       --vgdb-error=<number> [default: 999999999]
124           Use this option when the Valgrind gdbserver is enabled with
125           --vgdb=yes or --vgdb=full. Tools that report errors will wait for
126           "number" errors to be reported before freezing the program and
127           waiting for you to connect with GDB. It follows that a value of
128           zero will cause the gdbserver to be started before your program is
129           executed. This is typically used to insert GDB breakpoints before
130           execution, and also works with tools that do not report errors,
131           such as Massif.
132
133       --vgdb-stop-at=<set> [default: none]
134           Use this option when the Valgrind gdbserver is enabled with
135           --vgdb=yes or --vgdb=full. The Valgrind gdbserver will be invoked
136           for each error after --vgdb-error have been reported. You can
137           additionally ask the Valgrind gdbserver to be invoked for other
138           events, specified in one of the following ways:
139
140           ·   a comma separated list of one or more of startup exit
141               valgrindabexit.
142
143               The values startup exit valgrindabexit respectively indicate to
144               invoke gdbserver before your program is executed, after the
145               last instruction of your program, on Valgrind abnormal exit
146               (e.g. internal error, out of memory, ...).
147
148               Note: startup and --vgdb-error=0 will both cause Valgrind
149               gdbserver to be invoked before your program is executed. The
150               --vgdb-error=0 will in addition cause your program to stop on
151               all subsequent errors.
152
153           ·   all to specify the complete set. It is equivalent to
154               --vgdb-stop-at=startup,exit,valgrindabexit.
155
156           ·   none for the empty set.
157
158       --track-fds=<yes|no> [default: no]
159           When enabled, Valgrind will print out a list of open file
160           descriptors on exit or on request, via the gdbserver monitor
161           command v.info open_fds. Along with each file descriptor is printed
162           a stack backtrace of where the file was opened and any details
163           relating to the file descriptor such as the file name or socket
164           details.
165
166       --time-stamp=<yes|no> [default: no]
167           When enabled, each message is preceded with an indication of the
168           elapsed wallclock time since startup, expressed as days, hours,
169           minutes, seconds and milliseconds.
170
171       --log-fd=<number> [default: 2, stderr]
172           Specifies that Valgrind should send all of its messages to the
173           specified file descriptor. The default, 2, is the standard error
174           channel (stderr). Note that this may interfere with the client's
175           own use of stderr, as Valgrind's output will be interleaved with
176           any output that the client sends to stderr.
177
178       --log-file=<filename>
179           Specifies that Valgrind should send all of its messages to the
180           specified file. If the file name is empty, it causes an abort.
181           There are three special format specifiers that can be used in the
182           file name.
183
184           %p is replaced with the current process ID. This is very useful for
185           program that invoke multiple processes. WARNING: If you use
186           --trace-children=yes and your program invokes multiple processes OR
187           your program forks without calling exec afterwards, and you don't
188           use this specifier (or the %q specifier below), the Valgrind output
189           from all those processes will go into one file, possibly jumbled
190           up, and possibly incomplete. Note: If the program forks and calls
191           exec afterwards, Valgrind output of the child from the period
192           between fork and exec will be lost. Fortunately this gap is really
193           tiny for most programs; and modern programs use posix_spawn anyway.
194
195           %n is replaced with a file sequence number unique for this process.
196           This is useful for processes that produces several files from the
197           same filename template.
198
199           %q{FOO} is replaced with the contents of the environment variable
200           FOO. If the {FOO} part is malformed, it causes an abort. This
201           specifier is rarely needed, but very useful in certain
202           circumstances (eg. when running MPI programs). The idea is that you
203           specify a variable which will be set differently for each process
204           in the job, for example BPROC_RANK or whatever is applicable in
205           your MPI setup. If the named environment variable is not set, it
206           causes an abort. Note that in some shells, the { and } characters
207           may need to be escaped with a backslash.
208
209           %% is replaced with %.
210
211           If an % is followed by any other character, it causes an abort.
212
213           If the file name specifies a relative file name, it is put in the
214           program's initial working directory: this is the current directory
215           when the program started its execution after the fork or after the
216           exec. If it specifies an absolute file name (ie. starts with '/')
217           then it is put there.
218
219       --log-socket=<ip-address:port-number>
220           Specifies that Valgrind should send all of its messages to the
221           specified port at the specified IP address. The port may be
222           omitted, in which case port 1500 is used. If a connection cannot be
223           made to the specified socket, Valgrind falls back to writing output
224           to the standard error (stderr). This option is intended to be used
225           in conjunction with the valgrind-listener program. For further
226           details, see the commentary in the manual.
227
229       These options are used by all tools that can report errors, e.g.
230       Memcheck, but not Cachegrind.
231
232       --xml=<yes|no> [default: no]
233           When enabled, the important parts of the output (e.g. tool error
234           messages) will be in XML format rather than plain text.
235           Furthermore, the XML output will be sent to a different output
236           channel than the plain text output. Therefore, you also must use
237           one of --xml-fd, --xml-file or --xml-socket to specify where the
238           XML is to be sent.
239
240           Less important messages will still be printed in plain text, but
241           because the XML output and plain text output are sent to different
242           output channels (the destination of the plain text output is still
243           controlled by --log-fd, --log-file and --log-socket) this should
244           not cause problems.
245
246           This option is aimed at making life easier for tools that consume
247           Valgrind's output as input, such as GUI front ends. Currently this
248           option works with Memcheck, Helgrind, DRD and SGcheck. The output
249           format is specified in the file
250           docs/internals/xml-output-protocol4.txt in the source tree for
251           Valgrind 3.5.0 or later.
252
253           The recommended options for a GUI to pass, when requesting XML
254           output, are: --xml=yes to enable XML output, --xml-file to send the
255           XML output to a (presumably GUI-selected) file, --log-file to send
256           the plain text output to a second GUI-selected file,
257           --child-silent-after-fork=yes, and -q to restrict the plain text
258           output to critical error messages created by Valgrind itself. For
259           example, failure to read a specified suppressions file counts as a
260           critical error message. In this way, for a successful run the text
261           output file will be empty. But if it isn't empty, then it will
262           contain important information which the GUI user should be made
263           aware of.
264
265       --xml-fd=<number> [default: -1, disabled]
266           Specifies that Valgrind should send its XML output to the specified
267           file descriptor. It must be used in conjunction with --xml=yes.
268
269       --xml-file=<filename>
270           Specifies that Valgrind should send its XML output to the specified
271           file. It must be used in conjunction with --xml=yes. Any %p or %q
272           sequences appearing in the filename are expanded in exactly the
273           same way as they are for --log-file. See the description of --log-
274           file for details.
275
276       --xml-socket=<ip-address:port-number>
277           Specifies that Valgrind should send its XML output the specified
278           port at the specified IP address. It must be used in conjunction
279           with --xml=yes. The form of the argument is the same as that used
280           by --log-socket. See the description of --log-socket for further
281           details.
282
283       --xml-user-comment=<string>
284           Embeds an extra user comment string at the start of the XML output.
285           Only works when --xml=yes is specified; ignored otherwise.
286
287       --demangle=<yes|no> [default: yes]
288           Enable/disable automatic demangling (decoding) of C++ names.
289           Enabled by default. When enabled, Valgrind will attempt to
290           translate encoded C++ names back to something approaching the
291           original. The demangler handles symbols mangled by g++ versions
292           2.X, 3.X and 4.X.
293
294           An important fact about demangling is that function names mentioned
295           in suppressions files should be in their mangled form. Valgrind
296           does not demangle function names when searching for applicable
297           suppressions, because to do otherwise would make suppression file
298           contents dependent on the state of Valgrind's demangling machinery,
299           and also slow down suppression matching.
300
301       --num-callers=<number> [default: 12]
302           Specifies the maximum number of entries shown in stack traces that
303           identify program locations. Note that errors are commoned up using
304           only the top four function locations (the place in the current
305           function, and that of its three immediate callers). So this doesn't
306           affect the total number of errors reported.
307
308           The maximum value for this is 500. Note that higher settings will
309           make Valgrind run a bit more slowly and take a bit more memory, but
310           can be useful when working with programs with deeply-nested call
311           chains.
312
313       --unw-stack-scan-thresh=<number> [default: 0] ,
314       --unw-stack-scan-frames=<number> [default: 5]
315           Stack-scanning support is available only on ARM targets.
316
317           These flags enable and control stack unwinding by stack scanning.
318           When the normal stack unwinding mechanisms -- usage of Dwarf CFI
319           records, and frame-pointer following -- fail, stack scanning may be
320           able to recover a stack trace.
321
322           Note that stack scanning is an imprecise, heuristic mechanism that
323           may give very misleading results, or none at all. It should be used
324           only in emergencies, when normal unwinding fails, and it is
325           important to nevertheless have stack traces.
326
327           Stack scanning is a simple technique: the unwinder reads words from
328           the stack, and tries to guess which of them might be return
329           addresses, by checking to see if they point just after ARM or Thumb
330           call instructions. If so, the word is added to the backtrace.
331
332           The main danger occurs when a function call returns, leaving its
333           return address exposed, and a new function is called, but the new
334           function does not overwrite the old address. The result of this is
335           that the backtrace may contain entries for functions which have
336           already returned, and so be very confusing.
337
338           A second limitation of this implementation is that it will scan
339           only the page (4KB, normally) containing the starting stack
340           pointer. If the stack frames are large, this may result in only a
341           few (or not even any) being present in the trace. Also, if you are
342           unlucky and have an initial stack pointer near the end of its
343           containing page, the scan may miss all interesting frames.
344
345           By default stack scanning is disabled. The normal use case is to
346           ask for it when a stack trace would otherwise be very short. So, to
347           enable it, use --unw-stack-scan-thresh=number. This requests
348           Valgrind to try using stack scanning to "extend" stack traces which
349           contain fewer than number frames.
350
351           If stack scanning does take place, it will only generate at most
352           the number of frames specified by --unw-stack-scan-frames.
353           Typically, stack scanning generates so many garbage entries that
354           this value is set to a low value (5) by default. In no case will a
355           stack trace larger than the value specified by --num-callers be
356           created.
357
358       --error-limit=<yes|no> [default: yes]
359           When enabled, Valgrind stops reporting errors after 10,000,000 in
360           total, or 1,000 different ones, have been seen. This is to stop the
361           error tracking machinery from becoming a huge performance overhead
362           in programs with many errors.
363
364       --error-exitcode=<number> [default: 0]
365           Specifies an alternative exit code to return if Valgrind reported
366           any errors in the run. When set to the default value (zero), the
367           return value from Valgrind will always be the return value of the
368           process being simulated. When set to a nonzero value, that value is
369           returned instead, if Valgrind detects any errors. This is useful
370           for using Valgrind as part of an automated test suite, since it
371           makes it easy to detect test cases for which Valgrind has reported
372           errors, just by inspecting return codes.
373
374       --exit-on-first-error=<yes|no> [default: no]
375           If this option is enabled, Valgrind exits on the first error. A
376           nonzero exit value must be defined using --error-exitcode option.
377           Useful if you are running regression tests or have some other
378           automated test machinery.
379
380       --error-markers=<begin>,<end> [default: none]
381           When errors are output as plain text (i.e. XML not used),
382           --error-markers instructs to output a line containing the begin
383           (end) string before (after) each error.
384
385           Such marker lines facilitate searching for errors and/or extracting
386           errors in an output file that contain valgrind errors mixed with
387           the program output.
388
389           Note that empty markers are accepted. So, only using a begin (or an
390           end) marker is possible.
391
392       --sigill-diagnostics=<yes|no> [default: yes]
393           Enable/disable printing of illegal instruction diagnostics. Enabled
394           by default, but defaults to disabled when --quiet is given. The
395           default can always be explicitly overridden by giving this option.
396
397           When enabled, a warning message will be printed, along with some
398           diagnostics, whenever an instruction is encountered that Valgrind
399           cannot decode or translate, before the program is given a SIGILL
400           signal. Often an illegal instruction indicates a bug in the program
401           or missing support for the particular instruction in Valgrind. But
402           some programs do deliberately try to execute an instruction that
403           might be missing and trap the SIGILL signal to detect processor
404           features. Using this flag makes it possible to avoid the diagnostic
405           output that you would otherwise get in such cases.
406
407       --keep-debuginfo=<yes|no> [default: no]
408           When enabled, keep ("archive") symbols and all other debuginfo for
409           unloaded code. This allows saved stack traces to include file/line
410           info for code that has been dlclose'd (or similar). Be careful with
411           this, since it can lead to unbounded memory use for programs which
412           repeatedly load and unload shared objects.
413
414           Some tools and some functionalities have only limited support for
415           archived debug info. Memcheck fully supports it. Generally, tools
416           that report errors can use archived debug info to show the error
417           stack traces. The known limitations are: Helgrind's past access
418           stack trace of a race condition is does not use archived debug
419           info. Massif (and more generally the xtree Massif output format)
420           does not make use of archived debug info. Only Memcheck has been
421           (somewhat) tested with --keep-debuginfo=yes, so other tools may
422           have unknown limitations.
423
424       --show-below-main=<yes|no> [default: no]
425           By default, stack traces for errors do not show any functions that
426           appear beneath main because most of the time it's uninteresting C
427           library stuff and/or gobbledygook. Alternatively, if main is not
428           present in the stack trace, stack traces will not show any
429           functions below main-like functions such as glibc's
430           __libc_start_main. Furthermore, if main-like functions are present
431           in the trace, they are normalised as (below main), in order to make
432           the output more deterministic.
433
434           If this option is enabled, all stack trace entries will be shown
435           and main-like functions will not be normalised.
436
437       --fullpath-after=<string> [default: don't show source paths]
438           By default Valgrind only shows the filenames in stack traces, but
439           not full paths to source files. When using Valgrind in large
440           projects where the sources reside in multiple different
441           directories, this can be inconvenient.  --fullpath-after provides a
442           flexible solution to this problem. When this option is present, the
443           path to each source file is shown, with the following all-important
444           caveat: if string is found in the path, then the path up to and
445           including string is omitted, else the path is shown unmodified.
446           Note that string is not required to be a prefix of the path.
447
448           For example, consider a file named
449           /home/janedoe/blah/src/foo/bar/xyzzy.c. Specifying
450           --fullpath-after=/home/janedoe/blah/src/ will cause Valgrind to
451           show the name as foo/bar/xyzzy.c.
452
453           Because the string is not required to be a prefix,
454           --fullpath-after=src/ will produce the same output. This is useful
455           when the path contains arbitrary machine-generated characters. For
456           example, the path /my/build/dir/C32A1B47/blah/src/foo/xyzzy can be
457           pruned to foo/xyzzy using --fullpath-after=/blah/src/.
458
459           If you simply want to see the full path, just specify an empty
460           string: --fullpath-after=. This isn't a special case, merely a
461           logical consequence of the above rules.
462
463           Finally, you can use --fullpath-after multiple times. Any
464           appearance of it causes Valgrind to switch to producing full paths
465           and applying the above filtering rule. Each produced path is
466           compared against all the --fullpath-after-specified strings, in the
467           order specified. The first string to match causes the path to be
468           truncated as described above. If none match, the full path is
469           shown. This facilitates chopping off prefixes when the sources are
470           drawn from a number of unrelated directories.
471
472       --extra-debuginfo-path=<path> [default: undefined and unused]
473           By default Valgrind searches in several well-known paths for debug
474           objects, such as /usr/lib/debug/.
475
476           However, there may be scenarios where you may wish to put debug
477           objects at an arbitrary location, such as external storage when
478           running Valgrind on a mobile device with limited local storage.
479           Another example might be a situation where you do not have
480           permission to install debug object packages on the system where you
481           are running Valgrind.
482
483           In these scenarios, you may provide an absolute path as an extra,
484           final place for Valgrind to search for debug objects by specifying
485           --extra-debuginfo-path=/path/to/debug/objects. The given path will
486           be prepended to the absolute path name of the searched-for object.
487           For example, if Valgrind is looking for the debuginfo for
488           /w/x/y/zz.so and --extra-debuginfo-path=/a/b/c is specified, it
489           will look for a debug object at /a/b/c/w/x/y/zz.so.
490
491           This flag should only be specified once. If it is specified
492           multiple times, only the last instance is honoured.
493
494       --debuginfo-server=ipaddr:port [default: undefined and unused]
495           This is a new, experimental, feature introduced in version 3.9.0.
496
497           In some scenarios it may be convenient to read debuginfo from
498           objects stored on a different machine. With this flag, Valgrind
499           will query a debuginfo server running on ipaddr and listening on
500           port port, if it cannot find the debuginfo object in the local
501           filesystem.
502
503           The debuginfo server must accept TCP connections on port port. The
504           debuginfo server is contained in the source file
505           auxprogs/valgrind-di-server.c. It will only serve from the
506           directory it is started in.  port defaults to 1500 in both client
507           and server if not specified.
508
509           If Valgrind looks for the debuginfo for /w/x/y/zz.so by using the
510           debuginfo server, it will strip the pathname components and merely
511           request zz.so on the server. That in turn will look only in its
512           current working directory for a matching debuginfo object.
513
514           The debuginfo data is transmitted in small fragments (8 KB) as
515           requested by Valgrind. Each block is compressed using LZO to reduce
516           transmission time. The implementation has been tuned for best
517           performance over a single-stage 802.11g (WiFi) network link.
518
519           Note that checks for matching primary vs debug objects, using GNU
520           debuglink CRC scheme, are performed even when using the debuginfo
521           server. To disable such checking, you need to also specify
522           --allow-mismatched-debuginfo=yes.
523
524           By default the Valgrind build system will build valgrind-di-server
525           for the target platform, which is almost certainly not what you
526           want. So far we have been unable to find out how to get
527           automake/autoconf to build it for the build platform. If you want
528           to use it, you will have to recompile it by hand using the command
529           shown at the top of auxprogs/valgrind-di-server.c.
530
531       --allow-mismatched-debuginfo=no|yes [no]
532           When reading debuginfo from separate debuginfo objects, Valgrind
533           will by default check that the main and debuginfo objects match,
534           using the GNU debuglink mechanism. This guarantees that it does not
535           read debuginfo from out of date debuginfo objects, and also ensures
536           that Valgrind can't crash as a result of mismatches.
537
538           This check can be overridden using
539           --allow-mismatched-debuginfo=yes. This may be useful when the
540           debuginfo and main objects have not been split in the proper way.
541           Be careful when using this, though: it disables all consistency
542           checking, and Valgrind has been observed to crash when the main and
543           debuginfo objects don't match.
544
545       --suppressions=<filename> [default: $PREFIX/lib/valgrind/default.supp]
546           Specifies an extra file from which to read descriptions of errors
547           to suppress. You may use up to 100 extra suppression files.
548
549       --gen-suppressions=<yes|no|all> [default: no]
550           When set to yes, Valgrind will pause after every error shown and
551           print the line:
552
553                   ---- Print suppression ? --- [Return/N/n/Y/y/C/c] ----
554
555           Pressing Ret, or N Ret or n Ret, causes Valgrind continue execution
556           without printing a suppression for this error.
557
558           Pressing Y Ret or y Ret causes Valgrind to write a suppression for
559           this error. You can then cut and paste it into a suppression file
560           if you don't want to hear about the error in the future.
561
562           When set to all, Valgrind will print a suppression for every
563           reported error, without querying the user.
564
565           This option is particularly useful with C++ programs, as it prints
566           out the suppressions with mangled names, as required.
567
568           Note that the suppressions printed are as specific as possible. You
569           may want to common up similar ones, by adding wildcards to function
570           names, and by using frame-level wildcards. The wildcarding
571           facilities are powerful yet flexible, and with a bit of careful
572           editing, you may be able to suppress a whole family of related
573           errors with only a few suppressions.
574
575           Sometimes two different errors are suppressed by the same
576           suppression, in which case Valgrind will output the suppression
577           more than once, but you only need to have one copy in your
578           suppression file (but having more than one won't cause problems).
579           Also, the suppression name is given as <insert a suppression name
580           here>; the name doesn't really matter, it's only used with the -v
581           option which prints out all used suppression records.
582
583       --input-fd=<number> [default: 0, stdin]
584           When using --gen-suppressions=yes, Valgrind will stop so as to read
585           keyboard input from you when each error occurs. By default it reads
586           from the standard input (stdin), which is problematic for programs
587           which close stdin. This option allows you to specify an alternative
588           file descriptor from which to read input.
589
590       --dsymutil=no|yes [yes]
591           This option is only relevant when running Valgrind on Mac OS X.
592
593           Mac OS X uses a deferred debug information (debuginfo) linking
594           scheme. When object files containing debuginfo are linked into a
595           .dylib or an executable, the debuginfo is not copied into the final
596           file. Instead, the debuginfo must be linked manually by running
597           dsymutil, a system-provided utility, on the executable or .dylib.
598           The resulting combined debuginfo is placed in a directory alongside
599           the executable or .dylib, but with the extension .dSYM.
600
601           With --dsymutil=no, Valgrind will detect cases where the .dSYM
602           directory is either missing, or is present but does not appear to
603           match the associated executable or .dylib, most likely because it
604           is out of date. In these cases, Valgrind will print a warning
605           message but take no further action.
606
607           With --dsymutil=yes, Valgrind will, in such cases, automatically
608           run dsymutil as necessary to bring the debuginfo up to date. For
609           all practical purposes, if you always use --dsymutil=yes, then
610           there is never any need to run dsymutil manually or as part of your
611           applications's build system, since Valgrind will run it as
612           necessary.
613
614           Valgrind will not attempt to run dsymutil on any executable or
615           library in /usr/, /bin/, /sbin/, /opt/, /sw/, /System/, /Library/
616           or /Applications/ since dsymutil will always fail in such
617           situations. It fails both because the debuginfo for such
618           pre-installed system components is not available anywhere, and also
619           because it would require write privileges in those directories.
620
621           Be careful when using --dsymutil=yes, since it will cause
622           pre-existing .dSYM directories to be silently deleted and
623           re-created. Also note that dsymutil is quite slow, sometimes
624           excessively so.
625
626       --max-stackframe=<number> [default: 2000000]
627           The maximum size of a stack frame. If the stack pointer moves by
628           more than this amount then Valgrind will assume that the program is
629           switching to a different stack.
630
631           You may need to use this option if your program has large
632           stack-allocated arrays. Valgrind keeps track of your program's
633           stack pointer. If it changes by more than the threshold amount,
634           Valgrind assumes your program is switching to a different stack,
635           and Memcheck behaves differently than it would for a stack pointer
636           change smaller than the threshold. Usually this heuristic works
637           well. However, if your program allocates large structures on the
638           stack, this heuristic will be fooled, and Memcheck will
639           subsequently report large numbers of invalid stack accesses. This
640           option allows you to change the threshold to a different value.
641
642           You should only consider use of this option if Valgrind's debug
643           output directs you to do so. In that case it will tell you the new
644           threshold you should specify.
645
646           In general, allocating large structures on the stack is a bad idea,
647           because you can easily run out of stack space, especially on
648           systems with limited memory or which expect to support large
649           numbers of threads each with a small stack, and also because the
650           error checking performed by Memcheck is more effective for
651           heap-allocated data than for stack-allocated data. If you have to
652           use this option, you may wish to consider rewriting your code to
653           allocate on the heap rather than on the stack.
654
655       --main-stacksize=<number> [default: use current 'ulimit' value]
656           Specifies the size of the main thread's stack.
657
658           To simplify its memory management, Valgrind reserves all required
659           space for the main thread's stack at startup. That means it needs
660           to know the required stack size at startup.
661
662           By default, Valgrind uses the current "ulimit" value for the stack
663           size, or 16 MB, whichever is lower. In many cases this gives a
664           stack size in the range 8 to 16 MB, which almost never overflows
665           for most applications.
666
667           If you need a larger total stack size, use --main-stacksize to
668           specify it. Only set it as high as you need, since reserving far
669           more space than you need (that is, hundreds of megabytes more than
670           you need) constrains Valgrind's memory allocators and may reduce
671           the total amount of memory that Valgrind can use. This is only
672           really of significance on 32-bit machines.
673
674           On Linux, you may request a stack of size up to 2GB. Valgrind will
675           stop with a diagnostic message if the stack cannot be allocated.
676
677           --main-stacksize only affects the stack size for the program's
678           initial thread. It has no bearing on the size of thread stacks, as
679           Valgrind does not allocate those.
680
681           You may need to use both --main-stacksize and --max-stackframe
682           together. It is important to understand that --main-stacksize sets
683           the maximum total stack size, whilst --max-stackframe specifies the
684           largest size of any one stack frame. You will have to work out the
685           --main-stacksize value for yourself (usually, if your applications
686           segfaults). But Valgrind will tell you the needed --max-stackframe
687           size, if necessary.
688
689           As discussed further in the description of --max-stackframe, a
690           requirement for a large stack is a sign of potential portability
691           problems. You are best advised to place all large data in
692           heap-allocated memory.
693
694       --max-threads=<number> [default: 500]
695           By default, Valgrind can handle to up to 500 threads. Occasionally,
696           that number is too small. Use this option to provide a different
697           limit. E.g.  --max-threads=3000.
698
700       For tools that use their own version of malloc (e.g. Memcheck, Massif,
701       Helgrind, DRD), the following options apply.
702
703       --alignment=<number> [default: 8 or 16, depending on the platform]
704           By default Valgrind's malloc, realloc, etc, return a block whose
705           starting address is 8-byte aligned or 16-byte aligned (the value
706           depends on the platform and matches the platform default). This
707           option allows you to specify a different alignment. The supplied
708           value must be greater than or equal to the default, less than or
709           equal to 4096, and must be a power of two.
710
711       --redzone-size=<number> [default: depends on the tool]
712           Valgrind's malloc, realloc, etc, add padding blocks before and
713           after each heap block allocated by the program being run. Such
714           padding blocks are called redzones. The default value for the
715           redzone size depends on the tool. For example, Memcheck adds and
716           protects a minimum of 16 bytes before and after each block
717           allocated by the client. This allows it to detect block underruns
718           or overruns of up to 16 bytes.
719
720           Increasing the redzone size makes it possible to detect overruns of
721           larger distances, but increases the amount of memory used by
722           Valgrind. Decreasing the redzone size will reduce the memory needed
723           by Valgrind but also reduces the chances of detecting
724           over/underruns, so is not recommended.
725
726       --xtree-memory=none|allocs|full [none]
727           Tools replacing Valgrind's malloc, realloc, etc, can optionally
728           produce an execution tree detailing which piece of code is
729           responsible for heap memory usage. See ???  for a detailed
730           explanation about execution trees.
731
732           When set to none, no memory execution tree is produced.
733
734           When set to allocs, the memory execution tree gives the current
735           number of allocated bytes and the current number of allocated
736           blocks.
737
738           When set to full, the memory execution tree gives 6 different
739           measurements : the current number of allocated bytes and blocks
740           (same values as for allocs), the total number of allocated bytes
741           and blocks, the total number of freed bytes and blocks.
742
743           Note that the overhead in cpu and memory to produce an xtree
744           depends on the tool. The overhead in cpu is small for the value
745           allocs, as the information needed to produce this report is
746           maintained in any case by the tool. For massif and helgrind,
747           specifying full implies to capture a stack trace for each free
748           operation, while normally these tools only capture an allocation
749           stack trace. For Memcheck, the cpu overhead for the value full is
750           small, as this can only be used in combination with
751           --keep-stacktraces=alloc-and-free or
752           --keep-stacktraces=alloc-then-free, which already records a stack
753           trace for each free operation. The memory overhead varies between 5
754           and 10 words per unique stacktrace in the xtree, plus the memory
755           needed to record the stack trace for the free operations, if needed
756           specifically for the xtree.
757
758       --xtree-memory-file=<filename> [default: xtmemory.kcg.%p]
759           Specifies that Valgrind should produce the xtree memory report in
760           the specified file. Any %p or %q sequences appearing in the
761           filename are expanded in exactly the same way as they are for
762           --log-file. See the description of --log-file for details.
763
764           If the filename contains the extension .ms, then the produced file
765           format will be a massif output file format. If the filename
766           contains the extension .kcg or no extension is provided or
767           recognised, then the produced file format will be a callgrind
768           output format.
769
770           See ???  for a detailed explanation about execution trees formats.
771

UNCOMMON OPTIONS

773       These options apply to all tools, as they affect certain obscure
774       workings of the Valgrind core. Most people won't need to use them.
775
776       --smc-check=<none|stack|all|all-non-file> [default: all-non-file for
777       x86/amd64/s390x, stack for other archs]
778           This option controls Valgrind's detection of self-modifying code.
779           If no checking is done, when a program executes some code, then
780           overwrites it with new code, and executes the new code, Valgrind
781           will continue to execute the translations it made for the old code.
782           This will likely lead to incorrect behaviour and/or crashes.
783
784           For "modern" architectures -- anything that's not x86, amd64 or
785           s390x -- the default is stack. This is because a correct program
786           must take explicit action to reestablish D-I cache coherence
787           following code modification. Valgrind observes and honours such
788           actions, with the result that self-modifying code is transparently
789           handled with zero extra cost.
790
791           For x86, amd64 and s390x, the program is not required to notify the
792           hardware of required D-I coherence syncing. Hence the default is
793           all-non-file, which covers the normal case of generating code into
794           an anonymous (non-file-backed) mmap'd area.
795
796           The meanings of the four available settings are as follows. No
797           detection (none), detect self-modifying code on the stack (which is
798           used by GCC to implement nested functions) (stack), detect
799           self-modifying code everywhere (all), and detect self-modifying
800           code everywhere except in file-backed mappings (all-non-file).
801
802           Running with all will slow Valgrind down noticeably. Running with
803           none will rarely speed things up, since very little code gets
804           dynamically generated in most programs. The
805           VALGRIND_DISCARD_TRANSLATIONS client request is an alternative to
806           --smc-check=all and --smc-check=all-non-file that requires more
807           programmer effort but allows Valgrind to run your program faster,
808           by telling it precisely when translations need to be re-made.
809
810           --smc-check=all-non-file provides a cheaper but more limited
811           version of --smc-check=all. It adds checks to any translations that
812           do not originate from file-backed memory mappings. Typical
813           applications that generate code, for example JITs in web browsers,
814           generate code into anonymous mmaped areas, whereas the "fixed" code
815           of the browser always lives in file-backed mappings.
816           --smc-check=all-non-file takes advantage of this observation,
817           limiting the overhead of checking to code which is likely to be JIT
818           generated.
819
820       --read-inline-info=<yes|no> [default: see below]
821           When enabled, Valgrind will read information about inlined function
822           calls from DWARF3 debug info. This slows Valgrind startup and makes
823           it use more memory (typically for each inlined piece of code, 6
824           words and space for the function name), but it results in more
825           descriptive stacktraces. For the 3.10.0 release, this functionality
826           is enabled by default only for Linux, Android and Solaris targets
827           and only for the tools Memcheck, Helgrind and DRD. Here is an
828           example of some stacktraces with --read-inline-info=no:
829
830               ==15380== Conditional jump or move depends on uninitialised value(s)
831               ==15380==    at 0x80484EA: main (inlinfo.c:6)
832               ==15380==
833               ==15380== Conditional jump or move depends on uninitialised value(s)
834               ==15380==    at 0x8048550: fun_noninline (inlinfo.c:6)
835               ==15380==    by 0x804850E: main (inlinfo.c:34)
836               ==15380==
837               ==15380== Conditional jump or move depends on uninitialised value(s)
838               ==15380==    at 0x8048520: main (inlinfo.c:6)
839
840           And here are the same errors with --read-inline-info=yes:
841
842               ==15377== Conditional jump or move depends on uninitialised value(s)
843               ==15377==    at 0x80484EA: fun_d (inlinfo.c:6)
844               ==15377==    by 0x80484EA: fun_c (inlinfo.c:14)
845               ==15377==    by 0x80484EA: fun_b (inlinfo.c:20)
846               ==15377==    by 0x80484EA: fun_a (inlinfo.c:26)
847               ==15377==    by 0x80484EA: main (inlinfo.c:33)
848               ==15377==
849               ==15377== Conditional jump or move depends on uninitialised value(s)
850               ==15377==    at 0x8048550: fun_d (inlinfo.c:6)
851               ==15377==    by 0x8048550: fun_noninline (inlinfo.c:41)
852               ==15377==    by 0x804850E: main (inlinfo.c:34)
853               ==15377==
854               ==15377== Conditional jump or move depends on uninitialised value(s)
855               ==15377==    at 0x8048520: fun_d (inlinfo.c:6)
856               ==15377==    by 0x8048520: main (inlinfo.c:35)
857
858       --read-var-info=<yes|no> [default: no]
859           When enabled, Valgrind will read information about variable types
860           and locations from DWARF3 debug info. This slows Valgrind startup
861           significantly and makes it use significantly more memory, but for
862           the tools that can take advantage of it (Memcheck, Helgrind, DRD)
863           it can result in more precise error messages. For example, here are
864           some standard errors issued by Memcheck:
865
866               ==15363== Uninitialised byte(s) found during client check request
867               ==15363==    at 0x80484A9: croak (varinfo1.c:28)
868               ==15363==    by 0x8048544: main (varinfo1.c:55)
869               ==15363==  Address 0x80497f7 is 7 bytes inside data symbol "global_i2"
870               ==15363==
871               ==15363== Uninitialised byte(s) found during client check request
872               ==15363==    at 0x80484A9: croak (varinfo1.c:28)
873               ==15363==    by 0x8048550: main (varinfo1.c:56)
874               ==15363==  Address 0xbea0d0cc is on thread 1's stack
875               ==15363==  in frame #1, created by main (varinfo1.c:45)
876
877           And here are the same errors with --read-var-info=yes:
878
879               ==15370== Uninitialised byte(s) found during client check request
880               ==15370==    at 0x80484A9: croak (varinfo1.c:28)
881               ==15370==    by 0x8048544: main (varinfo1.c:55)
882               ==15370==  Location 0x80497f7 is 0 bytes inside global_i2[7],
883               ==15370==  a global variable declared at varinfo1.c:41
884               ==15370==
885               ==15370== Uninitialised byte(s) found during client check request
886               ==15370==    at 0x80484A9: croak (varinfo1.c:28)
887               ==15370==    by 0x8048550: main (varinfo1.c:56)
888               ==15370==  Location 0xbeb4a0cc is 0 bytes inside local var "local"
889               ==15370==  declared at varinfo1.c:46, in frame #1 of thread 1
890
891       --vgdb-poll=<number> [default: 5000]
892           As part of its main loop, the Valgrind scheduler will poll to check
893           if some activity (such as an external command or some input from a
894           gdb) has to be handled by gdbserver. This activity poll will be
895           done after having run the given number of basic blocks (or slightly
896           more than the given number of basic blocks). This poll is quite
897           cheap so the default value is set relatively low. You might further
898           decrease this value if vgdb cannot use ptrace system call to
899           interrupt Valgrind if all threads are (most of the time) blocked in
900           a system call.
901
902       --vgdb-shadow-registers=no|yes [default: no]
903           When activated, gdbserver will expose the Valgrind shadow registers
904           to GDB. With this, the value of the Valgrind shadow registers can
905           be examined or changed using GDB. Exposing shadow registers only
906           works with GDB version 7.1 or later.
907
908       --vgdb-prefix=<prefix> [default: /tmp/vgdb-pipe]
909           To communicate with gdb/vgdb, the Valgrind gdbserver creates 3
910           files (2 named FIFOs and a mmap shared memory file). The prefix
911           option controls the directory and prefix for the creation of these
912           files.
913
914       --run-libc-freeres=<yes|no> [default: yes]
915           This option is only relevant when running Valgrind on Linux.
916
917           The GNU C library (libc.so), which is used by all programs, may
918           allocate memory for its own uses. Usually it doesn't bother to free
919           that memory when the program ends—there would be no point, since
920           the Linux kernel reclaims all process resources when a process
921           exits anyway, so it would just slow things down.
922
923           The glibc authors realised that this behaviour causes leak
924           checkers, such as Valgrind, to falsely report leaks in glibc, when
925           a leak check is done at exit. In order to avoid this, they provided
926           a routine called __libc_freeres specifically to make glibc release
927           all memory it has allocated. Memcheck therefore tries to run
928           __libc_freeres at exit.
929
930           Unfortunately, in some very old versions of glibc, __libc_freeres
931           is sufficiently buggy to cause segmentation faults. This was
932           particularly noticeable on Red Hat 7.1. So this option is provided
933           in order to inhibit the run of __libc_freeres. If your program
934           seems to run fine on Valgrind, but segfaults at exit, you may find
935           that --run-libc-freeres=no fixes that, although at the cost of
936           possibly falsely reporting space leaks in libc.so.
937
938       --run-cxx-freeres=<yes|no> [default: yes]
939           This option is only relevant when running Valgrind on Linux or
940           Solaris C++ programs.
941
942           The GNU Standard C++ library (libstdc++.so), which is used by all
943           C++ programs compiled with g++, may allocate memory for its own
944           uses. Usually it doesn't bother to free that memory when the
945           program ends—there would be no point, since the kernel reclaims all
946           process resources when a process exits anyway, so it would just
947           slow things down.
948
949           The gcc authors realised that this behaviour causes leak checkers,
950           such as Valgrind, to falsely report leaks in libstdc++, when a leak
951           check is done at exit. In order to avoid this, they provided a
952           routine called __gnu_cxx::__freeres specifically to make libstdc++
953           release all memory it has allocated. Memcheck therefore tries to
954           run __gnu_cxx::__freeres at exit.
955
956           For the sake of flexibility and unforeseen problems with
957           __gnu_cxx::__freeres, option --run-cxx-freeres=no exists, although
958           at the cost of possibly falsely reporting space leaks in
959           libstdc++.so.
960
961       --sim-hints=hint1,hint2,...
962           Pass miscellaneous hints to Valgrind which slightly modify the
963           simulated behaviour in nonstandard or dangerous ways, possibly to
964           help the simulation of strange features. By default no hints are
965           enabled. Use with caution! Currently known hints are:
966
967           ·   lax-ioctls: Be very lax about ioctl handling; the only
968               assumption is that the size is correct. Doesn't require the
969               full buffer to be initialised when writing. Without this, using
970               some device drivers with a large number of strange ioctl
971               commands becomes very tiresome.
972
973           ·   fuse-compatible: Enable special handling for certain system
974               calls that may block in a FUSE file-system. This may be
975               necessary when running Valgrind on a multi-threaded program
976               that uses one thread to manage a FUSE file-system and another
977               thread to access that file-system.
978
979           ·   enable-outer: Enable some special magic needed when the program
980               being run is itself Valgrind.
981
982           ·   no-inner-prefix: Disable printing a prefix > in front of each
983               stdout or stderr output line in an inner Valgrind being run by
984               an outer Valgrind. This is useful when running Valgrind
985               regression tests in an outer/inner setup. Note that the prefix
986               > will always be printed in front of the inner debug logging
987               lines.
988
989           ·   no-nptl-pthread-stackcache: This hint is only relevant when
990               running Valgrind on Linux; it is ignored on Solaris and Mac OS
991               X.
992
993               The GNU glibc pthread library (libpthread.so), which is used by
994               pthread programs, maintains a cache of pthread stacks. When a
995               pthread terminates, the memory used for the pthread stack and
996               some thread local storage related data structure are not always
997               directly released. This memory is kept in a cache (up to a
998               certain size), and is re-used if a new thread is started.
999
1000               This cache causes the helgrind tool to report some false
1001               positive race condition errors on this cached memory, as
1002               helgrind does not understand the internal glibc cache
1003               synchronisation primitives. So, when using helgrind, disabling
1004               the cache helps to avoid false positive race conditions, in
1005               particular when using thread local storage variables (e.g.
1006               variables using the __thread qualifier).
1007
1008               When using the memcheck tool, disabling the cache ensures the
1009               memory used by glibc to handle __thread variables is directly
1010               released when a thread terminates.
1011
1012               Note: Valgrind disables the cache using some internal knowledge
1013               of the glibc stack cache implementation and by examining the
1014               debug information of the pthread library. This technique is
1015               thus somewhat fragile and might not work for all glibc
1016               versions. This has been successfully tested with various glibc
1017               versions (e.g. 2.11, 2.16, 2.18) on various platforms.
1018
1019           ·   lax-doors: (Solaris only) Be very lax about door syscall
1020               handling over unrecognised door file descriptors. Does not
1021               require that full buffer is initialised when writing. Without
1022               this, programs using libdoor(3LIB) functionality with
1023               completely proprietary semantics may report large number of
1024               false positives.
1025
1026           ·   fallback-llsc: (MIPS and ARM64 only): Enables an alternative
1027               implementation of Load-Linked (LL) and Store-Conditional (SC)
1028               instructions. The standard implementation gives more correct
1029               behaviour, but can cause indefinite looping on certain
1030               processor implementations that are intolerant of extra memory
1031               references between LL and SC. So far this is known only to
1032               happen on Cavium 3 cores. You should not need to use this flag,
1033               since the relevant cores are detected at startup and the
1034               alternative implementation is automatically enabled if
1035               necessary. There is no equivalent anti-flag: you cannot
1036               force-disable the alternative implementation, if it is
1037               automatically enabled. The underlying problem exists because
1038               the "standard" implementation of LL and SC is done by copying
1039               through LL and SC instructions into the instrumented code.
1040               However, tools may insert extra instrumentation memory
1041               references in between the LL and SC instructions. These memory
1042               references are not present in the original uninstrumented code,
1043               and their presence in the instrumented code can cause the SC
1044               instructions to persistently fail, leading to indefinite
1045               looping in LL-SC blocks. The alternative implementation gives
1046               correct behaviour of LL and SC instructions between threads in
1047               a process, up to and including the ABA scenario. It also gives
1048               correct behaviour between a Valgrinded thread and a
1049               non-Valgrinded thread running in a different process, that
1050               communicate via shared memory, but only up to and including
1051               correct CAS behaviour -- in this case the ABA scenario may not
1052               be correctly handled.
1053
1054       --fair-sched=<no|yes|try> [default: no]
1055           The --fair-sched option controls the locking mechanism used by
1056           Valgrind to serialise thread execution. The locking mechanism
1057           controls the way the threads are scheduled, and different settings
1058           give different trade-offs between fairness and performance. For
1059           more details about the Valgrind thread serialisation scheme and its
1060           impact on performance and thread scheduling, see Scheduling and
1061           Multi-Thread Performance.
1062
1063           ·   The value --fair-sched=yes activates a fair scheduler. In
1064               short, if multiple threads are ready to run, the threads will
1065               be scheduled in a round robin fashion. This mechanism is not
1066               available on all platforms or Linux versions. If not available,
1067               using --fair-sched=yes will cause Valgrind to terminate with an
1068               error.
1069
1070               You may find this setting improves overall responsiveness if
1071               you are running an interactive multithreaded program, for
1072               example a web browser, on Valgrind.
1073
1074           ·   The value --fair-sched=try activates fair scheduling if
1075               available on the platform. Otherwise, it will automatically
1076               fall back to --fair-sched=no.
1077
1078           ·   The value --fair-sched=no activates a scheduler which does not
1079               guarantee fairness between threads ready to run, but which in
1080               general gives the highest performance.
1081
1082       --kernel-variant=variant1,variant2,...
1083           Handle system calls and ioctls arising from minor variants of the
1084           default kernel for this platform. This is useful for running on
1085           hacked kernels or with kernel modules which support nonstandard
1086           ioctls, for example. Use with caution. If you don't understand what
1087           this option does then you almost certainly don't need it. Currently
1088           known variants are:
1089
1090           ·   bproc: support the sys_broc system call on x86. This is for
1091               running on BProc, which is a minor variant of standard Linux
1092               which is sometimes used for building clusters.
1093
1094           ·   android-no-hw-tls: some versions of the Android emulator for
1095               ARM do not provide a hardware TLS (thread-local state)
1096               register, and Valgrind crashes at startup. Use this variant to
1097               select software support for TLS.
1098
1099           ·   android-gpu-sgx5xx: use this to support handling of proprietary
1100               ioctls for the PowerVR SGX 5XX series of GPUs on Android
1101               devices. Failure to select this does not cause stability
1102               problems, but may cause Memcheck to report false errors after
1103               the program performs GPU-specific ioctls.
1104
1105           ·   android-gpu-adreno3xx: similarly, use this to support handling
1106               of proprietary ioctls for the Qualcomm Adreno 3XX series of
1107               GPUs on Android devices.
1108
1109       --merge-recursive-frames=<number> [default: 0]
1110           Some recursive algorithms, for example balanced binary tree
1111           implementations, create many different stack traces, each
1112           containing cycles of calls. A cycle is defined as two identical
1113           program counter values separated by zero or more other program
1114           counter values. Valgrind may then use a lot of memory to store all
1115           these stack traces. This is a poor use of memory considering that
1116           such stack traces contain repeated uninteresting recursive calls
1117           instead of more interesting information such as the function that
1118           has initiated the recursive call.
1119
1120           The option --merge-recursive-frames=<number> instructs Valgrind to
1121           detect and merge recursive call cycles having a size of up to
1122           <number> frames. When such a cycle is detected, Valgrind records
1123           the cycle in the stack trace as a unique program counter.
1124
1125           The value 0 (the default) causes no recursive call merging. A value
1126           of 1 will cause stack traces of simple recursive algorithms (for
1127           example, a factorial implementation) to be collapsed. A value of 2
1128           will usually be needed to collapse stack traces produced by
1129           recursive algorithms such as binary trees, quick sort, etc. Higher
1130           values might be needed for more complex recursive algorithms.
1131
1132           Note: recursive calls are detected by analysis of program counter
1133           values. They are not detected by looking at function names.
1134
1135       --num-transtab-sectors=<number> [default: 6 for Android platforms, 16
1136       for all others]
1137           Valgrind translates and instruments your program's machine code in
1138           small fragments (basic blocks). The translations are stored in a
1139           translation cache that is divided into a number of sections
1140           (sectors). If the cache is full, the sector containing the oldest
1141           translations is emptied and reused. If these old translations are
1142           needed again, Valgrind must re-translate and re-instrument the
1143           corresponding machine code, which is expensive. If the "executed
1144           instructions" working set of a program is big, increasing the
1145           number of sectors may improve performance by reducing the number of
1146           re-translations needed. Sectors are allocated on demand. Once
1147           allocated, a sector can never be freed, and occupies considerable
1148           space, depending on the tool and the value of
1149           --avg-transtab-entry-size (about 40 MB per sector for Memcheck).
1150           Use the option --stats=yes to obtain precise information about the
1151           memory used by a sector and the allocation and recycling of
1152           sectors.
1153
1154       --avg-transtab-entry-size=<number> [default: 0, meaning use tool
1155       provided default]
1156           Average size of translated basic block. This average size is used
1157           to dimension the size of a sector. Each tool provides a default
1158           value to be used. If this default value is too small, the
1159           translation sectors will become full too quickly. If this default
1160           value is too big, a significant part of the translation sector
1161           memory will be unused. Note that the average size of a basic block
1162           translation depends on the tool, and might depend on tool options.
1163           For example, the memcheck option --track-origins=yes increases the
1164           size of the basic block translations. Use --avg-transtab-entry-size
1165           to tune the size of the sectors, either to gain memory or to avoid
1166           too many retranslations.
1167
1168       --aspace-minaddr=<address> [default: depends on the platform]
1169           To avoid potential conflicts with some system libraries, Valgrind
1170           does not use the address space below --aspace-minaddr value,
1171           keeping it reserved in case a library specifically requests memory
1172           in this region. So, some "pessimistic" value is guessed by Valgrind
1173           depending on the platform. On linux, by default, Valgrind avoids
1174           using the first 64MB even if typically there is no conflict in this
1175           complete zone. You can use the option --aspace-minaddr to have your
1176           memory hungry application benefitting from more of this lower
1177           memory. On the other hand, if you encounter a conflict, increasing
1178           aspace-minaddr value might solve it. Conflicts will typically
1179           manifest themselves with mmap failures in the low range of the
1180           address space. The provided address must be page aligned and must
1181           be equal or bigger to 0x1000 (4KB). To find the default value on
1182           your platform, do something such as valgrind -d -d date 2>&1 | grep
1183           -i minaddr. Values lower than 0x10000 (64KB) are known to create
1184           problems on some distributions.
1185
1186       --valgrind-stacksize=<number> [default: 1MB]
1187           For each thread, Valgrind needs its own 'private' stack. The
1188           default size for these stacks is largely dimensioned, and so should
1189           be sufficient in most cases. In case the size is too small,
1190           Valgrind will segfault. Before segfaulting, a warning might be
1191           produced by Valgrind when approaching the limit.
1192
1193           Use the option --valgrind-stacksize if such an (unlikely) warning
1194           is produced, or Valgrind dies due to a segmentation violation. Such
1195           segmentation violations have been seen when demangling huge C++
1196           symbols.
1197
1198           If your application uses many threads and needs a lot of memory,
1199           you can gain some memory by reducing the size of these Valgrind
1200           stacks using the option --valgrind-stacksize.
1201
1202       --show-emwarns=<yes|no> [default: no]
1203           When enabled, Valgrind will emit warnings about its CPU emulation
1204           in certain cases. These are usually not interesting.
1205
1206       --require-text-symbol=:sonamepatt:fnnamepatt
1207           When a shared object whose soname matches sonamepatt is loaded into
1208           the process, examine all the text symbols it exports. If none of
1209           those match fnnamepatt, print an error message and abandon the run.
1210           This makes it possible to ensure that the run does not continue
1211           unless a given shared object contains a particular function name.
1212
1213           Both sonamepatt and fnnamepatt can be written using the usual ?
1214           and * wildcards. For example: ":*libc.so*:foo?bar". You may use
1215           characters other than a colon to separate the two patterns. It is
1216           only important that the first character and the separator character
1217           are the same. For example, the above example could also be written
1218           "Q*libc.so*Qfoo?bar". Multiple
1219            --require-text-symbol flags are allowed, in which case shared
1220           objects that are loaded into the process will be checked against
1221           all of them.
1222
1223           The purpose of this is to support reliable usage of marked-up
1224           libraries. For example, suppose we have a version of GCC's
1225           libgomp.so which has been marked up with annotations to support
1226           Helgrind. It is only too easy and confusing to load the wrong,
1227           un-annotated libgomp.so into the application. So the idea is: add a
1228           text symbol in the marked-up library, for example
1229           annotated_for_helgrind_3_6, and then give the flag
1230           --require-text-symbol=:*libgomp*so*:annotated_for_helgrind_3_6 so
1231           that when libgomp.so is loaded, Valgrind scans its symbol table,
1232           and if the symbol isn't present the run is aborted, rather than
1233           continuing silently with the un-marked-up library. Note that you
1234           should put the entire flag in quotes to stop shells expanding up
1235           the * and ?  wildcards.
1236
1237       --soname-synonyms=syn1=pattern1,syn2=pattern2,...
1238           When a shared library is loaded, Valgrind checks for functions in
1239           the library that must be replaced or wrapped. For example, Memcheck
1240           replaces some string and memory functions (strchr, strlen, strcpy,
1241           memchr, memcpy, memmove, etc.) with its own versions. Such
1242           replacements are normally done only in shared libraries whose
1243           soname matches a predefined soname pattern (e.g.  libc.so* on
1244           linux). By default, no replacement is done for a statically linked
1245           binary or for alternative libraries, except for the allocation
1246           functions (malloc, free, calloc, memalign, realloc, operator new,
1247           operator delete, etc.) Such allocation functions are intercepted by
1248           default in any shared library or in the executable if they are
1249           exported as global symbols. This means that if a replacement
1250           allocation library such as tcmalloc is found, its functions are
1251           also intercepted by default. In some cases, the replacements allow
1252           --soname-synonyms to specify one additional synonym pattern, giving
1253           flexibility in the replacement. Or to prevent interception of all
1254           public allocation symbols.
1255
1256           Currently, this flexibility is only allowed for the malloc related
1257           functions, using the synonym somalloc. This synonym is usable for
1258           all tools doing standard replacement of malloc related functions
1259           (e.g. memcheck, massif, drd, helgrind, exp-dhat, exp-sgcheck).
1260
1261           ·   Alternate malloc library: to replace the malloc related
1262               functions in a specific alternate library with soname
1263               mymalloclib.so (and not in any others), give the option
1264               --soname-synonyms=somalloc=mymalloclib.so. A pattern can be
1265               used to match multiple libraries sonames. For example,
1266               --soname-synonyms=somalloc=*tcmalloc* will match the soname of
1267               all variants of the tcmalloc library (native, debug, profiled,
1268               ... tcmalloc variants).
1269
1270               Note: the soname of a elf shared library can be retrieved using
1271               the readelf utility.
1272
1273           ·   Replacements in a statically linked library are done by using
1274               the NONE pattern. For example, if you link with libtcmalloc.a,
1275               and only want to intercept the malloc related functions in the
1276               executable (and standard libraries) themselves, but not any
1277               other shared libraries, you can give the option
1278               --soname-synonyms=somalloc=NONE. Note that a NONE pattern will
1279               match the main executable and any shared library having no
1280               soname.
1281
1282           ·   To run a "default" Firefox build for Linux, in which JEMalloc
1283               is linked in to the main executable, use
1284               --soname-synonyms=somalloc=NONE.
1285
1286           ·   To only intercept allocation symbols in the default system
1287               libraries, but not in any other shared library or the
1288               executable defining public malloc or operator new related
1289               functions use a non-existing library name like
1290               --soname-synonyms=somalloc=nouserintercepts (where
1291               nouserintercepts can be any non-existing library name).
1292
1293           ·   Shared library of the dynamic (runtime) linker is excluded from
1294               searching for global public symbols, such as those for the
1295               malloc related functions (identified by somalloc synonym).
1296
1297       --progress-interval=<number> [default: 0, meaning 'disabled']
1298           This is an enhancement to Valgrind's debugging output. It is
1299           unlikely to be of interest to end users.
1300
1301           When number is set to a non-zero value, Valgrind will print a
1302           one-line progress summary every number seconds. Valid settings for
1303           number are between 0 and 3600 inclusive. Here's some example output
1304           with number set to 10:
1305
1306               PROGRESS: U 110s, W 113s, 97.3% CPU, EvC 414.79M, TIn 616.7k, TOut 0.5k, #thr 67
1307               PROGRESS: U 120s, W 124s, 96.8% CPU, EvC 505.27M, TIn 636.6k, TOut 3.0k, #thr 64
1308               PROGRESS: U 130s, W 134s, 97.0% CPU, EvC 574.90M, TIn 657.5k, TOut 3.0k, #thr 63
1309
1310           Each line shows:
1311
1312           ·   U: total user time.RE
1313
1314               ·   W: total wallclock time.RE
1315
1316                   ·   CPU: overall average cpu use.RE
1317
1318                       ·   EvC: number of event checks.  An event
1319                                    check is a backwards branch in the
1320                           simulated program, so this is a
1321                                    measure of forward progress of the
1322                           program.RE
1323
1324                           ·   TIn: number of code blocks instrumented
1325                                         by the JIT.RE
1326
1327                               ·   TOut: number of instrumented code
1328                                             blocks that have been thrown
1329                                   away.RE
1330
1331                                   ·   #thr: number of threads in the
1332                                               program.RE
1333
1334                                       From the progress of these, it is
1335                                       possible to observe:
1336
1337                                       ·   when the program is compute bound
1338                                           (TIn
1339                                                     rises slowly, EvC rises
1340                                           rapidly).RE
1341
1342                                           ·   when the program is in a
1343                                               spinloop
1344                                                         (TIn/TOut
1345                                                         fixed, EvC rises
1346                                               rapidly).RE
1347
1348                                               ·   when the program is
1349                                                   JIT-bound (TIn
1350                                                             rises rapidly).RE
1351
1352                                                   ·   when the program is
1353                                                       rapidly discarding code
1354                                                                 (TOut rises
1355                                                       rapidly).RE
1356
1357                                                       ·   when the program is
1358                                                           about to achieve
1359                                                           some expected state
1360                                                                     (EvC
1361                                                           arrives at some
1362                                                           value you
1363                                                                     expect).RE
1364
1365                                                           ·    when the
1366                                                               program is
1367                                                               idling (U rises
1368                                                                         more
1369                                                               slowly than
1370                                                               W).RE
1371
1372

DEBUGGING VALGRIND OPTIONS

1374       There are also some options for debugging Valgrind itself. You
1375       shouldn't need to use them in the normal run of things. If you wish to
1376       see the list, use the --help-debug option.
1377

MEMCHECK OPTIONS

1379       --leak-check=<no|summary|yes|full> [default: summary]
1380           When enabled, search for memory leaks when the client program
1381           finishes. If set to summary, it says how many leaks occurred. If
1382           set to full or yes, each individual leak will be shown in detail
1383           and/or counted as an error, as specified by the options
1384           --show-leak-kinds and --errors-for-leak-kinds.
1385
1386       --leak-resolution=<low|med|high> [default: high]
1387           When doing leak checking, determines how willing Memcheck is to
1388           consider different backtraces to be the same for the purposes of
1389           merging multiple leaks into a single leak report. When set to low,
1390           only the first two entries need match. When med, four entries have
1391           to match. When high, all entries need to match.
1392
1393           For hardcore leak debugging, you probably want to use
1394           --leak-resolution=high together with --num-callers=40 or some such
1395           large number.
1396
1397           Note that the --leak-resolution setting does not affect Memcheck's
1398           ability to find leaks. It only changes how the results are
1399           presented.
1400
1401       --show-leak-kinds=<set> [default: definite,possible]
1402           Specifies the leak kinds to show in a full leak search, in one of
1403           the following ways:
1404
1405           ·   a comma separated list of one or more of definite indirect
1406               possible reachable.
1407
1408           ·   all to specify the complete set (all leak kinds). It is
1409               equivalent to
1410               --show-leak-kinds=definite,indirect,possible,reachable.
1411
1412           ·   none for the empty set.
1413
1414       --errors-for-leak-kinds=<set> [default: definite,possible]
1415           Specifies the leak kinds to count as errors in a full leak search.
1416           The <set> is specified similarly to --show-leak-kinds
1417
1418       --leak-check-heuristics=<set> [default: all]
1419           Specifies the set of leak check heuristics to be used during leak
1420           searches. The heuristics control which interior pointers to a block
1421           cause it to be considered as reachable. The heuristic set is
1422           specified in one of the following ways:
1423
1424           ·   a comma separated list of one or more of stdstring length64
1425               newarray multipleinheritance.
1426
1427           ·   all to activate the complete set of heuristics. It is
1428               equivalent to
1429               --leak-check-heuristics=stdstring,length64,newarray,multipleinheritance.
1430
1431           ·   none for the empty set.
1432
1433           Note that these heuristics are dependent on the layout of the
1434           objects produced by the C++ compiler. They have been tested with
1435           some gcc versions (e.g. 4.4 and 4.7). They might not work properly
1436           with other C++ compilers.
1437
1438       --show-reachable=<yes|no> , --show-possibly-lost=<yes|no>
1439           These options provide an alternative way to specify the leak kinds
1440           to show:
1441
1442           ·   --show-reachable=no --show-possibly-lost=yes is equivalent to
1443               --show-leak-kinds=definite,possible.
1444
1445           ·   --show-reachable=no --show-possibly-lost=no is equivalent to
1446               --show-leak-kinds=definite.
1447
1448           ·   --show-reachable=yes is equivalent to --show-leak-kinds=all.
1449
1450           Note that --show-possibly-lost=no has no effect if
1451           --show-reachable=yes is specified.
1452
1453       --xtree-leak=<no|yes> [no]
1454           If set to yes, the results for the leak search done at exit will be
1455           output in a 'Callgrind Format' execution tree file. Note that this
1456           automatically sets the option --leak-check=full. The produced file
1457           will contain the following events:
1458
1459           ·   RB : Reachable Bytes
1460
1461           ·   PB : Possibly lost Bytes
1462
1463           ·   IB : Indirectly lost Bytes
1464
1465           ·   DB : Definitely lost Bytes (direct plus indirect)
1466
1467           ·   DIB : Definitely Indirectly lost Bytes (subset of DB)
1468
1469           ·   RBk : reachable Blocks
1470
1471           ·   PBk : Possibly lost Blocks
1472
1473           ·   IBk : Indirectly lost Blocks
1474
1475           ·   DBk : Definitely lost Blocks
1476
1477           The increase or decrease for all events above will also be output
1478           in the file to provide the delta (increase or decrease) between 2
1479           successive leak searches. For example, iRB is the increase of the
1480           RB event, dPBk is the decrease of PBk event. The values for the
1481           increase and decrease events will be zero for the first leak search
1482           done.
1483
1484           See ???  for a detailed explanation about execution trees.
1485
1486       --xtree-leak-file=<filename> [default: xtleak.kcg.%p]
1487           Specifies that Valgrind should produce the xtree leak report in the
1488           specified file. Any %p, %q or %n sequences appearing in the
1489           filename are expanded in exactly the same way as they are for
1490           --log-file. See the description of --log-file for details.
1491
1492           See ???  for a detailed explanation about execution trees formats.
1493
1494       --undef-value-errors=<yes|no> [default: yes]
1495           Controls whether Memcheck reports uses of undefined value errors.
1496           Set this to no if you don't want to see undefined value errors. It
1497           also has the side effect of speeding up Memcheck somewhat.
1498           AddrCheck (removed in Valgrind 3.1.0) functioned like Memcheck with
1499           --undef-value-errors=no.
1500
1501       --track-origins=<yes|no> [default: no]
1502           Controls whether Memcheck tracks the origin of uninitialised
1503           values. By default, it does not, which means that although it can
1504           tell you that an uninitialised value is being used in a dangerous
1505           way, it cannot tell you where the uninitialised value came from.
1506           This often makes it difficult to track down the root problem.
1507
1508           When set to yes, Memcheck keeps track of the origins of all
1509           uninitialised values. Then, when an uninitialised value error is
1510           reported, Memcheck will try to show the origin of the value. An
1511           origin can be one of the following four places: a heap block, a
1512           stack allocation, a client request, or miscellaneous other sources
1513           (eg, a call to brk).
1514
1515           For uninitialised values originating from a heap block, Memcheck
1516           shows where the block was allocated. For uninitialised values
1517           originating from a stack allocation, Memcheck can tell you which
1518           function allocated the value, but no more than that -- typically it
1519           shows you the source location of the opening brace of the function.
1520           So you should carefully check that all of the function's local
1521           variables are initialised properly.
1522
1523           Performance overhead: origin tracking is expensive. It halves
1524           Memcheck's speed and increases memory use by a minimum of 100MB,
1525           and possibly more. Nevertheless it can drastically reduce the
1526           effort required to identify the root cause of uninitialised value
1527           errors, and so is often a programmer productivity win, despite
1528           running more slowly.
1529
1530           Accuracy: Memcheck tracks origins quite accurately. To avoid very
1531           large space and time overheads, some approximations are made. It is
1532           possible, although unlikely, that Memcheck will report an incorrect
1533           origin, or not be able to identify any origin.
1534
1535           Note that the combination --track-origins=yes and
1536           --undef-value-errors=no is nonsensical. Memcheck checks for and
1537           rejects this combination at startup.
1538
1539       --partial-loads-ok=<yes|no> [default: yes]
1540           Controls how Memcheck handles 32-, 64-, 128- and 256-bit naturally
1541           aligned loads from addresses for which some bytes are addressable
1542           and others are not. When yes, such loads do not produce an address
1543           error. Instead, loaded bytes originating from illegal addresses are
1544           marked as uninitialised, and those corresponding to legal addresses
1545           are handled in the normal way.
1546
1547           When no, loads from partially invalid addresses are treated the
1548           same as loads from completely invalid addresses: an illegal-address
1549           error is issued, and the resulting bytes are marked as initialised.
1550
1551           Note that code that behaves in this way is in violation of the ISO
1552           C/C++ standards, and should be considered broken. If at all
1553           possible, such code should be fixed.
1554
1555       --expensive-definedness-checks=<no|auto|yes> [default: auto]
1556           Controls whether Memcheck should employ more precise but also more
1557           expensive (time consuming) instrumentation when checking the
1558           definedness of certain values. In particular, this affects the
1559           instrumentation of integer adds, subtracts and equality
1560           comparisons.
1561
1562           Selecting --expensive-definedness-checks=yes causes Memcheck to use
1563           the most accurate analysis possible. This minimises false error
1564           rates but can cause up to 30% performance degradation.
1565
1566           Selecting --expensive-definedness-checks=no causes Memcheck to use
1567           the cheapest instrumentation possible. This maximises performance
1568           but will normally give an unusably high false error rate.
1569
1570           The default setting, --expensive-definedness-checks=auto, is
1571           strongly recommended. This causes Memcheck to use the minimum of
1572           expensive instrumentation needed to achieve the same false error
1573           rate as --expensive-definedness-checks=yes. It also enables an
1574           instrumentation-time analysis pass which aims to further reduce the
1575           costs of accurate instrumentation. Overall, the performance loss is
1576           generally around 5% relative to --expensive-definedness-checks=no,
1577           although this is strongly workload dependent. Note that the exact
1578           instrumentation settings in this mode are architecture dependent.
1579
1580       --keep-stacktraces=alloc|free|alloc-and-free|alloc-then-free|none
1581       [default: alloc-and-free]
1582           Controls which stack trace(s) to keep for malloc'd and/or free'd
1583           blocks.
1584
1585           With alloc-then-free, a stack trace is recorded at allocation time,
1586           and is associated with the block. When the block is freed, a second
1587           stack trace is recorded, and this replaces the allocation stack
1588           trace. As a result, any "use after free" errors relating to this
1589           block can only show a stack trace for where the block was freed.
1590
1591           With alloc-and-free, both allocation and the deallocation stack
1592           traces for the block are stored. Hence a "use after free" error
1593           will show both, which may make the error easier to diagnose.
1594           Compared to alloc-then-free, this setting slightly increases
1595           Valgrind's memory use as the block contains two references instead
1596           of one.
1597
1598           With alloc, only the allocation stack trace is recorded (and
1599           reported). With free, only the deallocation stack trace is recorded
1600           (and reported). These values somewhat decrease Valgrind's memory
1601           and cpu usage. They can be useful depending on the error types you
1602           are searching for and the level of detail you need to analyse them.
1603           For example, if you are only interested in memory leak errors, it
1604           is sufficient to record the allocation stack traces.
1605
1606           With none, no stack traces are recorded for malloc and free
1607           operations. If your program allocates a lot of blocks and/or
1608           allocates/frees from many different stack traces, this can
1609           significantly decrease cpu and/or memory required. Of course, few
1610           details will be reported for errors related to heap blocks.
1611
1612           Note that once a stack trace is recorded, Valgrind keeps the stack
1613           trace in memory even if it is not referenced by any block. Some
1614           programs (for example, recursive algorithms) can generate a huge
1615           number of stack traces. If Valgrind uses too much memory in such
1616           circumstances, you can reduce the memory required with the options
1617           --keep-stacktraces and/or by using a smaller value for the option
1618           --num-callers.
1619
1620           If you want to use --xtree-memory=full memory profiling (see ???
1621           ), then you cannot specify --keep-stacktraces=free or
1622           --keep-stacktraces=none.
1623
1624       --freelist-vol=<number> [default: 20000000]
1625           When the client program releases memory using free (in C) or delete
1626           (C++), that memory is not immediately made available for
1627           re-allocation. Instead, it is marked inaccessible and placed in a
1628           queue of freed blocks. The purpose is to defer as long as possible
1629           the point at which freed-up memory comes back into circulation.
1630           This increases the chance that Memcheck will be able to detect
1631           invalid accesses to blocks for some significant period of time
1632           after they have been freed.
1633
1634           This option specifies the maximum total size, in bytes, of the
1635           blocks in the queue. The default value is twenty million bytes.
1636           Increasing this increases the total amount of memory used by
1637           Memcheck but may detect invalid uses of freed blocks which would
1638           otherwise go undetected.
1639
1640       --freelist-big-blocks=<number> [default: 1000000]
1641           When making blocks from the queue of freed blocks available for
1642           re-allocation, Memcheck will in priority re-circulate the blocks
1643           with a size greater or equal to --freelist-big-blocks. This ensures
1644           that freeing big blocks (in particular freeing blocks bigger than
1645           --freelist-vol) does not immediately lead to a re-circulation of
1646           all (or a lot of) the small blocks in the free list. In other
1647           words, this option increases the likelihood to discover dangling
1648           pointers for the "small" blocks, even when big blocks are freed.
1649
1650           Setting a value of 0 means that all the blocks are re-circulated in
1651           a FIFO order.
1652
1653       --workaround-gcc296-bugs=<yes|no> [default: no]
1654           When enabled, assume that reads and writes some small distance
1655           below the stack pointer are due to bugs in GCC 2.96, and does not
1656           report them. The "small distance" is 256 bytes by default. Note
1657           that GCC 2.96 is the default compiler on some ancient Linux
1658           distributions (RedHat 7.X) and so you may need to use this option.
1659           Do not use it if you do not have to, as it can cause real errors to
1660           be overlooked. A better alternative is to use a more recent GCC in
1661           which this bug is fixed.
1662
1663           You may also need to use this option when working with GCC 3.X or
1664           4.X on 32-bit PowerPC Linux. This is because GCC generates code
1665           which occasionally accesses below the stack pointer, particularly
1666           for floating-point to/from integer conversions. This is in
1667           violation of the 32-bit PowerPC ELF specification, which makes no
1668           provision for locations below the stack pointer to be accessible.
1669
1670           This option is deprecated as of version 3.12 and may be removed
1671           from future versions. You should instead use
1672           --ignore-range-below-sp to specify the exact range of offsets below
1673           the stack pointer that should be ignored. A suitable equivalent is
1674           --ignore-range-below-sp=1024-1.
1675
1676       --ignore-range-below-sp=<number>-<number>
1677           This is a more general replacement for the deprecated
1678           --workaround-gcc296-bugs option. When specified, it causes Memcheck
1679           not to report errors for accesses at the specified offsets below
1680           the stack pointer. The two offsets must be positive decimal numbers
1681           and -- somewhat counterintuitively -- the first one must be larger,
1682           in order to imply a non-wraparound address range to ignore. For
1683           example, to ignore 4 byte accesses at 8192 bytes below the stack
1684           pointer, use --ignore-range-below-sp=8192-8189. Only one range may
1685           be specified.
1686
1687       --show-mismatched-frees=<yes|no> [default: yes]
1688           When enabled, Memcheck checks that heap blocks are deallocated
1689           using a function that matches the allocating function. That is, it
1690           expects free to be used to deallocate blocks allocated by malloc,
1691           delete for blocks allocated by new, and delete[] for blocks
1692           allocated by new[]. If a mismatch is detected, an error is
1693           reported. This is in general important because in some
1694           environments, freeing with a non-matching function can cause
1695           crashes.
1696
1697           There is however a scenario where such mismatches cannot be
1698           avoided. That is when the user provides implementations of
1699           new/new[] that call malloc and of delete/delete[] that call free,
1700           and these functions are asymmetrically inlined. For example,
1701           imagine that delete[] is inlined but new[] is not. The result is
1702           that Memcheck "sees" all delete[] calls as direct calls to free,
1703           even when the program source contains no mismatched calls.
1704
1705           This causes a lot of confusing and irrelevant error reports.
1706           --show-mismatched-frees=no disables these checks. It is not
1707           generally advisable to disable them, though, because you may miss
1708           real errors as a result.
1709
1710       --ignore-ranges=0xPP-0xQQ[,0xRR-0xSS]
1711           Any ranges listed in this option (and multiple ranges can be
1712           specified, separated by commas) will be ignored by Memcheck's
1713           addressability checking.
1714
1715       --malloc-fill=<hexnumber>
1716           Fills blocks allocated by malloc, new, etc, but not by calloc, with
1717           the specified byte. This can be useful when trying to shake out
1718           obscure memory corruption problems. The allocated area is still
1719           regarded by Memcheck as undefined -- this option only affects its
1720           contents. Note that --malloc-fill does not affect a block of memory
1721           when it is used as argument to client requests
1722           VALGRIND_MEMPOOL_ALLOC or VALGRIND_MALLOCLIKE_BLOCK.
1723
1724       --free-fill=<hexnumber>
1725           Fills blocks freed by free, delete, etc, with the specified byte
1726           value. This can be useful when trying to shake out obscure memory
1727           corruption problems. The freed area is still regarded by Memcheck
1728           as not valid for access -- this option only affects its contents.
1729           Note that --free-fill does not affect a block of memory when it is
1730           used as argument to client requests VALGRIND_MEMPOOL_FREE or
1731           VALGRIND_FREELIKE_BLOCK.
1732

CACHEGRIND OPTIONS

1734       --I1=<size>,<associativity>,<line size>
1735           Specify the size, associativity and line size of the level 1
1736           instruction cache.
1737
1738       --D1=<size>,<associativity>,<line size>
1739           Specify the size, associativity and line size of the level 1 data
1740           cache.
1741
1742       --LL=<size>,<associativity>,<line size>
1743           Specify the size, associativity and line size of the last-level
1744           cache.
1745
1746       --cache-sim=no|yes [yes]
1747           Enables or disables collection of cache access and miss counts.
1748
1749       --branch-sim=no|yes [no]
1750           Enables or disables collection of branch instruction and
1751           misprediction counts. By default this is disabled as it slows
1752           Cachegrind down by approximately 25%. Note that you cannot specify
1753           --cache-sim=no and --branch-sim=no together, as that would leave
1754           Cachegrind with no information to collect.
1755
1756       --cachegrind-out-file=<file>
1757           Write the profile data to file rather than to the default output
1758           file, cachegrind.out.<pid>. The %p and %q format specifiers can be
1759           used to embed the process ID and/or the contents of an environment
1760           variable in the name, as is the case for the core option --log-
1761           file.
1762

CALLGRIND OPTIONS

1764       --callgrind-out-file=<file>
1765           Write the profile data to file rather than to the default output
1766           file, callgrind.out.<pid>. The %p and %q format specifiers can be
1767           used to embed the process ID and/or the contents of an environment
1768           variable in the name, as is the case for the core option --log-
1769           file. When multiple dumps are made, the file name is modified
1770           further; see below.
1771
1772       --dump-line=<no|yes> [default: yes]
1773           This specifies that event counting should be performed at source
1774           line granularity. This allows source annotation for sources which
1775           are compiled with debug information (-g).
1776
1777       --dump-instr=<no|yes> [default: no]
1778           This specifies that event counting should be performed at
1779           per-instruction granularity. This allows for assembly code
1780           annotation. Currently the results can only be displayed by
1781           KCachegrind.
1782
1783       --compress-strings=<no|yes> [default: yes]
1784           This option influences the output format of the profile data. It
1785           specifies whether strings (file and function names) should be
1786           identified by numbers. This shrinks the file, but makes it more
1787           difficult for humans to read (which is not recommended in any
1788           case).
1789
1790       --compress-pos=<no|yes> [default: yes]
1791           This option influences the output format of the profile data. It
1792           specifies whether numerical positions are always specified as
1793           absolute values or are allowed to be relative to previous numbers.
1794           This shrinks the file size.
1795
1796       --combine-dumps=<no|yes> [default: no]
1797           When enabled, when multiple profile data parts are to be generated
1798           these parts are appended to the same output file. Not recommended.
1799
1800       --dump-every-bb=<count> [default: 0, never]
1801           Dump profile data every count basic blocks. Whether a dump is
1802           needed is only checked when Valgrind's internal scheduler is run.
1803           Therefore, the minimum setting useful is about 100000. The count is
1804           a 64-bit value to make long dump periods possible.
1805
1806       --dump-before=<function>
1807           Dump when entering function.
1808
1809       --zero-before=<function>
1810           Zero all costs when entering function.
1811
1812       --dump-after=<function>
1813           Dump when leaving function.
1814
1815       --instr-atstart=<yes|no> [default: yes]
1816           Specify if you want Callgrind to start simulation and profiling
1817           from the beginning of the program. When set to no, Callgrind will
1818           not be able to collect any information, including calls, but it
1819           will have at most a slowdown of around 4, which is the minimum
1820           Valgrind overhead. Instrumentation can be interactively enabled via
1821           callgrind_control -i on.
1822
1823           Note that the resulting call graph will most probably not contain
1824           main, but will contain all the functions executed after
1825           instrumentation was enabled. Instrumentation can also
1826           programatically enabled/disabled. See the Callgrind include file
1827           callgrind.h for the macro you have to use in your source code.
1828
1829           For cache simulation, results will be less accurate when switching
1830           on instrumentation later in the program run, as the simulator
1831           starts with an empty cache at that moment. Switch on event
1832           collection later to cope with this error.
1833
1834       --collect-atstart=<yes|no> [default: yes]
1835           Specify whether event collection is enabled at beginning of the
1836           profile run.
1837
1838           To only look at parts of your program, you have two possibilities:
1839
1840            1. Zero event counters before entering the program part you want
1841               to profile, and dump the event counters to a file after leaving
1842               that program part.
1843
1844            2. Switch on/off collection state as needed to only see event
1845               counters happening while inside of the program part you want to
1846               profile.
1847
1848           The second option can be used if the program part you want to
1849           profile is called many times. Option 1, i.e. creating a lot of
1850           dumps is not practical here.
1851
1852           Collection state can be toggled at entry and exit of a given
1853           function with the option --toggle-collect. If you use this option,
1854           collection state should be disabled at the beginning. Note that the
1855           specification of --toggle-collect implicitly sets
1856           --collect-state=no.
1857
1858           Collection state can be toggled also by inserting the client
1859           request CALLGRIND_TOGGLE_COLLECT ; at the needed code positions.
1860
1861       --toggle-collect=<function>
1862           Toggle collection on entry/exit of function.
1863
1864       --collect-jumps=<no|yes> [default: no]
1865           This specifies whether information for (conditional) jumps should
1866           be collected. As above, callgrind_annotate currently is not able to
1867           show you the data. You have to use KCachegrind to get jump arrows
1868           in the annotated code.
1869
1870       --collect-systime=<no|yes> [default: no]
1871           This specifies whether information for system call times should be
1872           collected.
1873
1874       --collect-bus=<no|yes> [default: no]
1875           This specifies whether the number of global bus events executed
1876           should be collected. The event type "Ge" is used for these events.
1877
1878       --cache-sim=<yes|no> [default: no]
1879           Specify if you want to do full cache simulation. By default, only
1880           instruction read accesses will be counted ("Ir"). With cache
1881           simulation, further event counters are enabled: Cache misses on
1882           instruction reads ("I1mr"/"ILmr"), data read accesses ("Dr") and
1883           related cache misses ("D1mr"/"DLmr"), data write accesses ("Dw")
1884           and related cache misses ("D1mw"/"DLmw"). For more information, see
1885           Cachegrind: a cache and branch-prediction profiler.
1886
1887       --branch-sim=<yes|no> [default: no]
1888           Specify if you want to do branch prediction simulation. Further
1889           event counters are enabled: Number of executed conditional branches
1890           and related predictor misses ("Bc"/"Bcm"), executed indirect jumps
1891           and related misses of the jump address predictor ("Bi"/"Bim").
1892

HELGRIND OPTIONS

1894       --free-is-write=no|yes [default: no]
1895           When enabled (not the default), Helgrind treats freeing of heap
1896           memory as if the memory was written immediately before the free.
1897           This exposes races where memory is referenced by one thread, and
1898           freed by another, but there is no observable synchronisation event
1899           to ensure that the reference happens before the free.
1900
1901           This functionality is new in Valgrind 3.7.0, and is regarded as
1902           experimental. It is not enabled by default because its interaction
1903           with custom memory allocators is not well understood at present.
1904           User feedback is welcomed.
1905
1906       --track-lockorders=no|yes [default: yes]
1907           When enabled (the default), Helgrind performs lock order
1908           consistency checking. For some buggy programs, the large number of
1909           lock order errors reported can become annoying, particularly if
1910           you're only interested in race errors. You may therefore find it
1911           helpful to disable lock order checking.
1912
1913       --history-level=none|approx|full [default: full]
1914           --history-level=full (the default) causes Helgrind collects enough
1915           information about "old" accesses that it can produce two stack
1916           traces in a race report -- both the stack trace for the current
1917           access, and the trace for the older, conflicting access. To limit
1918           memory usage, "old" accesses stack traces are limited to a maximum
1919           of 8 entries, even if --num-callers value is bigger.
1920
1921           Collecting such information is expensive in both speed and memory,
1922           particularly for programs that do many inter-thread synchronisation
1923           events (locks, unlocks, etc). Without such information, it is more
1924           difficult to track down the root causes of races. Nonetheless, you
1925           may not need it in situations where you just want to check for the
1926           presence or absence of races, for example, when doing regression
1927           testing of a previously race-free program.
1928
1929           --history-level=none is the opposite extreme. It causes Helgrind
1930           not to collect any information about previous accesses. This can be
1931           dramatically faster than --history-level=full.
1932
1933           --history-level=approx provides a compromise between these two
1934           extremes. It causes Helgrind to show a full trace for the later
1935           access, and approximate information regarding the earlier access.
1936           This approximate information consists of two stacks, and the
1937           earlier access is guaranteed to have occurred somewhere between
1938           program points denoted by the two stacks. This is not as useful as
1939           showing the exact stack for the previous access (as
1940           --history-level=full does), but it is better than nothing, and it
1941           is almost as fast as --history-level=none.
1942
1943       --delta-stacktrace=no|yes [default: yes on linux amd64/x86]
1944           This flag only has any effect at --history-level=full.
1945
1946           --delta-stacktrace configures the way Helgrind captures the
1947           stacktraces for the option --history-level=full. Such a stacktrace
1948           is typically needed each time a new piece of memory is read or
1949           written in a basic block of instructions.
1950
1951           --delta-stacktrace=no causes Helgrind to compute a full history
1952           stacktrace from the unwind info each time a stacktrace is needed.
1953
1954           --delta-stacktrace=yes indicates to Helgrind to derive a new
1955           stacktrace from the previous stacktrace, as long as there was no
1956           call instruction, no return instruction, or any other instruction
1957           changing the call stack since the previous stacktrace was captured.
1958           If no such instruction was executed, the new stacktrace can be
1959           derived from the previous stacktrace by just changing the top frame
1960           to the current program counter. This option can speed up Helgrind
1961           by 25% when using --history-level=full.
1962
1963           The following aspects have to be considered when using
1964           --delta-stacktrace=yes :
1965
1966           ·   In some cases (for example in a function prologue), the
1967                           valgrind unwinder might not properly unwind the
1968               stack, due to some
1969                           limitations and/or due to wrong unwind info. When
1970               using
1971                           --delta-stacktrace=yes, the wrong stack trace
1972               captured in the
1973                           function prologue will be kept till the next call
1974               or return.
1975                         .RE
1976
1977               ·   On the other hand, --delta-stacktrace=yes sometimes helps
1978                   to
1979                               obtain a correct stacktrace, for example when
1980                   the unwind info allows
1981                               a correct stacktrace to be done in the
1982                   beginning of the sequence,
1983                               but not later on in the instruction
1984                   sequence..RE
1985
1986                   ·   Determining which instructions are changing the
1987                       callstack is
1988                                   partially based on platform dependent
1989                       heuristics, which have to be
1990                                   tuned/validated specifically for the
1991                       platform. Also, unwinding in a
1992                                   function prologue must be good enough to
1993                       allow using
1994                                   --delta-stacktrace=yes. Currently, the
1995                       option --delta-stacktrace=yes
1996                                   has been reasonably validated only on linux
1997                       x86 32 bits and linux
1998                                   amd64 64 bits. For more details about how
1999                       to validate
2000                                   --delta-stacktrace=yes, see debug option
2001                       --hg-sanity-flags and the
2002                                   function check_cached_rcec_ok in
2003                       libhb_core.c..RE
2004
2005
2006                   --conflict-cache-size=N [default: 1000000]
2007                       This flag only has any effect at --history-level=full.
2008
2009                       Information about "old" conflicting accesses is stored
2010                       in a cache of limited size, with LRU-style management.
2011                       This is necessary because it isn't practical to store a
2012                       stack trace for every single memory access made by the
2013                       program. Historical information on not recently
2014                       accessed locations is periodically discarded, to free
2015                       up space in the cache.
2016
2017                       This option controls the size of the cache, in terms of
2018                       the number of different memory addresses for which
2019                       conflicting access information is stored. If you find
2020                       that Helgrind is showing race errors with only one
2021                       stack instead of the expected two stacks, try
2022                       increasing this value.
2023
2024                       The minimum value is 10,000 and the maximum is
2025                       30,000,000 (thirty times the default value). Increasing
2026                       the value by 1 increases Helgrind's memory requirement
2027                       by very roughly 100 bytes, so the maximum value will
2028                       easily eat up three extra gigabytes or so of memory.
2029
2030                   --check-stack-refs=no|yes [default: yes]
2031                       By default Helgrind checks all data memory accesses
2032                       made by your program. This flag enables you to skip
2033                       checking for accesses to thread stacks (local
2034                       variables). This can improve performance, but comes at
2035                       the cost of missing races on stack-allocated data.
2036
2037                   --ignore-thread-creation=<yes|no> [default: no]
2038                       Controls whether all activities during thread creation
2039                       should be ignored. By default enabled only on Solaris.
2040                       Solaris provides higher throughput, parallelism and
2041                       scalability than other operating systems, at the cost
2042                       of more fine-grained locking activity. This means for
2043                       example that when a thread is created under glibc, just
2044                       one big lock is used for all thread setup. Solaris libc
2045                       uses several fine-grained locks and the creator thread
2046                       resumes its activities as soon as possible, leaving for
2047                       example stack and TLS setup sequence to the created
2048                       thread. This situation confuses Helgrind as it assumes
2049                       there is some false ordering in place between creator
2050                       and created thread; and therefore many types of race
2051                       conditions in the application would not be reported. To
2052                       prevent such false ordering, this command line option
2053                       is set to yes by default on Solaris. All activity
2054                       (loads, stores, client requests) is therefore ignored
2055                       during:
2056
2057                       ·   pthread_create() call in the creator thread
2058
2059                       ·   thread creation phase (stack and TLS setup) in the
2060                           created thread
2061
2062                       Also new memory allocated during thread creation is
2063                       untracked, that is race reporting is suppressed there.
2064                       DRD does the same thing implicitly. This is necessary
2065                       because Solaris libc caches many objects and reuses
2066                       them for different threads and that confuses Helgrind.
2067

DRD OPTIONS

2069       --check-stack-var=<yes|no> [default: no]
2070           Controls whether DRD detects data races on stack variables.
2071           Verifying stack variables is disabled by default because most
2072           programs do not share stack variables over threads.
2073
2074       --exclusive-threshold=<n> [default: off]
2075           Print an error message if any mutex or writer lock has been held
2076           longer than the time specified in milliseconds. This option enables
2077           the detection of lock contention.
2078
2079       --join-list-vol=<n> [default: 10]
2080           Data races that occur between a statement at the end of one thread
2081           and another thread can be missed if memory access information is
2082           discarded immediately after a thread has been joined. This option
2083           allows to specify for how many joined threads memory access
2084           information should be retained.
2085
2086        --first-race-only=<yes|no> [default: no]
2087           Whether to report only the first data race that has been detected
2088           on a memory location or all data races that have been detected on a
2089           memory location.
2090
2091        --free-is-write=<yes|no> [default: no]
2092           Whether to report races between accessing memory and freeing
2093           memory. Enabling this option may cause DRD to run slightly slower.
2094           Notes:
2095
2096           ·   Don't enable this option when using custom memory allocators
2097               that use the VG_USERREQ__MALLOCLIKE_BLOCK and
2098               VG_USERREQ__FREELIKE_BLOCK because that would result in false
2099               positives.
2100
2101           ·   Don't enable this option when using reference-counted objects
2102               because that will result in false positives, even when that
2103               code has been annotated properly with ANNOTATE_HAPPENS_BEFORE
2104               and ANNOTATE_HAPPENS_AFTER. See e.g. the output of the
2105               following command for an example: valgrind --tool=drd
2106               --free-is-write=yes drd/tests/annotate_smart_pointer.
2107
2108        --report-signal-unlocked=<yes|no> [default: yes]
2109           Whether to report calls to pthread_cond_signal and
2110           pthread_cond_broadcast where the mutex associated with the signal
2111           through pthread_cond_wait or pthread_cond_timed_waitis not locked
2112           at the time the signal is sent. Sending a signal without holding a
2113           lock on the associated mutex is a common programming error which
2114           can cause subtle race conditions and unpredictable behavior. There
2115           exist some uncommon synchronization patterns however where it is
2116           safe to send a signal without holding a lock on the associated
2117           mutex.
2118
2119       --segment-merging=<yes|no> [default: yes]
2120           Controls segment merging. Segment merging is an algorithm to limit
2121           memory usage of the data race detection algorithm. Disabling
2122           segment merging may improve the accuracy of the so-called 'other
2123           segments' displayed in race reports but can also trigger an out of
2124           memory error.
2125
2126       --segment-merging-interval=<n> [default: 10]
2127           Perform segment merging only after the specified number of new
2128           segments have been created. This is an advanced configuration
2129           option that allows to choose whether to minimize DRD's memory usage
2130           by choosing a low value or to let DRD run faster by choosing a
2131           slightly higher value. The optimal value for this parameter depends
2132           on the program being analyzed. The default value works well for
2133           most programs.
2134
2135       --shared-threshold=<n> [default: off]
2136           Print an error message if a reader lock has been held longer than
2137           the specified time (in milliseconds). This option enables the
2138           detection of lock contention.
2139
2140       --show-confl-seg=<yes|no> [default: yes]
2141           Show conflicting segments in race reports. Since this information
2142           can help to find the cause of a data race, this option is enabled
2143           by default. Disabling this option makes the output of DRD more
2144           compact.
2145
2146       --show-stack-usage=<yes|no> [default: no]
2147           Print stack usage at thread exit time. When a program creates a
2148           large number of threads it becomes important to limit the amount of
2149           virtual memory allocated for thread stacks. This option makes it
2150           possible to observe how much stack memory has been used by each
2151           thread of the client program. Note: the DRD tool itself allocates
2152           some temporary data on the client thread stack. The space necessary
2153           for this temporary data must be allocated by the client program
2154           when it allocates stack memory, but is not included in stack usage
2155           reported by DRD.
2156
2157       --ignore-thread-creation=<yes|no> [default: no]
2158           Controls whether all activities during thread creation should be
2159           ignored. By default enabled only on Solaris. Solaris provides
2160           higher throughput, parallelism and scalability than other operating
2161           systems, at the cost of more fine-grained locking activity. This
2162           means for example that when a thread is created under glibc, just
2163           one big lock is used for all thread setup. Solaris libc uses
2164           several fine-grained locks and the creator thread resumes its
2165           activities as soon as possible, leaving for example stack and TLS
2166           setup sequence to the created thread. This situation confuses DRD
2167           as it assumes there is some false ordering in place between creator
2168           and created thread; and therefore many types of race conditions in
2169           the application would not be reported. To prevent such false
2170           ordering, this command line option is set to yes by default on
2171           Solaris. All activity (loads, stores, client requests) is therefore
2172           ignored during:
2173
2174           ·   pthread_create() call in the creator thread
2175
2176           ·   thread creation phase (stack and TLS setup) in the created
2177               thread
2178
2179       --trace-addr=<address> [default: none]
2180           Trace all load and store activity for the specified address. This
2181           option may be specified more than once.
2182
2183       --ptrace-addr=<address> [default: none]
2184           Trace all load and store activity for the specified address and
2185           keep doing that even after the memory at that address has been
2186           freed and reallocated.
2187
2188       --trace-alloc=<yes|no> [default: no]
2189           Trace all memory allocations and deallocations. May produce a huge
2190           amount of output.
2191
2192       --trace-barrier=<yes|no> [default: no]
2193           Trace all barrier activity.
2194
2195       --trace-cond=<yes|no> [default: no]
2196           Trace all condition variable activity.
2197
2198       --trace-fork-join=<yes|no> [default: no]
2199           Trace all thread creation and all thread termination events.
2200
2201       --trace-hb=<yes|no> [default: no]
2202           Trace execution of the ANNOTATE_HAPPENS_BEFORE(),
2203           ANNOTATE_HAPPENS_AFTER() and ANNOTATE_HAPPENS_DONE() client
2204           requests.
2205
2206       --trace-mutex=<yes|no> [default: no]
2207           Trace all mutex activity.
2208
2209       --trace-rwlock=<yes|no> [default: no]
2210           Trace all reader-writer lock activity.
2211
2212       --trace-semaphore=<yes|no> [default: no]
2213           Trace all semaphore activity.
2214

MASSIF OPTIONS

2216       --heap=<yes|no> [default: yes]
2217           Specifies whether heap profiling should be done.
2218
2219       --heap-admin=<size> [default: 8]
2220           If heap profiling is enabled, gives the number of administrative
2221           bytes per block to use. This should be an estimate of the average,
2222           since it may vary. For example, the allocator used by glibc on
2223           Linux requires somewhere between 4 to 15 bytes per block, depending
2224           on various factors. That allocator also requires admin space for
2225           freed blocks, but Massif cannot account for this.
2226
2227       --stacks=<yes|no> [default: no]
2228           Specifies whether stack profiling should be done. This option slows
2229           Massif down greatly, and so is off by default. Note that Massif
2230           assumes that the main stack has size zero at start-up. This is not
2231           true, but doing otherwise accurately is difficult. Furthermore,
2232           starting at zero better indicates the size of the part of the main
2233           stack that a user program actually has control over.
2234
2235       --pages-as-heap=<yes|no> [default: no]
2236           Tells Massif to profile memory at the page level rather than at the
2237           malloc'd block level. See above for details.
2238
2239       --depth=<number> [default: 30]
2240           Maximum depth of the allocation trees recorded for detailed
2241           snapshots. Increasing it will make Massif run somewhat more slowly,
2242           use more memory, and produce bigger output files.
2243
2244       --alloc-fn=<name>
2245           Functions specified with this option will be treated as though they
2246           were a heap allocation function such as malloc. This is useful for
2247           functions that are wrappers to malloc or new, which can fill up the
2248           allocation trees with uninteresting information. This option can be
2249           specified multiple times on the command line, to name multiple
2250           functions.
2251
2252           Note that the named function will only be treated this way if it is
2253           the top entry in a stack trace, or just below another function
2254           treated this way. For example, if you have a function malloc1 that
2255           wraps malloc, and malloc2 that wraps malloc1, just specifying
2256           --alloc-fn=malloc2 will have no effect. You need to specify
2257           --alloc-fn=malloc1 as well. This is a little inconvenient, but the
2258           reason is that checking for allocation functions is slow, and it
2259           saves a lot of time if Massif can stop looking through the stack
2260           trace entries as soon as it finds one that doesn't match rather
2261           than having to continue through all the entries.
2262
2263           Note that C++ names are demangled. Note also that overloaded C++
2264           names must be written in full. Single quotes may be necessary to
2265           prevent the shell from breaking them up. For example:
2266
2267               --alloc-fn='operator new(unsigned, std::nothrow_t const&)'
2268
2269
2270       --ignore-fn=<name>
2271           Any direct heap allocation (i.e. a call to malloc, new, etc, or a
2272           call to a function named by an --alloc-fn option) that occurs in a
2273           function specified by this option will be ignored. This is mostly
2274           useful for testing purposes. This option can be specified multiple
2275           times on the command line, to name multiple functions.
2276
2277           Any realloc of an ignored block will also be ignored, even if the
2278           realloc call does not occur in an ignored function. This avoids the
2279           possibility of negative heap sizes if ignored blocks are shrunk
2280           with realloc.
2281
2282           The rules for writing C++ function names are the same as for
2283           --alloc-fn above.
2284
2285       --threshold=<m.n> [default: 1.0]
2286           The significance threshold for heap allocations, as a percentage of
2287           total memory size. Allocation tree entries that account for less
2288           than this will be aggregated. Note that this should be specified in
2289           tandem with ms_print's option of the same name.
2290
2291       --peak-inaccuracy=<m.n> [default: 1.0]
2292           Massif does not necessarily record the actual global memory
2293           allocation peak; by default it records a peak only when the global
2294           memory allocation size exceeds the previous peak by at least 1.0%.
2295           This is because there can be many local allocation peaks along the
2296           way, and doing a detailed snapshot for every one would be expensive
2297           and wasteful, as all but one of them will be later discarded. This
2298           inaccuracy can be changed (even to 0.0%) via this option, but
2299           Massif will run drastically slower as the number approaches zero.
2300
2301       --time-unit=<i|ms|B> [default: i]
2302           The time unit used for the profiling. There are three
2303           possibilities: instructions executed (i), which is good for most
2304           cases; real (wallclock) time (ms, i.e. milliseconds), which is
2305           sometimes useful; and bytes allocated/deallocated on the heap
2306           and/or stack (B), which is useful for very short-run programs, and
2307           for testing purposes, because it is the most reproducible across
2308           different machines.
2309
2310       --detailed-freq=<n> [default: 10]
2311           Frequency of detailed snapshots. With --detailed-freq=1, every
2312           snapshot is detailed.
2313
2314       --max-snapshots=<n> [default: 100]
2315           The maximum number of snapshots recorded. If set to N, for all
2316           programs except very short-running ones, the final number of
2317           snapshots will be between N/2 and N.
2318
2319       --massif-out-file=<file> [default: massif.out.%p]
2320           Write the profile data to file rather than to the default output
2321           file, massif.out.<pid>. The %p and %q format specifiers can be used
2322           to embed the process ID and/or the contents of an environment
2323           variable in the name, as is the case for the core option --log-
2324           file.
2325

SGCHECK OPTIONS

2327       There are no SGCheck-specific command-line options at present.
2328

BBV OPTIONS

2330       --bb-out-file=<name> [default: bb.out.%p]
2331           This option selects the name of the basic block vector file. The %p
2332           and %q format specifiers can be used to embed the process ID and/or
2333           the contents of an environment variable in the name, as is the case
2334           for the core option --log-file.
2335
2336       --pc-out-file=<name> [default: pc.out.%p]
2337           This option selects the name of the PC file. This file holds
2338           program counter addresses and function name info for the various
2339           basic blocks. This can be used in conjunction with the basic block
2340           vector file to fast-forward via function names instead of just
2341           instruction counts. The %p and %q format specifiers can be used to
2342           embed the process ID and/or the contents of an environment variable
2343           in the name, as is the case for the core option --log-file.
2344
2345       --interval-size=<number> [default: 100000000]
2346           This option selects the size of the interval to use. The default is
2347           100 million instructions, which is a commonly used value. Other
2348           sizes can be used; smaller intervals can help programs with
2349           finer-grained phases. However smaller interval size can lead to
2350           accuracy issues due to warm-up effects (When fast-forwarding the
2351           various architectural features will be un-initialized, and it will
2352           take some number of instructions before they "warm up" to the state
2353           a full simulation would be at without the fast-forwarding. Large
2354           interval sizes tend to mitigate this.)
2355
2356       --instr-count-only [default: no]
2357           This option tells the tool to only display instruction count
2358           totals, and to not generate the actual basic block vector file.
2359           This is useful for debugging, and for gathering instruction count
2360           info without generating the large basic block vector files.
2361

LACKEY OPTIONS

2363       --basic-counts=<no|yes> [default: yes]
2364           When enabled, Lackey prints the following statistics and
2365           information about the execution of the client program:
2366
2367            1. The number of calls to the function specified by the --fnname
2368               option (the default is main). If the program has had its
2369               symbols stripped, the count will always be zero.
2370
2371            2. The number of conditional branches encountered and the number
2372               and proportion of those taken.
2373
2374            3. The number of superblocks entered and completed by the program.
2375               Note that due to optimisations done by the JIT, this is not at
2376               all an accurate value.
2377
2378            4. The number of guest (x86, amd64, ppc, etc.) instructions and IR
2379               statements executed. IR is Valgrind's RISC-like intermediate
2380               representation via which all instrumentation is done.
2381
2382            5. Ratios between some of these counts.
2383
2384            6. The exit code of the client program.
2385
2386       --detailed-counts=<no|yes> [default: no]
2387           When enabled, Lackey prints a table containing counts of loads,
2388           stores and ALU operations, differentiated by their IR types. The IR
2389           types are identified by their IR name ("I1", "I8", ... "I128",
2390           "F32", "F64", and "V128").
2391
2392       --trace-mem=<no|yes> [default: no]
2393           When enabled, Lackey prints the size and address of almost every
2394           memory access made by the program. See the comments at the top of
2395           the file lackey/lk_main.c for details about the output format, how
2396           it works, and inaccuracies in the address trace. Note that this
2397           option produces immense amounts of output.
2398
2399       --trace-superblocks=<no|yes> [default: no]
2400           When enabled, Lackey prints out the address of every superblock (a
2401           single entry, multiple exit, linear chunk of code) executed by the
2402           program. This is primarily of interest to Valgrind developers. See
2403           the comments at the top of the file lackey/lk_main.c for details
2404           about the output format. Note that this option produces large
2405           amounts of output.
2406
2407       --fnname=<name> [default: main]
2408           Changes the function for which calls are counted when
2409           --basic-counts=yes is specified.
2410

SEE ALSO

2412       cg_annotate(1), callgrind_annotate(1), callgrind_control(1),
2413       ms_print(1), $INSTALL/share/doc/valgrind/html/index.html or
2414       http://www.valgrind.org/docs/manual/index.html, Debugging your program
2415       using Valgrind's gdbserver and GDB[1] vgdb[2], Valgrind monitor
2416       commands[3], The Commentary[4], Scheduling and Multi-Thread
2417       Performance[5], Cachegrind: a cache and branch-prediction profiler[6].
2418

AUTHOR

2420       See the AUTHORS file in the valgrind distribution for a comprehensive
2421       list of authors.
2422
2423       This manpage was written by Andres Roldan <aroldan@debian.org> and the
2424       Valgrind developers.
2425

NOTES

2427        1. Debugging your program using Valgrind's gdbserver and GDB
2428           http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver
2429
2430        2. vgdb
2431           http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.vgdb
2432
2433        3. Valgrind monitor commands
2434           http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.valgrind-monitor-commands
2435
2436        4. The Commentary
2437           http://www.valgrind.org/docs/manual/manual-core.html#manual-core.comment
2438
2439        5. Scheduling and Multi-Thread Performance
2440           http://www.valgrind.org/docs/manual/manual-core.html#manual-core.pthreads_perf_sched
2441
2442        6. Cachegrind: a cache and branch-prediction profiler
2443           http://www.valgrind.org/docs/manual/cg-manual.html
2444
2445
2446
2447Release 3.14.0                    10/09/2018                       VALGRIND(1)
Impressum