Ltrace
Jump to navigation
Jump to search
Description
ltrace traces the calls to the library functions.
Usage
Syntax
ltrace [option ...] [command [arg ...]]
Options
- -a, --align=COLUMN
- align return values in a secific column.
- -A MAXELTS
- maximum number of array elements to print.
- -b, --no-signals
- don't print signals.
- -c
- count time and calls, and report a summary on exit.
- -C, --demangle
- decode low-level symbol names into user-level names.
- -D, --debug=MASK
- enable debugging (see -Dh or --debug=help).
- -Dh, --debug=help
- show help on debugging.
- -e FILTER
- modify which library calls to trace.
- -f
- trace children (fork() and clone()).
- -F, --config=FILE
- load alternate configuration file (may be repeated).
- -h, --help
- display this help and exit.
- -i
- print instruction pointer at time of library call.
- -l, --library=LIBRARY_PATTERN
- only trace symbols implemented by this library.
- -L
- do NOT display library calls.
- -n, --indent=NR
- indent output by NR spaces for each call level nesting.
- -o, --output=FILENAME
- write the trace output to file with given name.
- -p PID
- attach to the process with the process ID pid.
- -r
- print relative timestamps.
- -s STRSIZE
- specify the maximum string size to print.
- -S
- trace system calls as well as library calls.
- -t, -tt, -ttt
- print absolute timestamps.
- -T
- show the time spent inside each call.
- -u USERNAME
- run command with the userid, groupid of username.
- -V, --version
- output version information and exit.
- -x FILTER
- modify which static functions to trace.
Usage example
$ ltrace ls
__libc_start_main(0x4028a0, 1, 0x7ffd448d7c58, 0x4124f0 <unfinished ...>
strrchr("ls", '/') = nil
setlocale(LC_ALL, "") = "fr_FR.UTF-8"
bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale"
textdomain("coreutils") = "coreutils"
__cxa_atexit(0x40a1c0, 0, 0, 0x736c6974756572) = 0
isatty(1) = 1
getenv("QUOTING_STYLE") = nil
getenv("COLUMNS") = nil
ioctl(1, 21523, 0x7ffd448d77f0) = 0
getenv("TABSIZE") = nil
getopt_long(1, 0x7ffd448d7c58, "abcdfghiklmnopqrstuvw:xABCDFGHI:"..., 0x413740, -1) = -1
getenv("LS_BLOCK_SIZE") = nil
getenv("BLOCK_SIZE") = nil
getenv("BLOCKSIZE") = nil
getenv("POSIXLY_CORRECT") = nil
getenv("BLOCK_SIZE") = nil
__errno_location() = 0x7f087563c6b0
malloc(56) = 0xb9d040
memcpy(0xb9d040, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 0xb9d040
__errno_location() = 0x7f087563c6b0
malloc(56) = 0xb9d080
memcpy(0xb9d080, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 0xb9d080
malloc(19200) = 0xb9d0c0
malloc(32) = 0xba1bd0
strlen(".") = 1
malloc(2) = 0xba1c00
memcpy(0xba1c00, ".\0", 2) = 0xba1c00
__errno_location() = 0x7f087563c6b0
opendir(".") = 0xba1c20
readdir(0xba1c20) = 0xba1c50
strlen("e7bc5d2c0cf4480348f5504196561297"...) = 32
malloc(33) = 0xba9c60
memcpy(0xba9c60, "e7bc5d2c0cf4480348f5504196561297"..., 33) = 0xba9c60
readdir(0xba1c20) = 0xba1c88
readdir(0xba1c20) = 0xba1ca0
readdir(0xba1c20) = 0
closedir(0xba1c20) = 0
free(0) = <void>
malloc(24) = 0xba1c20
_setjmp(0x61c700, 0x400000, 0xb9d180, 0xba1c20) = 0
realloc(0, 48) = 0xba1c40
malloc(24) = 0xba1c80
__errno_location() = 0x7f087563c6b0
__ctype_get_mb_cur_max() = 6
__ctype_get_mb_cur_max() = 6
__errno_location() = 0x7f087563c6b0
__ctype_get_mb_cur_max() = 6
__ctype_get_mb_cur_max() = 6
__errno_location() = 0x7f087563c6b0
__ctype_get_mb_cur_max() = 6
__ctype_get_mb_cur_max() = 6
fwrite_unlocked("e7bc5d2c0cf4480348f5504196561297"..., 1, 32, 0x7f0874ff82a0) = 32
__overflow(0x7f0874ff82a0, 10, 0x7f087564801f, 0xfbad2a84e7bc5d2c0cf4480348f5504196561297
) = 10
free(0xba1c00) = <void>
free(0) = <void>
free(0xba1bd0) = <void>
exit(0 <unfinished ...>
__fpending(0x7f0874ff82a0, 0, 64, 0x7f0874ff8c90) = 0
fileno(0x7f0874ff82a0) = 1
__freading(0x7f0874ff82a0, 0, 64, 0x7f0874ff8c90) = 0
__freading(0x7f0874ff82a0, 0, 2052, 0x7f0874ff8c90) = 0
fflush(0x7f0874ff82a0) = 0
fclose(0x7f0874ff82a0) = 0
__fpending(0x7f0874ff8060, 0, 0x7f0874ff9700, 0xfbad000c) = 0
fileno(0x7f0874ff8060) = 2
__freading(0x7f0874ff8060, 0, 0x7f0874ff9700, 0xfbad000c) = 0
__freading(0x7f0874ff8060, 0, 4, 0xfbad000c) = 0
fflush(0x7f0874ff8060) = 0
fclose(0x7f0874ff8060) = 0
+++ exited (status 0) +++