224Chapter7 • Miscellaneous Tools
22:21:48.343813 SYS_197(1, 0xbfffeff0, 0x401569e4, 0x40154a60,
0x40154a60) = 0
22:21:48.344450 SYS_192(0, 4096, 3, 34, -1) = 0x40018000
22:21:48.345154 SYS_ioctl(1, 21505, 0xbfffef20, 0xbfffef80,
1024) = 0
22:21:48.345890 SYS_write(1, "Hello world\n", 12Hello world
) = 12
22:21:48.346542 <... printf resumed> ) = 12
22:21:48.346878 __deregister_frame_info(0x08049508,
0x4000d816, 0x400171ec, 0x40017310, 7) = 0x080495e0
22:21:48.347746 SYS_munmap(0x40018000, 4096) = 0
22:21:48.348235 SYS_exit(12) =
22:21:48.348706 +++ exited (status 12) +++
[root@boota ltrace]#
The first column in each row shows the current time followed by a number that shows
microseconds. The remaining part of the line shows the system call of the library call used. By
comparing the time in two consecutive lines, you can find out the time taken by a particular sys-
tem call. By looking at the output, you can also find out if a program fails during a particular
system call. This may be especially helpful when testing device drivers and reading or writing to
these drivers fails for some reason.
The most common options used with this utility are shown in Table 7-4.
The command can also read options either from its configuration file
/etc/
ltrace.conf
or from
.ltrace.conf
in the home directory of the user.
The
strace
utility is a more comprehensive tool and it can be used to separate different
system calls. For example, it can be used to display information about network related system
Table7-4 Common options used with the
ltrace
utility
OptionDescription
-d
Debug. Displays extra information about trace.
-f
Trace child processes.
-S
Display system calls and library calls.
-r
Display time difference between successive lines.
-tt
Display time stamp with each line with a resolution to microseconds.
-o filename
Record output to a file.
-V
Display version.
-h
Display help.
Next Page >>
<< Previous Page
Back to the Table of Contents