{
    "content": [
        {
            "type": "text",
            "text": "# ltrace (man)\n\n## NAME\n\nltrace - A library call tracer\n\n## SYNOPSIS\n\nltrace  [-e filter|-L] [-l|--library=librarypattern] [-x filter] [-S] [-b|--no-signals] [-i]\n[-w|--where=nr] [-r|-t|-tt|-ttt] [-T] [-F filename] [-A maxelts] [-s strsize] [-C|--demangle]\n[-a|--align  column]  [-n|--indent nr] [-o|--output filename] [-D|--debug mask] [-u username]\n[-f] [-p pid] [[--] command [arg ...]]\nltrace -c [-e filter|-L] [-l|--library=librarypattern] [-x filter] [-S]  [-o|--output  file‐\nname] [-f] [-p pid] [[--] command [arg ...]]\nltrace -V|--version\nltrace -h|--help\n\n## DESCRIPTION\n\nltrace is a program that simply runs the specified command until it exits.  It intercepts and\nrecords the dynamic library calls which are called by the executed process  and  the  signals\nwhich  are  received  by that process.  It can also intercept and print the system calls exe‐\ncuted by the program.\n\n## TLDR\n\n> Display dynamic library calls of a process.\n\n- Print (trace) library calls of a program binary:\n  `ltrace {{path/to/program}}`\n- Count library calls. Print a handy summary at the bottom:\n  `ltrace -c {{path/to/program}}`\n- Trace calls to malloc and free, omit those done by libc:\n  `ltrace -e malloc+free-@libc.so* {{path/to/program}}`\n- Write to file instead of terminal:\n  `ltrace {{-o|--output}} {{file}} {{path/to/program}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (4 subsections)\n- **FILTER EXPRESSIONS**\n- **BUGS**\n- **FILES**\n- **AUTHOR**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ltrace",
        "section": "",
        "mode": "man",
        "summary": "ltrace - A library call tracer",
        "synopsis": "ltrace  [-e filter|-L] [-l|--library=librarypattern] [-x filter] [-S] [-b|--no-signals] [-i]\n[-w|--where=nr] [-r|-t|-tt|-ttt] [-T] [-F filename] [-A maxelts] [-s strsize] [-C|--demangle]\n[-a|--align  column]  [-n|--indent nr] [-o|--output filename] [-D|--debug mask] [-u username]\n[-f] [-p pid] [[--] command [arg ...]]\nltrace -c [-e filter|-L] [-l|--library=librarypattern] [-x filter] [-S]  [-o|--output  file‐\nname] [-f] [-p pid] [[--] command [arg ...]]\nltrace -V|--version\nltrace -h|--help",
        "tldr_summary": "Display dynamic library calls of a process.",
        "tldr_examples": [
            {
                "description": "Print (trace) library calls of a program binary",
                "command": "ltrace {{path/to/program}}"
            },
            {
                "description": "Count library calls. Print a handy summary at the bottom",
                "command": "ltrace -c {{path/to/program}}"
            },
            {
                "description": "Trace calls to malloc and free, omit those done by libc",
                "command": "ltrace -e malloc+free-@libc.so* {{path/to/program}}"
            },
            {
                "description": "Write to file instead of terminal",
                "command": "ltrace {{-o|--output}} {{file}} {{path/to/program}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": "--no-signals",
                "arg": null,
                "description": "Disable printing of signals recieved by the traced process. -c Count time and calls for each library call and report a summary on program exit."
            },
            {
                "flag": "-C",
                "long": "--demangle",
                "arg": null,
                "description": "Decode (demangle) low-level symbol names into user-level names. Besides removing any initial underscore prefix used by the system, this makes C++ function names readable. -D, --debug mask Show debugging output of ltrace itself. mask is a number with internal meaning that's not really well defined at all. mask of 77 shows all debug messages, which is what you usually need. -e filter A qualifying expression which modifies which library calls to trace. The format of the filter expression is described in the section FILTER EXPRESSIONS. If more than one -e option appears on the command line, the library calls that match any of them are traced. If no -e is given, @MAIN is assumed as a default. -f Trace child processes as they are created by currently traced processes as a result of the fork(2) or clone(2) system calls. The new process is attached immediately. -F filename Load an alternate config file. Normally, /etc/ltrace.conf and ~/.ltrace.conf will be read (the latter only if it exists). Use this option to load the given file or files instead of those two default files. See ltrace.conf(5) for details on the syntax of ltrace configuration files."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Show a summary of the options to ltrace and exit. -i Print the instruction pointer at the time of the library call. -l, --library librarypattern Display only calls to functions implemented by libraries that match librarypattern. Multiple library patters can be specified with several instances of this option. Syn‐ tax of librarypattern is described in section FILTER EXPRESSIONS. Note that while this option selects calls that might be directed to the selected li‐ braries, there's no actual guarantee that the call won't be directed elsewhere due to e.g. LDPRELOAD or simply dependency ordering. If you want to make sure that symbols in given library are actually called, use -x @librarypattern instead. -L When no -e option is given, don't assume the default action of @MAIN. -n, --indent nr Indent trace output by nr spaces for each level of call nesting. Using this option makes the program flow visualization easy to follow. This indents uselessly also functions that never return, such as service functions for throwing exceptions in the C++ runtime. -o, --output filename Write the trace output to the file filename rather than to stderr. -p pid Attach to the process with the process ID pid and begin tracing. This option can be used together with passing a command to execute. It is possible to attach to several processes by passing more than one option -p. -r Print a relative timestamp with each line of the trace. This records the time differ‐ ence between the beginning of successive lines. -s strsize Specify the maximum string size to print (the default is 32). -S Display system calls as well as library calls -t Prefix each line of the trace with the time of day. -tt If given twice, the time printed will include the microseconds. -ttt If given thrice, the time printed will include the microseconds and the leading por‐ tion will be printed as the number of seconds since the epoch. -T Show the time spent inside each call. This records the time difference between the beginning and the end of each call. -u username Run command with the userid, groupid and supplementary groups of username. This op‐ tion is only useful when running as root and enables the correct execution of setuid and/or setgid binaries. -w, --where nr Show backtrace of nr stack frames for each traced function. This option enabled only if libunwind support was enabled at compile time. -x filter A qualifying expression which modifies which symbol table entry points to trace. The format of the filter expression is described in the section FILTER EXPRESSIONS. If more than one -x option appears on the command line, the symbols that match any of them are traced. No entry points are traced if no -x is given."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Show the version number of ltrace and exit."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "ltrace.conf",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/ltrace.conf/5/json"
            },
            {
                "name": "strace",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/strace/1/json"
            },
            {
                "name": "ptrace",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/ptrace/2/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 7,
                "subsections": [
                    {
                        "name": "-b, --no-signals",
                        "lines": 4,
                        "flag": "-b",
                        "long": "--no-signals"
                    },
                    {
                        "name": "-C, --demangle",
                        "lines": 23,
                        "flag": "-C",
                        "long": "--demangle"
                    },
                    {
                        "name": "-h, --help",
                        "lines": 62,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V, --version",
                        "lines": 3,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "FILTER EXPRESSIONS",
                "lines": 43,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ltrace - A library call tracer\n\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ltrace  [-e filter|-L] [-l|--library=librarypattern] [-x filter] [-S] [-b|--no-signals] [-i]\n[-w|--where=nr] [-r|-t|-tt|-ttt] [-T] [-F filename] [-A maxelts] [-s strsize] [-C|--demangle]\n[-a|--align  column]  [-n|--indent nr] [-o|--output filename] [-D|--debug mask] [-u username]\n[-f] [-p pid] [[--] command [arg ...]]\n\nltrace -c [-e filter|-L] [-l|--library=librarypattern] [-x filter] [-S]  [-o|--output  file‐\nname] [-f] [-p pid] [[--] command [arg ...]]\n\nltrace -V|--version\n\nltrace -h|--help\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "ltrace is a program that simply runs the specified command until it exits.  It intercepts and\nrecords the dynamic library calls which are called by the executed process  and  the  signals\nwhich  are  received  by that process.  It can also intercept and print the system calls exe‐\ncuted by the program.\n\nIts use is very similar to strace(1).\n\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "-a, --align column\nAlign return values in a specific column (default column is 5/8 of screen width).\n\n-A maxelts\nMaximum number of array elements to print before suppressing the rest with an ellipsis\n(\"...\").  This also limits number of recursive structure expansions.\n",
                "subsections": [
                    {
                        "name": "-b, --no-signals",
                        "content": "Disable printing of signals recieved by the traced process.\n\n-c     Count time and calls for each library call and report a summary on program exit.\n",
                        "flag": "-b",
                        "long": "--no-signals"
                    },
                    {
                        "name": "-C, --demangle",
                        "content": "Decode  (demangle) low-level symbol names into user-level names.  Besides removing any\ninitial underscore prefix used by the system, this makes C++ function names readable.\n\n-D, --debug mask\nShow debugging output of ltrace itself.  mask is a number with internal meaning that's\nnot  really  well  defined at all.  mask of 77 shows all debug messages, which is what\nyou usually need.\n\n-e filter\nA qualifying expression which modifies which library calls to trace.   The  format  of\nthe  filter  expression  is described in the section FILTER EXPRESSIONS.  If more than\none -e option appears on the command line, the library calls that match  any  of  them\nare traced.  If no -e is given, @MAIN is assumed as a default.\n\n-f     Trace child processes as they are created by currently traced processes as a result of\nthe fork(2) or clone(2) system calls.  The new process is attached immediately.\n\n-F filename\nLoad an alternate config file. Normally, /etc/ltrace.conf and ~/.ltrace.conf  will  be\nread  (the latter only if it exists).  Use this option to load the given file or files\ninstead of those two default files.  See ltrace.conf(5) for details on the  syntax  of\nltrace configuration files.\n",
                        "flag": "-C",
                        "long": "--demangle"
                    },
                    {
                        "name": "-h, --help",
                        "content": "Show a summary of the options to ltrace and exit.\n\n-i     Print the instruction pointer at the time of the library call.\n\n-l, --library librarypattern\nDisplay  only  calls to functions implemented by libraries that match librarypattern.\nMultiple library patters can be specified with several instances of this option.  Syn‐\ntax of librarypattern is described in section FILTER EXPRESSIONS.\n\nNote  that  while this option selects calls that might be directed to the selected li‐\nbraries, there's no actual guarantee that the call won't be directed elsewhere due  to\ne.g.  LDPRELOAD or simply dependency ordering.  If you want to make sure that symbols\nin given library are actually called, use -x @librarypattern instead.\n\n-L     When no -e option is given, don't assume the default action of @MAIN.\n\n-n, --indent nr\nIndent trace output by nr spaces for each level of call  nesting.  Using  this  option\nmakes  the  program  flow  visualization  easy to follow.  This indents uselessly also\nfunctions that never return, such as service functions for throwing exceptions in  the\nC++ runtime.\n\n-o, --output filename\nWrite the trace output to the file filename rather than to stderr.\n\n-p pid Attach  to  the process with the process ID pid and begin tracing.  This option can be\nused together with passing a command to execute.  It is possible to attach to  several\nprocesses by passing more than one option -p.\n\n-r     Print a relative timestamp with each line of the trace.  This records the time differ‐\nence between the beginning of successive lines.\n\n-s strsize\nSpecify the maximum string size to print (the default is 32).\n\n-S     Display system calls as well as library calls\n\n-t     Prefix each line of the trace with the time of day.\n\n-tt    If given twice, the time printed will include the microseconds.\n\n-ttt   If given thrice, the time printed will include the microseconds and the  leading  por‐\ntion will be printed as the number of seconds since the epoch.\n\n-T     Show   the  time  spent inside each call. This records the time difference between the\nbeginning and the end of each call.\n\n-u username\nRun command with the userid, groupid and supplementary groups of username.   This  op‐\ntion  is  only useful when running as root and enables the correct execution of setuid\nand/or setgid binaries.\n\n-w, --where nr\nShow backtrace of nr stack frames for each traced function. This option  enabled  only\nif libunwind support was enabled at compile time.\n\n-x filter\nA  qualifying expression which modifies which symbol table entry points to trace.  The\nformat of the filter expression is described in the section  FILTER  EXPRESSIONS.   If\nmore  than  one  -x  option appears on the command line, the symbols that match any of\nthem are traced.  No entry points are traced if no -x is given.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-V, --version",
                        "content": "Show the version number of ltrace and exit.\n\n",
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            "FILTER EXPRESSIONS": {
                "content": "Filter expression is a chain of glob- or regexp-based rules that are used to pick symbols for\ntracing from libraries that the process uses.  Most of it is intuitive, so as an example, the\nfollowing would trace calls to malloc and free, except those done by libc:\n\n-e malloc+free-@libc.so*\n\nThis reads: trace malloc and free, but don't trace anything that comes from libc.   Semi-for‐\nmally, the syntax of the above example looks approximately like this:\n\n{[+-][symbolpattern][@librarypattern]}\n\nSymbolpattern is used to match symbol names, librarypattern to match library SONAMEs.  Both\nare implicitly globs, but can be regular expressions as well (see below).   The  glob  syntax\nsupports  meta-characters  *  and ? and character classes, similarly to what basic bash globs\nsupport.  ^ and $ are recognized to mean, respectively, start and end of given name.\n\nBoth symbolpattern and librarypattern have to match the whole name.  If you want  to  match\nonly  part  of the name, surround it with one or two *'s as appropriate.  The exception is if\nthe pattern is not mentioned at all, in which case it's as if the corresponding pattern  were\n*.  (So malloc is really malloc@* and @libc.* is really *@libc.*.)\n\nIn  libraries  that  don't have an explicit SONAME, basename is taken for SONAME.  That holds\nfor main binary as well: /bin/echo has an implicit SONAME of echo.  In addition to that, spe‐\ncial  library pattern MAIN always matches symbols in the main binary and never a library with\nactual SONAME MAIN (use e.g. ^MAIN or [M]AIN for that).\n\nIf the symbol or library pattern is surrounded in slashes (/like this/), then it  is  consid‐\nered a regular expression instead.  As a shorthand, instead of writing /x/@/y/, you can write\n/x@y/.\n\nIf the library pattern starts with a slash, it is not a SONAME expression, but a path expres‐\nsion, and is matched against the library path name.\n\nThe first rule may lack a sign, in which case + is assumed.  If, on the other hand, the first\nrule has a - sign, it is as if there was another rule @ in front of it, which has the  effect\nof tracing complement of given rule.\n\nThe  above  rules  are used to construct the set of traced symbols.  Each candidate symbol is\npassed through the chain of above rules.  Initially, the symbol is unmarked.  If it matches a\n+  rule, it becomes marked, if it matches a - rule, it becomes unmarked again.  If, after ap‐\nplying all rules, the symbol is marked, it will be traced.\n\n",
                "subsections": []
            },
            "BUGS": {
                "content": "It has most of the bugs stated in strace(1).\n\nIt only works on Linux and in a small subset of architectures.\n\nIf you would like  to  report  a  bug,  send  a  message  to  the  mailing  list  (ltrace-de‐\nvel@lists.alioth.debian.org),  or  use  the  reportbug(1) program if you are under the Debian\nGNU/Linux distribution.\n\n",
                "subsections": []
            },
            "FILES": {
                "content": "/etc/ltrace.conf\nSystem configuration file\n\n~/.ltrace.conf\nPersonal config file, overrides /etc/ltrace.conf\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Juan Cespedes <cespedes@debian.org>\nPetr Machata <pmachata@redhat.com>\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "ltrace.conf(5), strace(1), ptrace(2)\n\n\n\nJanuary 2013                                   LTRACE(1)",
                "subsections": []
            }
        }
    }
}