njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 1 | .TH VALGRIND "1" "" "" |
| 2 | |
| 3 | .SH NAME |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 4 | \fBvalgrind \fP- a suite of tools for debugging and profiling programs |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 5 | |
| 6 | .SH SYNOPSIS |
| 7 | .nf |
| 8 | .fam C |
| 9 | \fIvalgrind\fP [\fIvalgrind\fP \fIoptions\fP] \fIyour-program\fP [\fIyour-program\fP \fIoptions\fP] |
| 10 | .fam T |
| 11 | .fi |
| 12 | |
| 13 | .SH DESCRIPTION |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 14 | \fBvalgrind\fP is a flexible program for debugging and profiling Linux |
| 15 | executables. It consists of a core, which provides a synthetic CPU |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 16 | in software, and a series of "tools", each of which is a debugging or |
| 17 | profiling tool. The architecture is modular, so that new tools can be |
| 18 | created easily and without disturbing the existing structure. |
| 19 | |
| 20 | .PP |
| 21 | This manual page covers only basic usage and options. Please see the |
| 22 | HTML documentation for more comprehensive information. |
| 23 | |
| 24 | .SH INVOCATION |
| 25 | \fBvalgrind\fP is typically invoked as follows: |
| 26 | |
| 27 | valgrind program args |
| 28 | |
| 29 | This runs \fBprogram\fP (with arguments \fBargs\fP) under valgrind |
| 30 | using the \fBmemcheck\fP tool. \fBmemcheck\fP performs a range of |
| 31 | memory-checking functions, including detecting accesses to uninitialized |
| 32 | memory, misuse of allocated memory (double frees, access after free, |
| 33 | etc.) and detecting memory leaks. |
| 34 | |
| 35 | To use a different tool, use the \fB--tool\fP option: |
| 36 | |
| 37 | valgrind --tool=toolname program args |
| 38 | |
| 39 | The following tools are available: |
| 40 | |
| 41 | .RS |
| 42 | .TP |
| 43 | .B |
| 44 | - addrcheck |
| 45 | \fBaddrcheck\fP is similar to memcheck, but does not perform the same |
| 46 | granularity of memory checking. This will run faster and use less memory, |
| 47 | but may miss some problems that \fBmemcheck\fP would catch. |
| 48 | .TP |
| 49 | .B |
| 50 | - cachegrind |
| 51 | \fBcachegrind\fP is a cache simulator. |
| 52 | ." .TP |
| 53 | ." .B |
| 54 | ." - helgrind |
| 55 | ." \fBhelgrind\fP spots potential race conditions in your program. |
| 56 | .TP |
| 57 | .B |
| 58 | - lackey |
| 59 | \fBlackey\fP is a sample tool that can be used as a template for |
| 60 | generating your own tools. After the program terminates, it prints out |
| 61 | some basic statistics about the program execution. |
| 62 | .TP |
| 63 | .B |
| 64 | - massif |
| 65 | \fBmassif\fP is a heap profiler. It measures how much heap memory your |
| 66 | program uses. |
| 67 | .TP |
| 68 | .B |
| 69 | - memcheck |
| 70 | \fBmemcheck\fP is a fine-grained memory checker. |
| 71 | .TP |
| 72 | .B |
| 73 | - none |
| 74 | \fBnone\fP performs no function - it simply runs the program under |
| 75 | \fBvalgrind\fP. This is typically used for debugging and benchmarking |
| 76 | \fBvalgrind\fP. |
| 77 | .RE |
| 78 | |
| 79 | .SH COMMON CORE OPTIONS |
| 80 | |
| 81 | .TP |
| 82 | .B |
| 83 | --db-attach=<yes|no> [default: no] |
| 84 | When enabled, \fBvalgrind\fP will pause after every error shown and |
| 85 | print the line: |
| 86 | |
| 87 | .PP |
| 88 | .nf |
| 89 | .fam C |
| 90 | ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- |
| 91 | |
| 92 | .fam T |
| 93 | .fi |
| 94 | |
| 95 | .RS |
| 96 | Pressing Ret, or N Ret or n Ret, causes \fBvalgrind\fP not to start a |
| 97 | debugger for this error. |
| 98 | |
| 99 | .PP |
| 100 | Pressing Y Ret or y Ret causes \fBvalgrind\fP to start the debugger |
| 101 | (specified by the \fB--db-command\fP option) for the program at this |
| 102 | point. When you have finished with the debugger, quit from it, and |
| 103 | the program will continue. Trying to continue from inside the debugger |
| 104 | doesn't work. |
| 105 | |
| 106 | .PP |
| 107 | Pressing C Ret or c Ret causes \fBvalgrind\fP not to start the debugger |
| 108 | and \fBvalgrind\fP will not ask again. |
| 109 | |
| 110 | .PP |
| 111 | --db-attach=yes conflicts with --trace-children=yes. You can't use them |
| 112 | together. \fBvalgrind\fP refuses to start up in this situation. 1 May |
| 113 | 2002: this is a historical relic which could be easily fixed if it gets |
| 114 | in your way. Mail me and complain if this is a problem for you. |
| 115 | |
| 116 | .PP |
| 117 | Nov 2002: if you're sending output to a logfile or to a network socket, |
| 118 | I guess this option doesn't make any sense. Caveat emptor. |
| 119 | .RE |
| 120 | |
| 121 | .TP |
| 122 | .B |
| 123 | --db-command=<command> [default: gdb -nw %f %p] |
| 124 | Specify the debugger to use with the --db-attach command. The |
| 125 | default debugger is gdb. This option is a template that is expanded by |
| 126 | \fBvalgrind\fP at runtime. \fB%f\fP is replaced with the executable's |
| 127 | file name and \fB%p\fP is replaced by the process ID of the executable. |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 128 | |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 129 | .TP |
| 130 | .B |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 131 | --demangle=<yes|no> [default: yes] |
| 132 | Enable or disable automatic demangling (decoding) of C++ names. Enabled by |
| 133 | default. When enabled, \fBvalgrind\fP will attempt to translate encoded |
| 134 | C++ procedure names back to something approaching the original. The |
| 135 | demangler handles symbols mangled by g++ versions 2.X and 3.X. |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 136 | |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 137 | .TP |
| 138 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 139 | --error-limit=<yes|no> [default: yes] |
| 140 | When enabled, \fBvalgrind\fP stops reporting errors after 30000 in total, |
| 141 | or 300 different ones, have been seen. This is to stop the error tracking |
| 142 | machinery from becoming a huge performance overhead in programs with |
| 143 | many errors. |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 144 | |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 145 | .TP |
| 146 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 147 | --gen-suppressions=<yes|no> [default: no] |
| 148 | When enabled, \fBvalgrind\fP will pause after every error shown and |
| 149 | print the line: |
| 150 | |
| 151 | .PP |
| 152 | .nf |
| 153 | .fam C |
| 154 | ---- Print suppression ? --- [Return/N/n/Y/y/C/c] ---- |
| 155 | |
| 156 | .fam T |
| 157 | .fi |
| 158 | |
| 159 | .RS |
| 160 | Pressing Y Ret or y Ret will cause a suppression for this error to be |
| 161 | printed. This suppression can be cut-and-paste into a custom suppressions |
| 162 | file and used to suppress this error in subsequent runs. |
| 163 | |
| 164 | .P |
| 165 | Pressing Ret or n Ret or N Ret will cause no suppression to be printed. |
| 166 | |
| 167 | .P |
| 168 | Pressing C Ret or c Ret will cause no suppression to be printed and |
| 169 | \fBvalgrind\fP will not ask again. |
| 170 | .RE |
| 171 | |
| 172 | .TP |
| 173 | .B |
| 174 | -h --help |
| 175 | Show help for all options, both for the core and for the selected tool. |
| 176 | |
| 177 | .TP |
| 178 | .B |
| 179 | --help-debug |
| 180 | Show help for all options, both for the core and for the selected tool, |
| 181 | including options for debugging \fBvalgrind\fP. |
| 182 | |
| 183 | .TP |
| 184 | .B |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 185 | --input-fd=<number> [default: 0, stdin] |
| 186 | Specify the file descriptor to use for reading input from the user. This |
| 187 | is used whenever \fBvalgrind\fP needs to prompt the user for a decision. |
| 188 | |
| 189 | .TP |
| 190 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 191 | --log-file=<filename> |
| 192 | Specifies that \fBvalgrind\fP should send all of its messages to the |
| 193 | specified file. In fact, the file name used is created by concatenating |
| 194 | the text filename, ".pid" and the process ID, so as to create a file |
| 195 | per process. The specified file name may not be the empty string. |
| 196 | |
| 197 | .TP |
| 198 | .B |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 199 | --log-file-exactly=<filename> |
| 200 | Just like \fB--log-file\fB, but the ".pid" suffix is not added. If you |
| 201 | trace multiple processes with Valgrind when using this option the log |
| 202 | file may get all messed up. |
| 203 | |
| 204 | .TP |
| 205 | .B |
| 206 | --log-fd=<number> [default: 2, stderr] |
| 207 | Specifies that \fBvalgrind\fP should send all of its messages to |
| 208 | the specified file descriptor. The default, 2, is the standard error |
| 209 | channel (stderr). Note that this may interfere with the client's own |
| 210 | use of stderr. |
| 211 | |
| 212 | .TP |
| 213 | .B |
| 214 | --log-file-qualifier=<VAR> |
| 215 | Specifies that \fBvalgrind\fB should send all of its messages to the |
| 216 | file named by the environment variable \fB$VAR\fB. This is useful when |
| 217 | running MPI programs. |
| 218 | |
| 219 | .TP |
| 220 | .B |
| 221 | --log-socket=<ip-address:port-number> |
| 222 | Specifies that \fBvalgrind\fP should send all of its messages to the |
| 223 | specified port at the specified IP address. The port may be omitted, |
| 224 | in which case port 1500 is used. If a connection cannot be made to |
| 225 | the specified socket, \fBvalgrind\fP falls back to writing output to |
| 226 | the standard error (stderr). This option is intended to be used in |
| 227 | conjunction with the \fBvalgrind-listener\fP program. For further details, |
| 228 | see section 2.3 of the user manual. |
| 229 | |
| 230 | .TP |
| 231 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 232 | --num-callers=<number> [default=12] |
| 233 | By default, \fBvalgrind\fP shows 12 levels of function call names to |
| 234 | help you identify program locations. You can change that number with |
| 235 | this option. This can help in determining the program's location in |
| 236 | deeply-nested call chains. Note that errors are commoned up using only |
| 237 | the top three function locations (the place in the current function, |
| 238 | and that of its two immediate callers). So this doesn't affect the total |
| 239 | number of errors reported. |
| 240 | |
| 241 | .RS |
| 242 | .PP |
| 243 | The maximum value for this is 50. Note that higher settings will make |
| 244 | \fBvalgrind\fP run a bit more slowly and take a bit more memory, but |
| 245 | can be useful when working with programs with deeply-nested call chains. |
| 246 | .RE |
| 247 | |
| 248 | .TP |
| 249 | .B |
| 250 | -q --quiet |
| 251 | Run silently, and only print error messages. Useful if you are running |
| 252 | regression tests or have some other automated test machinery. |
| 253 | |
| 254 | .TP |
| 255 | .B |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 256 | --show-below-main=<yes|no> [default: no] |
| 257 | When enabled, this option causes full stack backtraces to be emited, |
| 258 | including the part before \fBmain\fP in your program (subject to the |
| 259 | \fB--num-callers\fP option.) When disabled, only the part of the stack |
| 260 | backtrace up to and including main is printed. |
| 261 | |
| 262 | .TP |
| 263 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 264 | --suppressions=<filename> [default: $PREFIX/lib/\fBvalgrind\fP/default.supp] |
| 265 | Specifies an extra file from which to read descriptions of errors to |
| 266 | suppress. You may specify up to 10 additional suppression files. |
| 267 | |
| 268 | .TP |
| 269 | .B |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 270 | --time-stamp=<yes|no> [default: no] |
| 271 | When enabled, a time-stamp is added to all log messages. |
| 272 | |
| 273 | .TP |
| 274 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 275 | --tool=<toolname> [default: memcheck] |
| 276 | Specify which tool to use. The default tool is memcheck. |
| 277 | |
| 278 | .TP |
| 279 | .B |
| 280 | --trace-children=<yes|no> [default: no] |
| 281 | When enabled, \fBvalgrind\fP will trace into child processes. This is |
| 282 | confusing and usually not what you want, so is disabled by default. |
| 283 | |
| 284 | .TP |
| 285 | .B |
| 286 | --track-fds=<yes|no> [default: no] |
| 287 | Track file descriptor creation and deletion and produce a summary at the |
| 288 | end of the program execution of file descriptors that are still in use. |
| 289 | |
| 290 | .TP |
| 291 | .B |
| 292 | -v --verbose |
| 293 | Be more verbose. Gives extra information on various aspects of your |
| 294 | program, such as: the shared objects loaded, the suppressions used, |
| 295 | the progress of the instrumentation and execution engines, and warnings |
| 296 | about unusual behaviour. Repeating the flag increases the verbosity level. |
| 297 | |
| 298 | .TP |
| 299 | .B |
| 300 | --version |
| 301 | Show the version number of the \fBvalgrind\fP core. Tools can have |
| 302 | their own version numbers. There is a scheme in place to ensure that |
| 303 | tools only execute when the core version is one they are known to work |
| 304 | with. This was done to minimise the chances of strange problems arising |
| 305 | from tool-vs-core version incompatibilities. |
| 306 | |
| 307 | .SH ADDRCHECK OPTIONS |
| 308 | |
| 309 | .TP |
| 310 | .B |
| 311 | --freelist-vol=<number> [default: 1000000] |
| 312 | When the client program releases memory using free (in C) or delete |
| 313 | (C++), that memory is not immediately made available for re-allocation. |
| 314 | Instead it is marked inaccessible and placed in a queue of freed blocks. |
| 315 | The purpose is to delay the point at which freed-up memory comes back |
| 316 | into circulation. This increases the chance that \fBaddrcheck\fP will |
| 317 | be able to detect invalid accesses to blocks for some significant period |
| 318 | of time after they have been freed. |
| 319 | |
| 320 | .RS |
| 321 | This flag specifies the maximum total size, in bytes, of the blocks in |
| 322 | the queue. The default value is one million bytes. Increasing this |
| 323 | increases the total amount of memory used by \fBaddrcheck\fP but may |
| 324 | detect invalid uses of freed blocks which would otherwise go undetected. |
| 325 | .RE |
| 326 | |
| 327 | .TP |
| 328 | .B |
| 329 | --leak-check=<yes|no|summary|full> [default: summary] |
| 330 | Enables full, summary or no leak checking. When full (\fBfull\fP or |
| 331 | \fByes\fP options) checking is performed, details on all leaked blocks |
| 332 | are printed after the program finishes executing. When summary checking |
| 333 | is enabled, a summary of all leaked memory is printed. When no leak |
| 334 | checking is performed, no leaked memory details are produced. Disabling |
| 335 | leak checking can speed up your program execution. |
| 336 | |
| 337 | .TP |
| 338 | .B |
| 339 | --leak-resolution=<low|med|high> [default: low] |
| 340 | When doing leak checking, determines how willing \fBaddrcheck\fP is to |
| 341 | consider different backtraces to be the same. When set to \fBlow\fP, |
| 342 | the default, only the first two entries need match. When \fBmed\fP, |
| 343 | four entries have to match. When \fBhigh\fP, all entries need to match. |
| 344 | |
| 345 | .TP |
| 346 | .B |
| 347 | --partial-loads-ok=<yes|no> [default: yes] |
| 348 | Controls how \fBaddrcheck\fP handles word (4-byte) loads from addresses |
| 349 | for which some bytes are addressible and others are not. When enabled, |
| 350 | such loads do not elicit an address error. Instead, \fBaddrcheck\fP |
| 351 | considers the bytes corresponding to the illegal addresses as undefined, |
| 352 | and those corresponding to legal addresses are considered defined. |
| 353 | |
| 354 | .RS |
| 355 | When disabled, loads from partially invalid addresses are treated the |
| 356 | same as loads from completely invalid addresses: an illegal-address error |
| 357 | is issued, and the \fBaddrcheck\fP considers all bytes as invalid data. |
| 358 | .RE |
| 359 | |
| 360 | .TP |
| 361 | .B |
| 362 | --show-reachable=<yes|no> [default: no] |
| 363 | When performing full leak checking, print out details of blocks that are |
| 364 | leaked but still reachable. For details of what a reachable block is, |
| 365 | see the HTML documentation. |
| 366 | |
| 367 | .TP |
| 368 | .B |
| 369 | --workaround-gcc296-bugs=<yes|no> [default: no] |
| 370 | When enabled, assume that reads and writes some small distance below |
| 371 | the stack pointer \fB%esp\fP are due to bugs in gcc 2.96, and does not |
| 372 | report them. The "small distance" is 256 bytes by default. Note that gcc |
| 373 | 2.96 is the default compiler on some older Linux distributions (RedHat |
| 374 | 7.X, Mandrake) and so you may well need to use this flag. Do not use |
| 375 | it if you do not have to, as it can cause real errors to be overlooked. |
| 376 | Another option is to use a gcc/g++ which does not generate accesses below |
| 377 | the stack pointer. 2.95.3 seems to be a good choice in this respect. |
| 378 | |
| 379 | .SH MEMCHECK OPTIONS |
| 380 | \fBmemcheck\fP understands the same options as \fBaddrcheck\fP, along |
| 381 | with the following options: |
| 382 | |
| 383 | .TP |
| 384 | .B |
| 385 | --avoid-strlen-errors=<yes|no> [default: yes] |
| 386 | Enable or disable a heuristic for dealing with highly-optimized versions |
| 387 | of \fBstrlen\fP. These versions of \fBstrlen\fP can cause spurious |
| 388 | errors to be reported by \fBmemcheck\fP, so it's usually a good idea to |
| 389 | leave this enabled. |
| 390 | |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 391 | .SH CACHEGRIND OPTIONS |
| 392 | |
| 393 | .TP |
| 394 | .B |
| 395 | --D1=<size>,<associativity>,<line size> |
| 396 | Specify the size, associativity and line size of the level 1 data cache. |
| 397 | All values are measured in bytes. If this options is not specified, |
| 398 | the system value (as retrieved by the \fBCPUID\fP instruction) is used. |
| 399 | |
| 400 | .TP |
| 401 | .B |
| 402 | --I1=<size>,<associativity>,<line size> |
| 403 | Specify the size, associativity and line size of the level 1 instruction |
| 404 | cache. All values are measured in bytes. If this options is not |
| 405 | specified, the system value (as retrieved by the \fBCPUID\fP instruction) |
| 406 | is used. |
| 407 | |
| 408 | .TP |
| 409 | .B |
| 410 | --L2=<size>,<associativity>,<line size> |
| 411 | Specify the size, associativity and line size of the level 2 cache. |
| 412 | All values are measured in bytes. If this options is not specified, |
| 413 | the system value (as retrieved by the \fBCPUID\fP instruction) is used. |
| 414 | |
| 415 | .SH MASSIF OPTIONS |
| 416 | |
| 417 | .TP |
| 418 | .B |
| 419 | --alloc-fn=<name> |
| 420 | Specify a function that allocates memory. This is useful for functions |
| 421 | that are wrappers to \fBmalloc()\fP, which can fill up the context |
| 422 | information uselessly (and give very uninformative bands on the graph). |
| 423 | Functions specified will be ignored in contexts, i.e. treated as though |
| 424 | they were \fBmalloc()\fP. This option can be specified multiple times |
| 425 | on the command line, to name multiple functions. |
| 426 | |
| 427 | .TP |
| 428 | .B |
| 429 | --depth=<number> [default: 3] |
| 430 | Depth of call chains to present in the detailed heap information. |
| 431 | Increasing it will give more information, but \fBmassif\fP will run the |
| 432 | program more slowly, using more memory, and produce a bigger \fB.txt\fP |
| 433 | or \fB.hp\fP file. |
| 434 | |
| 435 | .TP |
| 436 | .B |
| 437 | --format=<text|html> [default: text] |
| 438 | Produce the detailed heap information in text or HTML format. The file |
| 439 | suffix used will be either \fB.txt\fP or \fB.html\fP. |
| 440 | |
| 441 | .TP |
| 442 | .B |
| 443 | --heap=<yes|no> [default: yes] |
| 444 | When enabled, profile heap usage in detail. Without it, the \fB.txt\fP |
| 445 | or \fB.html\fP file will be very short. |
| 446 | |
| 447 | .TP |
| 448 | .B |
| 449 | --heap-admin=<number> [default: 8] |
| 450 | The number of admin bytes per block to use. This can only be an |
| 451 | estimate of the average, since it may vary. The allocator used |
| 452 | by \fBglibc\fP requires somewhere between 4 to 15 bytes per block, |
| 453 | depending on various factors. It also requires admin space for freed |
| 454 | blocks, although \fBmassif\fP does not count this. |
| 455 | |
| 456 | .TP |
| 457 | .B |
| 458 | --stacks=<yes|no> [default: yes] |
| 459 | When enabled, include stack(s) in the profile. Threaded programs can |
| 460 | have multiple stacks. |
| 461 | |
| 462 | ." .SH HELGRIND OPTIONS |
| 463 | |
| 464 | ." .TP |
| 465 | ." .B |
| 466 | ." --private-stacks=<yes|no> [default: no] |
| 467 | ." Assume thread stacks are used privately. |
| 468 | |
| 469 | ." .TP |
| 470 | ." .B |
| 471 | ." --show-last-access=<yes|some|no> [default: no] |
| 472 | ." Show location of last word access on error. |
| 473 | |
| 474 | .SH LESS FREQUENTLY USED CORE OPTIONS |
| 475 | |
| 476 | .TP |
| 477 | .B |
| 478 | --alignment=<number> [default: 8] |
| 479 | By default \fBvalgrind\fP's malloc, realloc, etc, return 8-byte aligned |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 480 | addresses. These are suitable for any accesses on most processors. Some |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 481 | programs might however assume that malloc et al return 16- or more |
| 482 | aligned memory. These programs are broken and should be fixed, but if |
| 483 | this is impossible for whatever reason the alignment can be increased |
| 484 | using this parameter. The supplied value must be between 8 and 4096 |
| 485 | inclusive, and must be a power of two. |
| 486 | |
| 487 | .TP |
| 488 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 489 | --pointercheck=<yes|no> [default: yes] |
| 490 | When enabled, enforces client address space limits. If this option is |
| 491 | disabled, the client program has full and unfettered access to the part |
| 492 | of the address space used internally by \fBvalgrind\fP. This can cause |
| 493 | unexplained crashes and false error reports, so it is best left enabled. |
| 494 | |
| 495 | .TP |
| 496 | .B |
| 497 | --run-libc-freeres=<yes|no> [default: yes] |
| 498 | The GNU C library (libc.so), which is used by all programs, may allocate |
| 499 | memory for its own uses. Usually it doesn't bother to free that memory when |
| 500 | the program ends - there would be no point, since the Linux kernel reclaims |
| 501 | all process resources when a process exits anyway, so it would just slow |
| 502 | things down. |
| 503 | |
| 504 | .RS |
| 505 | .PP |
| 506 | The glibc authors realised that this behaviour causes leak checkers, |
| 507 | such as \fBvalgrind\fP, to falsely report leaks in glibc, when a leak |
| 508 | check is done at exit. In order to avoid this, they provided a routine |
| 509 | called __libc_freeres specifically to make glibc release all memory it |
| 510 | has allocated. The MemCheck and AddrCheck tools therefore try and run |
| 511 | __libc_freeres at exit. |
| 512 | |
| 513 | .PP |
| 514 | Unfortunately, in some versions of glibc, __libc_freeres is sufficiently |
| 515 | buggy to cause segmentation faults. This is particularly noticeable on |
| 516 | Red Hat 7.1. So this flag is provided in order to inhibit the run of |
| 517 | __libc_freeres. If your program seems to run fine on \fBvalgrind\fP, but |
| 518 | segfaults at exit, you may find that --run-libc-freeres=no fixes that, |
| 519 | although at the cost of possibly falsely reporting space leaks in libc.so. |
| 520 | .RE |
| 521 | |
| 522 | .TP |
| 523 | .B |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 524 | --weird-hacks=hack1,hack2,\.\.\. |
| 525 | Pass miscellaneous hints to \fBvalgrind\fP which slightly modify the |
| 526 | simulated behaviour in nonstandard or dangerous ways, possibly to help |
| 527 | the simulation of strange features. By default no hacks are enabled. Use |
| 528 | with caution! Currently known hacks are: |
| 529 | |
| 530 | .RS |
| 531 | .TP |
| 532 | .B |
| 533 | - lax-ioctls |
| 534 | If \fBvalgrind\fP encounters an \fBioctl\fP that it doesn't understand, |
| 535 | it normally prints a warning message before continuing. Specifying the |
| 536 | lax-ioctls hack tells \fBvalgrind\fP to be very lax about ioctl handling |
| 537 | and assume that unknown ioctls just behave correctly. |
| 538 | .TP |
| 539 | .B |
| 540 | - ioctl-mmap |
| 541 | Tell \fBvalgrind\fP to search for new memory mappings after an unknown |
| 542 | \fBioctl\fP call. |
| 543 | .RE |
| 544 | |
| 545 | .SH CORE DEBUGGING OPTIONS |
| 546 | |
| 547 | .TP |
| 548 | .B |
njn | 5127298 | 2005-07-25 23:18:44 +0000 | [diff] [blame] | 549 | Valgrind has several debugging options that are mostly of use to developers. Use \fB--help-debug\fB to show them. |
njn | 74e7012 | 2005-03-12 21:02:52 +0000 | [diff] [blame] | 550 | |
| 551 | .SH SEE ALSO |
| 552 | /usr/share/doc/\fBvalgrind\fP/html/manual.html |
| 553 | |
| 554 | .SH AUTHOR |
| 555 | This manpage has been written by Andres Roldan <aroldan@debian.org> |
| 556 | for the Debian Project, but can be used for any other distribution. |
| 557 | Updated, rearranged and expanded by Robert Walsh <rjwalsh@durables.org> |
| 558 | for the 2.4.0 release. |