Linux下C/C++开发辅助工具astyle、cppcheck和valgrind的使用

转自
[url]http://blog.csdn.net/zengzhaohu2012/article/details/49405597[/url]


[align=center][color=red][size=medium][b]一、astyle[/b][/size][/color][/align]
astyle(Artistic Style) is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective‑C, C# and Java programming languages.

[b]1 Linux下的安装使用[/b]
1.1 安装
[url]http://astyle.sourceforge.net/[/url] ,解压、编译、安装;
Ubunut 终端下安装:
sudo apt-get install astyle


1.2 使用
astyle --style=kr -p *.cpp *.h(我司代码规范要求,使用K&R代码风格,操作符两边插入空格)


[b]2 编写shell脚本批量格式化源码[/b]

#! /bin/bash
#批量格式化
for f in $(find . -name '*.c' -or -name '*.cpp' -or -name '*.h' -type f)
do
astyle --style=kr -p $f
done

# 删除.orig文件
for f in $(find . -name '*.orig' -type f)
do
rm $f
done


[b]3 astyle使用帮助[/b]

Artistic Style 2.03
Maintained by: Jim Pattee
Original Author: Tal Davidson

Usage : astyle [options] Source1.cpp Source2.cpp [...]
astyle [options] < Original > Beautified

When indenting a specific file, the resulting indented file RETAINS the
original file-name. The original pre-indented file is renamed, with a
suffix of ".orig" added to the original filename.

Wildcards (* and ?) may be used in the filename.
A 'recursive' option can process directories recursively.

By default, astyle is set up to indent C/C++/C#/Java files, with four
spaces per indent, a maximal indentation of 40 spaces inside continuous
statements, a minimum indentation of eight spaces inside conditional
statements, and NO formatting options.

Option's Format:
----------------
Long options (starting with '--') must be written one at a time.
Short options (starting with '-') may be appended together.
Thus, -bps4 is the same as -b -p -s4.

Default options file:
---------------------
Artistic Style looks for a default options file in the
following order:
1. The contents of the ARTISTIC_STYLE_OPTIONS environment
variable if it exists.
2. The file called .astylerc in the directory pointed to by the
HOME environment variable ( i.e. $HOME/.astylerc ).
3. The file called astylerc in the directory pointed to by the
USERPROFILE environment variable ( i.e. %USERPROFILE%\astylerc ).
If a default options file is found, the options in this file
will be parsed BEFORE the command-line options.
Long options within the default option file may be written without
the preliminary '--'.

Bracket Style Options:
----------------------
--style=allman OR --style=ansi OR --style=bsd
OR --style=break OR -A1
Allman style formatting/indenting.
Broken brackets.

--style=java OR --style=attach OR -A2
Java style formatting/indenting.
Attached brackets.

--style=kr OR --style=k&r OR --style=k/r OR -A3
Kernighan & Ritchie style formatting/indenting.
Linux brackets.

--style=stroustrup OR -A4
Stroustrup style formatting/indenting.
Stroustrup brackets.

--style=whitesmith OR -A5
Whitesmith style formatting/indenting.
Broken, indented brackets.
Indented class blocks and switch blocks.

--style=banner OR -A6
Banner style formatting/indenting.
Attached, indented brackets.
Indented class blocks and switch blocks.

--style=gnu OR -A7
GNU style formatting/indenting.
Broken brackets, indented blocks.

--style=linux OR -A8
Linux style formatting/indenting.
Linux brackets, minimum conditional indent is one-half indent.

--style=horstmann OR -A9
Horstmann style formatting/indenting.
Run-in brackets, indented switches.

--style=1tbs OR --style=otbs OR -A10
One True Brace Style formatting/indenting.
Linux brackets, add brackets to all conditionals.

--style=pico OR -A11
Pico style formatting/indenting.
Run-in opening brackets and attached closing brackets.
Uses keep one line blocks and keep one line statements.

--style=lisp OR -A12
Lisp style formatting/indenting.
Attached opening brackets and attached closing brackets.
Uses keep one line statements.

Tab Options:
------------
default indent option
If no indentation option is set, the default
option of 4 spaces per indent will be used.

--indent=spaces=# OR -s#
Indent using # spaces per indent. Not specifying #
will result in a default of 4 spaces per indent.

--indent=tab OR --indent=tab=# OR -t OR -t#
Indent using tab characters, assuming that each
indent is # spaces long. Not specifying # will result
in a default assumption of 4 spaces per indent.

--indent=force-tab=# OR -T#
Indent using tab characters, assuming that each
indent is # spaces long. Force tabs to be used in areas
AStyle would prefer to use spaces.

--indent=force-tab-x=# OR -xT#
Allows the tab length to be set to a length that is different
from the indent length. This may cause the indentation to be
a mix of both spaces and tabs. This option sets the tab length.

Indentation options:
--------------------
--indent-classes OR -C
Indent 'class' blocks, so that the inner 'public:',
'protected:' and 'private: headers are indented in
relation to the class block.

--indent-switches OR -S
Indent 'switch' blocks, so that the inner 'case XXX:'
headers are indented in relation to the switch block.

--indent-cases OR -K
Indent case blocks from the 'case XXX:' headers.
Case statements not enclosed in blocks are NOT indented.

--indent-namespaces OR -N
Indent the contents of namespace blocks.

--indent-labels OR -L
Indent labels so that they appear one indent less than
the current indentation level, rather than being
flushed completely to the left (which is the default).

--indent-preprocessor OR -w
Indent multi-line #define statements.

--indent-col1-comments OR -Y
Indent line comments that start in column one.

--min-conditional-indent=# OR -m#
Indent a minimal # spaces in a continuous conditional
belonging to a conditional header.
The valid values are:
0 - no minimal indent.
1 - indent at least one additional indent.
2 - indent at least two additional indents.
3 - indent at least one-half an additional indent.
The default value is 2, two additional indents.

--max-instatement-indent=# OR -M#
Indent a maximal # spaces in a continuous statement,
relative to the previous line.
The valid values are 40 thru 120.
The default value is 40.

Padding options:
--------------------
--break-blocks OR -f
Insert empty lines around unrelated blocks, labels, classes, ...

--break-blocks=all OR -F
Like --break-blocks, except also insert empty lines
around closing headers (e.g. 'else', 'catch', ...).

--pad-oper OR -p
Insert space padding around operators.

--pad-paren OR -P
Insert space padding around parenthesis on both the outside
and the inside.

--pad-paren-out OR -d
Insert space padding around parenthesis on the outside only.

--pad-first-paren-out OR -xd
Insert space padding around first parenthesis in a series on
the outside only.

--pad-paren-in OR -D
Insert space padding around parenthesis on the inside only.

--pad-header OR -H
Insert space padding after paren headers (e.g. 'if', 'for'...).

--unpad-paren OR -U
Remove unnecessary space padding around parenthesis. This
can be used in combination with the 'pad' options above.

--delete-empty-lines OR -xd
Delete empty lines within a function or method.
It will NOT delete lines added by the break-blocks options.

--fill-empty-lines OR -E
Fill empty lines with the white space of their
previous lines.

--align-pointer=type OR -k1
--align-pointer=middle OR -k2
--align-pointer=name OR -k3
Attach a pointer or reference operator (*, &, or ^) to either
the operator type (left), middle, or operator name (right).
To align the reference separately use --align-reference.

--align-reference=none OR -W0
--align-reference=type OR -W1
--align-reference=middle OR -W2
--align-reference=name OR -W3
Attach a reference operator (&) to either
the operator type (left), middle, or operator name (right).
If not set, follow pointer alignment.

Formatting options:
-------------------
--break-closing-brackets OR -y
Break brackets before closing headers (e.g. 'else', 'catch', ...).
Use with --brackets=attach, --brackets=linux,
or --brackets=stroustrup.

--break-elseifs OR -e
Break 'else if()' statements into two different lines.

--add-brackets OR -j
Add brackets to unbracketed one line conditional statements.

--add-one-line-brackets OR -J
Add one line brackets to unbracketed one line conditional
statements.

--keep-one-line-blocks OR -O
Don't break blocks residing completely on one line.

--keep-one-line-statements OR -o
Don't break lines containing multiple statements into
multiple single-statement lines.

--convert-tabs OR -c
Convert tabs to the appropriate number of spaces.

--close-templates OR -xy
Close ending angle brackets on template definitions.

--max-code-length=# OR -xC#
--break-after-logical OR -xL
max-code-length=# will break the line if it exceeds more than
# characters. The valid values are 50 thru 200.
If the line contains logical conditionals they will be placed
first on the new line. The option break-after-logical will
cause the logical conditional to be placed last on the
previous line.

--mode=c
Indent a C or C++ source file (this is the default).

--mode=java
Indent a Java source file.

--mode=cs
Indent a C# source file.

Other options:
--------------
--suffix=####
Append the suffix #### instead of '.orig' to original filename.

--suffix=none OR -n
Do not retain a backup of the original file.

--recursive OR -r OR -R
Process subdirectories recursively.

--exclude=####
Specify a file or directory #### to be excluded from processing.

ignore-exclude-errors OR -i
Allow processing to continue if there are errors in the exclude=###
options. It will display the unmatched excludes.

ignore-exclude-errors-x OR -xi
Allow processing to continue if there are errors in the exclude=###
options. It will NOT display the unmatched excludes.

--errors-to-stdout OR -X
Print errors and help information to standard-output rather than
to standard-error.

--preserve-date OR -Z
The date and time modified will not be changed in the formatted file.

--verbose OR -v
Verbose mode. Extra informational messages will be displayed.

--formatted OR -Q
Formatted display mode. Display only the files that have been formatted.

--quiet OR -q
Quiet mode. Suppress all output except error messages.

--lineend=windows OR -z1
--lineend=linux OR -z2
--lineend=macold OR -z3
Force use of the specified line end style. Valid options
are windows (CRLF), linux (LF), and macold (CR).

Command Line Only:
------------------
--options=####
Specify an options file #### to read and use.

--options=none
Disable the default options file.
Only the command-line parameters will be used.

--ascii OR -I
The displayed output will be ascii characters only.

--version OR -V
Print version number.

--help OR -h OR -?
Print this help message.



[align=center][size=medium][color=red][b]二、cppcheck[/b][/color][/size][/align]
Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools, it doesn't detect syntax errors. Cppcheck only detects the types of bugs that the compilers normally fail to detect. The goal is no false positives.

[b]1 Linux下安装使用[/b]
1.1 安装
[url]http://sourceforge.net/projects/cppcheck/files/cppcheck/[/url],解压、编译、安装;
还可以用git获取项目源码:
git clone git://github.com/danmar/cppcheck.git

Ubunut 终端下安装:
sudo apt-get install cppcheck


[b]1.2 使用[/b]

cppcheck -j 3 ~/Project (开启3个线程去检查Project目录下的源码,默认的-- enable==error);
cppcheck -j 3 --enable=all ~/Project ;
cppcheck -j 3 --enable=all --xml 2>err.xml ./ (生成检测报告)。


[b]2 cppcheck使用帮助[/b]
参考资料:
[url]https://en.wikipedia.org/wiki/Cppcheck[/url]
[url]http://sourceforge.net/p/cppcheck/wiki/Home/[/url]
h[url]ttp://blog.csdn.net/yzlworld/article/details/29572051[/url]



Cppcheck - A tool for static C/C++ code analysis

Syntax:
cppcheck [OPTIONS] [files or paths]

If a directory is given instead of a filename, *.cpp, *.cxx, *.cc, *.c++, *.c,
*.tpp, and *.txx files are checked recursively from the given directory.

Options:
--append=<file> This allows you to provide information about functions
by providing an implementation for them.
--check-config Check cppcheck configuration. The normal code
analysis is disabled by this flag.
--check-library Show information messages when library files have
incomplete info.
-D<ID> Define preprocessor symbol. Unless --max-configs or
--force is used, Cppcheck will only check the given
configuration when -D is used.
Example: '-DDEBUG=1 -D__cplusplus'.
-U<ID> Undefine preprocessor symbol. Use -U to explicitly
hide certain #ifdef <ID> code paths from checking.
Example: '-UDEBUG'
--enable=<id> Enable additional checks. The available ids are:
* all
Enable all checks. It is recommended to only
use --enable=all when the whole program is
scanned, because this enables unusedFunction.
* warning
Enable warning messages
* style
Enable all coding style checks. All messages
with the severities 'style', 'performance' and
'portability' are enabled.
* performance
Enable performance messages
* portability
Enable portability messages
* information
Enable information messages
* unusedFunction
Check for unused functions. It is recommend
to only enable this when the whole program is
scanned.
* missingInclude
Warn if there are missing includes. For
detailed information, use '--check-config'.
Several ids can be given if you separate them with
commas. See also --std
--error-exitcode=<n> If errors are found, integer [n] is returned instead of
the default '0'. '1' is returned
if arguments are not valid or if no input files are
provided. Note that your operating system can modify
this value, e.g. '256' can become '0'.
--errorlist Print a list of all the error messages in XML format.
--exitcode-suppressions=<file>
Used when certain messages should be displayed but
should not cause a non-zero exitcode.
--file-list=<file> Specify the files to check in a text file. Add one
filename per line. When file is '-,' the file list will
be read from standard input.
-f, --force Force checking of all configurations in files. If used
together with '--max-configs=', the last option is the
one that is effective.
-h, --help Print this help.
-I <dir> Give path to search for include files. Give several -I
parameters to give several paths. First given path is
searched for contained header files first. If paths are
relative to source files, this is not needed.
--includes-file=<file>
Specify directory paths to search for included header
files in a text file. Add one include path per line.
First given path is searched for contained header
files first. If paths are relative to source files,
this is not needed.
--include=<file>
Force inclusion of a file before the checked file. Can
be used for example when checking the Linux kernel,
where autoconf.h needs to be included for every file
compiled. Works the same way as the GCC -include
option.
-i <dir or file> Give a source file or source file directory to exclude
from the check. This applies only to source files so
header files included by source files are not matched.
Directory name is matched to all parts of the path.
--inconclusive Allow that Cppcheck reports even though the analysis is
inconclusive.
There are false positives with this option. Each result
must be carefully investigated before you know if it is
good or bad.
--inline-suppr Enable inline suppressions. Use them by placing one or
more comments, like: '// cppcheck-suppress warningId'
on the lines before the warning to suppress.
-j <jobs> Start [jobs] threads to do the checking simultaneously.
--language=<language>, -x <language>
Forces cppcheck to check all files as the given
language. Valid values are: c, c++
--library=<cfg>
Use library configuration.
--max-configs=<limit>
Maximum number of configurations to check in a file
before skipping it. Default is '12'. If used together
with '--force', the last option is the one that is
effective.
--platform=<type> Specifies platform specific types and sizes. The
available platforms are:
* unix32
32 bit unix variant
* unix64
64 bit unix variant
* win32A
32 bit Windows ASCII character encoding
* win32W
32 bit Windows UNICODE character encoding
* win64
64 bit Windows
-q, --quiet Only print error messages.
-rp, --relative-paths
-rp=<paths>, --relative-paths=<paths>
Use relative paths in output. When given, <paths> are
used as base. You can separate multiple paths by ';'.
Otherwise path where source files are searched is used.
We use string comparison to create relative paths, so
using e.g. ~ for home folder does not work. It is
currently only possible to apply the base paths to
files that are on a lower level in the directory tree.
--report-progress Report progress messages while checking a file.
--rule=<rule> Match regular expression.
--rule-file=<file> Use given rule file. For more information, see:
https://sourceforge.net/projects/cppcheck/files/Articles/
--std=<id> Set standard.
The available options are:
* posix
POSIX compatible code
* c89
C code is C89 compatible
* c99
C code is C99 compatible
* c11
C code is C11 compatible (default)
* c++03
C++ code is C++03 compatible
* c++11
C++ code is C++11 compatible (default)
More than one --std can be used:
'cppcheck --std=c99 --std=posix file.c'
--suppress=<spec> Suppress warnings that match <spec>. The format of
<spec> is:
[error id]:[filename]:[line]
The [filename] and [line] are optional. If [error id]
is a wildcard '*', all error ids match.
--suppressions-list=<file>
Suppress warnings listed in the file. Each suppression
is in the same format as <spec> above.
--template='<text>' Format the error messages. E.g.
'{file}:{line},{severity},{id},{message}' or
'{file}({line}):({severity}) {message}' or
'{callstack} {message}'
Pre-defined templates: gcc, vs, edit.
-v, --verbose Output more detailed error information.
--version Print out version number.
--xml Write results in xml format to error stream (stderr).
--xml-version=<version>
Select the XML file version. Currently versions 1 and
2 are available. The default version is 1.
Example usage:
# Recursively check the current folder. Print the progress on the screen and
# write errors to a file:
cppcheck . 2> err.txt

# Recursively check ../myproject/ and don't print progress:
cppcheck --quiet ../myproject/

# Check test.cpp, enable all checks:
cppcheck --enable=all --inconclusive --std=posix test.cpp

# Check f.cpp and search include files from inc1/ and inc2/:
cppcheck -I inc1/ -I inc2/ f.cpp

For more information:
http://cppcheck.sourceforge.net/manual.pdf



[align=center][size=medium][color=red][b]三、valgrind[/b][/color][/size][/align]
Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools.

[b]1 Linux下的安装使用[/b]

[b]1.1 安装[/b]
[url]http://www.valgrind.org/downloads/current.html#current[/url] ,下载,解压,编译,安装;
ubuntu终端下安装:
sudo apt-get install valgrind


[b]1.2 使用[/b]
内存错误的检查:
valgrind --tool=memcheck --leak-check=full ./a.out 

多线程错误的检查:
valgrind --tool=helgrind ./thread.out


[b]2 valgrind相关参考及帮助[/b]
[url]https://wiki.ubuntu.com/Valgrind[/url]
[url]http://blog.csdn.net/sduliulun/article/details/7732906[/url]
[url]http://www.oschina.net/translate/valgrind-memcheck[/url]

多线程分析:
[url]http://www.th7.cn/Program/cp/201408/267519.shtml[/url]
[url]http://www.tuicool.com/articles/nUZJBb2[/url]

usage: valgrind [options] prog-and-args

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

basic user options for all Valgrind tools, with defaults in [ ]:
-h --help show this message
--help-debug show this message, plus debugging options
--version show version
-q --quiet run silently; only print error msgs
-v --verbose be more verbose -- show misc extra info
--trace-children=no|yes Valgrind-ise child processes (follow execve)? [no]
--trace-children-skip=patt1,patt2,... specifies a list of executables
that --trace-children=yes should not trace into
--trace-children-skip-by-arg=patt1,patt2,... same as --trace-children-skip=
but check the argv[] entries for children, rather
than the exe name, to make a follow/no-follow decision
--child-silent-after-fork=no|yes omit child output between fork & exec? [no]
--vgdb=no|yes|full activate gdbserver? [yes]
full is slower but provides precise watchpoint/step
--vgdb-error=<number> invoke gdbserver after <number> errors [999999999]
to get started quickly, use --vgdb-error=0
and follow the on-screen directions
--track-fds=no|yes track open file descriptors? [no]
--time-stamp=no|yes add timestamps to log messages? [no]
--log-fd=<number> log messages to file descriptor [2=stderr]
--log-file=<file> log messages to <file>
--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=<number> XML output to file descriptor
--xml-file=<file> XML output to <file>
--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=<number> show <number> callers in stack traces [12]
--error-limit=no|yes stop showing new errors if too many? [yes]
--error-exitcode=<number> exit code to return if errors found [0=disable]
--show-below-main=no|yes continue stack traces below main() [no]
--suppressions=<filename> suppress errors described in <filename>
--gen-suppressions=no|yes|all print suppressions for errors? [no]
--db-attach=no|yes start debugger when errors detected? [no]
--db-command=<command> command to start debugger [/usr/bin/gdb -nw %f %p]
--input-fd=<number> file descriptor for input [0=stdin]
--dsymutil=no|yes run dsymutil on Mac OS X when helpful? [no]
--max-stackframe=<number> assume stack switch for SP changes larger
than <number> bytes [2000000]
--main-stacksize=<number> 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=<number> set minimum alignment of heap allocations [16]
--redzone-size=<number> set minimum size of redzones added before/after
heap blocks (in bytes). [16]

uncommon user options for all Valgrind tools:
--fullpath-after= (with nothing after the '=')
show full source paths in call stacks
--fullpath-after=string like --fullpath-after=, but only show the
part of the path after 'string'. Allows removal
of path prefixes. Use this flag multiple times
to specify a set of prefixes to remove.
--extra-debuginfo-path=path absolute path to search for additional
debug symbols, in addition to existing default
well known search paths.
--debuginfo-server=ipaddr:port also query this server
(valgrind-di-server) for debug symbols
--allow-mismatched-debuginfo=no|yes [no]
for the above two flags only, accept debuginfo
objects that don't "match" the main object
--smc-check=none|stack|all|all-non-file [stack]
checks for self-modifying code: none, only for
code found in stacks, for all code, or for all
code except that from file-backed mappings
--read-var-info=yes|no read debug info on stack and global variables
and use it to print better error messages in
tools that make use of it (Memcheck, Helgrind,
DRD) [no]
--vgdb-poll=<number> gdbserver poll max every <number> basic blocks [5000]
--vgdb-shadow-registers=no|yes let gdb see the shadow registers [no]
--vgdb-prefix=<prefix> prefix for vgdb FIFOs [/tmp/vgdb-pipe]
--run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]
--sim-hints=hint1,hint2,... known hints:
lax-ioctls, enable-outer, fuse-compatible [none]
--fair-sched=no|yes|try schedule threads fairly on multicore systems [no]
--kernel-variant=variant1,variant2,... known variants: bproc [none]
handle non-standard kernel variants
--merge-recursive-frames=<number> merge frames between identical
program counters in max <number> frames) [0]
--num-transtab-sectors=<number> size of translated code cache [16]
more sectors may increase performance, but use more memory.
--show-emwarns=no|yes show warnings about emulation limits? [no]
--require-text-symbol=:sonamepattern:symbolpattern abort run if the
stated shared object doesn't have the stated
text symbol. Patterns can contain ? and *.
--soname-synonyms=syn1=pattern1,syn2=pattern2,... synonym soname
specify patterns for function wrapping or replacement.
To use a non-libc malloc library that is
in the main exe: --soname-synonyms=somalloc=NONE
in libxyzzy.so: --soname-synonyms=somalloc=libxyzzy.so
--sigill-diagnostics=yes|no warn about illegal instructions? [yes]
--unw-stack-scan-thresh=<number> Enable stack-scan unwind if fewer
than <number> good frames found [0, meaning "disabled"]
NOTE: stack scanning is only available on arm-linux.
--unw-stack-scan-frames=<number> Max number of frames that can be
recovered by stack scanning [5]

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-leak-kinds=kind1,kind2,.. which leak kinds to show?
[definite,possible]
--errors-for-leak-kinds=kind1,kind2,.. which leak kinds are errors?
[definite,possible]
where kind is one of definite indirect possible reachable all none
--leak-check-heuristics=heur1,heur2,... which heuristics to use for
improving leak search false positive [none]
where heur is one of stdstring newarray multipleinheritance all none
--show-reachable=yes same as --show-leak-kinds=all
--show-reachable=no --show-possibly-lost=yes
same as --show-leak-kinds=definite,possible
--show-reachable=no --show-possibly-lost=no
same as --show-leak-kinds=definite
--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 [no]
--freelist-vol=<number> volume of freed blocks queue [20000000]
--freelist-big-blocks=<number> releases first blocks with size>= [1000000]
--workaround-gcc296-bugs=no|yes self explanatory [no]
--ignore-ranges=0xPP-0xQQ[,0xRR-0xSS] assume given addresses are OK
--malloc-fill=<hexnumber> fill malloc'd areas with given value
--free-fill=<hexnumber> 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-then-free]

Extra options read from ~/.valgrindrc, $VALGRIND_OPTS, ./.valgrindrc

Memcheck is Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
Valgrind is Copyright (C) 2000-2013, and GNU GPL'd, by Julian Seward et al.
LibVEX is Copyright (C) 2004-2013, and GNU GPL'd, by OpenWorks LLP et al.

Bug reports, feedback, admiration, abuse, etc, to: www.valgrind.org.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值