SGI Techpubs Library

Freeware (IRIX)  »  Product Release Notes / Information
find in page


strace-3.1: description + notes

strace is a system call tracing utility. It is an invaluable tool for diagnosing problems or for understanding how other programs work especially when you have no access to source.

The builder of this package prefers strace over the standard IRIX par due to the following reasons:

  • The trace output is synchronous with the program output so it makes more sense.
  • System call symbolic arguments are better supported
  • strace is more universal and standard since it runs on other Unix versions (notably Linux)

This strace should not be confused with the generally less useful IRIX strace (STREAMS trace).

Known problems:

  • The -i option is not supported
  • The 64-bit ABI is not supported
  • This strace was compiled on IRIX 6.2 so it may not cover bleeding edge system calls and arguments added in later IRIX versions.
  • Probably related to the above:
    One strace crash has been observed when trying to trace tcsh-6.07.02 n32/mips4 on IRIX 6.4 S2MP+OCTANE. The crash happens while tracing select:
          select(1024, [0], NULL, NULL, NULL)     = 1 (in [0])
          Segmentation fault (core dumped)
    The stack trace is:
         (dbx) where
         >  0 decode_subcall(0x1001bd60, 0x173, 0x3, 0x0) ["syscall.c":0, 0x406fc4]
            1 trace_syscall(0x1001bd60, 0x173, 0x3, 0x0) ["syscall.c":0, 0x40796c]
            2 trace(0x1001bd60, 0x173, 0x3, 0x0) ["strace.c":0, 0x406170]
            3 main(0x7fff3019, 0x7fff2ef4, 0x3, 0x0) ["strace.c":0, 0x405204]
            4 __istart() ["crt1tinit.s":13, 0x404350]

Demo of strace + reader's exercise

Here is an example of some strace output (ls output redirected to /dev/null to make the trace clearer):
% strace ls > /dev/null
execve("/usr/freeware/bin/ls", ["ls"], [/* 52 vars */]) = 0
open("/lib32/rld", O_RDONLY)            = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
syssgi(SGI_ELFMAP, 0x3, 0x7fff2cb4, 0x2, 0x20008, 0x1) = 263585792
close(3)                                = 0
sysmp(0x420, 0xe, 0x7fff2ee4, 0x7fff2eec, 0) = 4096
open("/dev/zero", O_RDONLY)             = 3
mmap(0xfbe0000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE, 0, 0x2000) = 0xfbe0000close(3)                                = 0
sysinfo(0x6d /* SI_??? */, "R5000 2.1", 257) = 10
syssgi(SGI_TOSSTSAVE, 0, 0xfb69c14, 0xfbe2030, 0, 0xfb6a460) = 0
sysmp(0x420, 0xe, 0, 0x6, 0)            = 4096
brk(0x10023000)                         = 0
syssgi(SGI_USE_FP_BCOPY, 0, 0x181, 0xffffffff, 0, 0x181) = 0
open("/usr/lib/iconv/iconvtab", O_RDONLY) = 3
lseek(3, 0, SEEK_END)                   = 17000
sysmp(0x420, 0xe, 0, 0x2, 0)            = 4096
mmap(0, 20480, PROT_READ, MAP_SHARED, 0, 0x7fff2d00) = 0x4000000
close(3)                                = 0
syssgi(SGI_USE_FP_BCOPY, 0, 0x400, 0xffffffff, 0, 0x400) = 0
xstat(2, "/usr/lib/locale/en_US/LC_CTYPE", {st_mode=020037312, st_size=0, ...}) = 0
open("/usr/lib/locale/en_US/LC_CTYPE", O_RDONLY) = 3
mmap(0, 2592, PROT_READ, MAP_SHARED, 0, 0x403eca) = 0x4008000
close(3)                                = 0
open("/usr/lib/locale/en_US/LC_NUMERIC", O_RDONLY) = 3
read(3, ".,", 2)                        = 2
close(3)                                = 0
time()                                  = 893989431
ioctl(1, TCGETA, 0x7fff2d70)            = -1 EINVAL (Invalid argument)
ioctl(1, TIOCGWINSZ, 0x7fff2dd8)        = -1 EINVAL (Invalid argument)
brk(0x10027000)                         = 0
open(".", O_RDONLY)                     = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
fxstat(2, 3, {st_mode=S_IFDIR|S_ISUID|S_ISGID|0161000676, st_size=0, ...}) = 0
brk(0x1002b000)                         = 0
ngetdents(0x3, 0x10026a00, 0x4000, 0x7fff2db0) = 224
close(3)                                = 0
ioctl(1, TCGETA, 0x7fff2b60)            = -1 EINVAL (Invalid argument)
write(1, "Old\nidentity\nidentity.pub\nkno"..., 56) = 56
close(1)                                = 0
prctl(PR_GETNSHARE)                     = 0
exit(0)                                 = ?

Reader's exercise:

  • Which directory preceeds the standard ones in my PATH
  • To which MIPS ABI was the ls program compiled for
  • In which directory was ls run
  • What check does ls perform on file descriptor #1 (stdout), why would it do this, what is the result of the check, and why ?

To install this package, go to the SGI Freeware site.


home/search | what's new | help