Skip to main content
To debug with strace, run the following commands using SSH:
  1. Run the process status command:
    ps -ef
    
    Sample output:
    root         440       1  0 00:00 ?        00:00:00 /usr/lib/system/systemd-udevd
    
  2. Identify the PID of the process that you want to debug.
  3. Run the strace command:
    strace -p 440
    
    In this example, 440 is the PID
    Sample output:
    root@iq-9075-evk:/# strace -p 440
    strace: Process 440 attached
    gettid()                                = 440
    epoll_pwait(7, [{events=EPOLLIN, data=0xb}], 212, -1, NULL, 8) = 1
    read(11, "\1\0\0\0\0\0\0\0", 8)         = 8
    socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 15
    getsockopt(15, SOL_SOCKET, SO_SNDBUF, [212992], [4]) = 0
    setsockopt(15, SOL_SOCKET, SO_SNDBUF, [8388608], 4) = 0
    getsockopt(15, SOL_SOCKET, SO_SNDBUF, [8388608], [4]) = 0
    setsockopt(15, SOL_SOCKET, SO_SNDBUFFORCE, [8388608], 4) = 0
    getuid()                                = 0
    geteuid()                               = 0
    getgid()                                = 0
    getegid()                               = 0
    sendmsg(15, {msg_name={sa_family=AF_UNIX, sun_path="/run/systemd/notify"}, msg_namelen=22, msg_iov=[{iov_base="WATCHDOG=1", iov_len=10}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 10
    close(15)                               = 0
    timerfd_settime(11, TFD_TIMER_ABSTIME, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1490, tv_nsec=794546000}}, NULL) = 0
    gettid()                                = 440
    epoll_pwait(7
    
    For more information about strace, see Linux manual page.