valgrind

usage: valgrind [options] prog-and-args

tool-selection option, with default in [ ]:
--tool= use the Valgrind tool named [memcheck]

basic user options for all Valgrind tools, with defaults in [ ]:
-h --help 显示帮助信息
--version show version
-q --quiet run silently; only print error msgs
-v --verbose be more verbose -- show misc extra info
--trace-children=no|yes 跟踪子线程? [no]
--vgdb=no|yes|full activate gdbserver? [yes]
full is slower but provides precise watchpoint/step
--vgdb-error= invoke gdbserver after errors [999999999]
to get started quickly, use --vgdb-error=0
and follow the on-screen directions
--vgdb-stop-at=event1,event2,... invoke gdbserver for given events [none]
where event is one of:
startup exit valgrindabexit all none
--track-fds=no|yes track open file descriptors? [no]
--time-stamp=no|yes add timestamps to log messages? [no]
--log-fd= log messages to file descriptor [2=stderr]
--log-file= log messages to
--log-socket=ipaddr:port log messages to socket ipaddr:port

user options for Valgrind tools that report errors:
--xml=yes emit error output in XML (some tools only)
--xml-fd= XML output to file descriptor
--xml-file= XML output to
--xml-socket=ipaddr:port XML output to socket ipaddr:port
--xml-user-comment=STR copy STR verbatim into XML output
--demangle=no|yes automatically demangle C++ names? [yes]
--num-callers= show callers in stack traces [12]
--error-limit=no|yes stop showing new errors if too many? [yes]
--exit-on-first-error=no|yes exit code on the first error found? [no]
--error-exitcode= exit code to return if errors found [0=disable]
--error-markers=, add lines with begin/end markers before/after
each error output in plain text mode [none]
--show-error-list=no|yes show detected errors list and
suppression counts at exit [no]
-s same as --show-error-list=yes
--keep-debuginfo=no|yes Keep symbols etc for unloaded code [no]
This allows saved stack traces (e.g. memory leaks)
to include file/line info for code that has been
dlclose'd (or similar)
--show-below-main=no|yes continue stack traces below main() [no]
--default-suppressions=yes|no
load default suppressions [yes]
--suppressions= suppress errors described in
--gen-suppressions=no|yes|all print suppressions for errors? [no]
--input-fd= file descriptor for input [0=stdin]
--dsymutil=no|yes run dsymutil on Mac OS X when helpful? [yes]
--max-stackframe= assume stack switch for SP changes larger
than bytes [2000000]
--main-stacksize= set size of main thread's stack (in bytes)
[min(max(current 'ulimit' value,1MB),16MB)]

user options for Valgrind tools that replace malloc:
--alignment= set minimum alignment of heap allocations [16]
--redzone-size= set minimum size of redzones added before/after
heap blocks (in bytes). [16]
--xtree-memory=none|allocs|full profile heap memory in an xtree [none]
and produces a report at the end of the execution
none: no profiling, allocs: current allocated
size/blocks, full: profile current and cumulative
allocated size/blocks and freed size/blocks.
--xtree-memory-file= xtree memory report file [xtmemory.kcg.%p]

user options for Memcheck:
--leak-check=no|summary|full search for memory leaks at exit? [summary]
--leak-resolution=low|med|high differentiation of leak stack traces [high]
--show-reachable=yes same as --show-leak-kinds=all
--xtree-leak=no|yes output leak result in xtree format? [no]
--xtree-leak-file= xtree leak report file [xtleak.kcg.%p]
--undef-value-errors=no|yes check for undefined value errors [yes]
--track-origins=no|yes show origins of undefined values? [no]
--partial-loads-ok=no|yes too hard to explain here; see manual [yes]
--expensive-definedness-checks=no|auto|yes
Use extra-precise definedness tracking [auto]
--freelist-vol= volume of freed blocks queue [20000000]
--freelist-big-blocks= releases first blocks with size>= [1000000]
--workaround-gcc296-bugs=no|yes self explanatory [no]. Deprecated.
Use --ignore-range-below-sp instead.
--ignore-ranges=0xPP-0xQQ[,0xRR-0xSS] assume given addresses are OK
--ignore-range-below-sp=- do not report errors for
accesses at the given offsets below SP
--malloc-fill= fill malloc'd areas with given value
--free-fill= fill free'd areas with given value
--keep-stacktraces=alloc|free|alloc-and-free|alloc-then-free|none
stack trace(s) to keep for malloc'd/free'd areas [alloc-and-free]
--show-mismatched-frees=no|yes show frees that don't match the allocator? [yes]

原文地址:https://www.cnblogs.com/jie828/p/11425149.html