`

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

 
阅读更多
转自
http://blog.csdn.net/zengzhaohu2012/article/details/49405597


一、astyle

    astyle(Artistic Style) is a source code indenter, formatter, and beautifier for the C, C++, C++/CLI, Objective‑C, C# and Java programming languages.

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


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


    2 编写shell脚本批量格式化源码
#! /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


     3 astyle使用帮助
                           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.



二、cppcheck

    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.

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

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


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


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


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



三、valgrind

    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.

    1 Linux下的安装使用

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


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

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


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

    多线程分析:
    http://www.th7.cn/Program/cp/201408/267519.shtml
    http://www.tuicool.com/articles/nUZJBb2
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.
分享到:
评论

相关推荐

    C/C++/Java代码缩进美化工具astyle-1.24

    "Astyle-1.24" 是一个专为C/C++/Java语言设计的代码格式化和美化工具。它可以帮助程序员统一代码风格,使得代码更易读、更美观,提升代码质量。 **描述详解:** 该工具名为Artistic Style(简称AStyle),版本号为...

    C/C++/Java代码缩进美化工具astyle-2.03

    无论是个人编程习惯的养成,还是团队协作的规范要求,AStyle都能有效提升代码质量和开发效率,是编程工作中不可或缺的辅助工具。通过熟练掌握AStyle的使用,开发者可以更专注于代码逻辑,而非格式细节,从而提高整体...

    linux下astyle安装包和使用说明

    Astyle是一款强大的代码格式化工具,尤其适用于C、C++和Clang编程语言。它可以帮助开发者统一代码风格,提高代码可读性和维护性。以下是Astyle在Linux环境下的安装和使用方法。 ### 一、下载Astyle 首先,你需要从...

    DEVC++5.11 含Astyle

    这款IDE(集成开发环境)以其易于使用和灵活性而受到欢迎,特别是在教学环境中。DEVC++ 5.11 版本引入了Astyle自动排版功能,这是一项重要的代码美化工具,对于提升代码可读性和遵循特定编码风格具有重要意义。 ...

    DEV C++.zip 资源下载 适合C/C++初学者

    Dev-C++(或者叫做 Dev-Cpp)是 Windows 环境下的一个轻量级(适合C/C++初学者) C/C++ 集成开发环境(IDE)。它是一款自由软件,遵守GPL许可协议分发源代码。它集合了功能强大的源码编辑器、MingW64/TDM-GCC 编译器...

    Code_Blocks目前史上最好的C_C++软件开发IDE(跨平台)

    Code::Blocks 是一个开放源码的全功能的跨平台 C/C++ 集成开发环境,支持 Windows、GNU/Linux、Mac OS X 以及其他类 UNIX 平台。它具有灵活而强大的配置功能,支持多种语言和文件类型,包括 C/C++、AngelScript、...

    (免费下载)Dev-C++ 6.5 安装包 - C++/C语言/编辑器

    Dev-C++(别名 Dev-Cpp)是 Windows 环境下的一个轻量级 C / C++ 集成开发环境(IDE)。它是自由软件,遵守 GPL 许可协议分发源代码。集合了功能强大的源码编辑器、MingW64 / TDM-GCC 编译器、GDB 调试器和 AStyle ...

    (免费下载)Dev-C++ 5.9.2 安装包 - C++/C语言/编辑器

    Dev-C++(别名 Dev-Cpp)是 Windows 环境下的一个轻量级 C / C++ 集成开发环境(IDE)。它是自由软件,遵守 GPL 许可协议分发源代码。集合了功能强大的源码编辑器、MingW64 / TDM-GCC 编译器、GDB 调试器和 AStyle ...

    AStyle C/C++/C#/Java源代码格式化 1.0

    基于最新版的AStyle(最好的源代码格式化)制作的源代码格式化工具,支持C、C++、C#、Java。使用方便,操作简单,界面还可以选择皮肤,单文件也能执行,支持源代码批量格式化和多级目录格式化,也可以忽略扩展名,...

    emacs config for C/C++

    "emacs config for C/C++"是指针对C和C++编程的特定配置,旨在优化Emacs用于这两种语言的开发环境。在Emacs中,配置通常通过.lisp文件实现,用户可以通过定制编辑器的行为来满足个人喜好和提高效率。 首先,配置...

    c语言编译器及工具软件

    astyle.exe: C语言的缩进美化工具,在cmd命令窗口下运行,可将杂乱的C语言源程序缩进美化。 直接拷贝到c:\windows\system32下即可在cmd命令窗口下调用 /////////// Source.Insight.v3.50.0070-20120620.rar:C语言...

    Astyle/sourceinsight

    AStyle 是一个开源的源代码格式化、美化和整理工具,专门针对 C/C++ 语言。Source Insight 是一款流行的源代码查看、编辑和分析工具,尤其适合程序员在开发过程中快速浏览、理解和修改代码。 **描述详解:** 描述...

    Dev-C++(或者叫做Dev-Cpp)

    Dev-C++(或者叫做Dev-Cpp)是Windows环境下的一个轻量级C/C++集成开发环境(IDE)。它是一款自由软件,遵守GPL许可协议分发源代码。 Dev-C++集合了功能强大的源码编辑器、MingW64/TDM-GCC编译器、GDB调试器和AStyle...

    astyle自动整理c,c++,java源代码格式命令行工具源代码

    `astyle`是一款非常实用的源代码格式化工具,它支持C、C++以及Java等编程语言。这个工具主要用于统一代码风格,使得代码更易于阅读和维护,尤其在团队合作或者开源项目中,代码风格的一致性至关重要。下面将详细介绍...

    DeV-c++/dev-c.rar

    Dev-C++是一个Windows环境下的一个适合于初学者使用的轻量级 C/C++ 集成开发环境(IDE)。它是一款自由软件,遵守GPL许可协议分发源代码。它集合了MinGW中的GCC编译器、GDB调试器和 AStyle格式整理器等众多自由软件...

    keil自动排版工具AStyle.zip

    首先,AStyle全称为Artistic Style,是一款开源的源代码格式化、美化工具,支持C、C++、Objective-C、C++/CLI、Fortran和Perl等语言。它能够按照预设的规则,对代码进行缩进调整、空格处理、括号对齐等操作,使得...

    Astyle2.05 Linux版本

    Astyle,全称为Artistic Style,是一款开源、跨平台的代码格式化工具,主要用于C、C++、C#和Java等编程语言的源代码进行自动格式化。Astyle 2.05是其在Linux平台上的一个版本,该版本经过验证,确保在Linux环境中...

    C代码格式化工具:AStyle_3.0.1_windows

    Eclipse CDT是Eclipse平台下的C/C++开发工具,它为开发者提供了丰富的功能,包括代码编辑、调试、构建等。AStyle作为Eclipse CDT的插件,可以使代码格式化工作无缝集成到开发流程中,只需简单点击即可对选定的代码块...

    dev Mac版,Windows也可以解压

    它集合了功能强大的源码编辑器、MingW64/TDM-GCC 编译器、GDB 调试器和 AStyle 格式整理器等众多自由软件,适合于在教学中供 C/C++语言初学者使用,也适合于非商业级普通开发者使用。Dev-C++是一个Windows环境下的一...

    Dev-Cpp-5.16d.exe

    它集成了 SynEdit 源码编辑器、MinGW-w64 编译器、GDB 调试器和 AStyle 格式整理器等众多自由软件,非常适合于在教学中供 C/C++语言初学者使用,也适合于非商业级普通开发者使用。 原作者 Bloodshed 和 Orwell 已...

Global site tag (gtag.js) - Google Analytics