ltrace

除錯工具

ltrace是一個在Linux中使用的除錯工具,用於顯示用戶空間應用程式對共用庫的呼叫。

範例輸出

編輯

以下是對xterm的呼叫的前幾行。ltrace顯示了xterm對各種庫的呼叫,包括C標準庫(malloc, strlen)、POSIX庫(getuid)、X Toolkit Intrinsics(XtOpenApplication)以及X11客戶端通訊庫(IceAddConnectionWatch)。呼叫的返回值在等號後顯示。

[pid 11783] __libc_start_main(0x407420, 1, 0x7fff75b6aad8, 0x443cc0, 0x443d50 <unfinished ...>
[pid 11783] geteuid()                            = 1000
[pid 11783] getegid()                            = 1000
[pid 11783] getuid()                             = 1000
[pid 11783] getgid()                             = 1000
[pid 11783] setuid(1000)                         = 0
[pid 11783] malloc(91)                           = 0x00cf8010
[pid 11783] XtSetLanguageProc(0, 0, 0, 0x7f968c9a3740, 1) = 0x7f968bc16220
[pid 11783] ioctl(0, 21505, 0x7fff75b6a960)      = 0
[pid 11783] XtSetErrorHandler(0x42bbb0, 0x44f99c, 0x669f80, 146, 0x7fff75b6a72c) = 0
[pid 11783] XtOpenApplication(0x670260, 0x44f99c, 0x669f80, 146, 0x7fff75b6a72c) = 0xd219a0
[pid 11783] IceAddConnectionWatch(0x42adc0, 0, 0, 0x7f968c9a3748, 0 <unfinished ...>
[pid 11783] IceConnectionNumber(0xd17ec0, 0, 1, 0xcfb138, 0xd17c00) = 4
[pid 11783] <... IceAddConnectionWatch resumed> ) = 1
[pid 11783] XtSetErrorHandler(0, 0, 1, 0xcfb138, 0xd17c00) = 0
[pid 11783] XtGetApplicationResources(0xd219a0, 0x6701c0, 0x66b220, 34, 0) = 0
[pid 11783] strlen("off")                        = 3

參見

編輯