Skip to content
Snippets Groups Projects
  1. Nov 16, 2018
    • olsajiri's avatar
      Add shmsnoop/sofdsnoop tools v2 (#2045) · b5114229
      olsajiri authored
      * tools: Add shmsnoop to spy on shm* syscalls
      
      Adding shmsnoop tool to trace System V shared memory
      syscalls: shmget, shmat, shmdt, shmctl
      
        # ./shmsnoop.py
        PID    COMM                SYS              RET ARGs
        19813  server           SHMGET            10000 key: 0x78020001, size: 20, shmflg: 0x3b6 (IPC_CREAT|0666)
        19813  server            SHMAT     7f1cf8b1f000 shmid: 0x10000, shmaddr: 0x0, shmflg: 0x0
        19816  client           SHMGET            10000 key: 0x78020001, size: 20, shmflg: 0x1b6 (0666)
        19816  client            SHMAT     7f4fd8ee7000 shmid: 0x10000, shmaddr: 0x0, shmflg: 0x0
        19816  client            SHMDT                0 shmaddr: 0x7f4fd8ee7000
        19813  server            SHMDT                0 shmaddr: 0x7f1cf8b1f000
        19813  server           SHMCTL                0 shmid: 0x10000, cmd: 0, buf: 0x0
      
      Every call the shm* syscall (SHM column) is displayed
      on separate line together with process info (PID/COMM
      columns) and argument details: return value (RET column)
      and syscall arguments (ARGs column).
      
      The ARGs column contains 'arg: value' couples that represent
      given syscall arguments as described in their manpage.
      
      It supports standard options to filter on pid/tid,
      to specify duration of the trace and command name
      filter, like:
      
          ./shmsnoop           # trace all shm*() syscalls
          ./shmsnoop -T        # include timestamps
          ./shmsnoop -p 181    # only trace PID 181
          ./shmsnoop -t 123    # only trace TID 123
          ./shmsnoop -d 10     # trace for 10 seconds only
          ./shmsnoop -n main   # only print process names containing "main"
      
      * tools: Add sofdsnoop to spy on fds passed through socket
      
      The sofdsnoop traces FDs passed through unix sockets.
      
        # ./sofdsnoop
        ACTION TID    COMM             SOCKET                    FD    NAME
        SEND   2576   Web Content      24:socket:[39763]         51    /dev/shm/org.mozilla.ipc.2576.23874
        RECV   2576   Web Content      49:socket:[809997]        51
        SEND   2576   Web Content      24:socket:[39763]         58    N/A
        RECV   2464   Gecko_IOThread   75:socket:[39753]         55
      
      Every file descriptor that is passed via unix sockets os displayed
      on separate line together with process info (TID/COMM columns),
      ACTION details (SEND/RECV), file descriptor number (FD) and its
      translation to file if available (NAME).
      
      examples:
          ./sofdsnoop           # trace file descriptors passes
          ./sofdsnoop -T        # include timestamps
          ./sofdsnoop -p 181    # only trace PID 181
          ./sofdsnoop -t 123    # only trace TID 123
          ./sofdsnoop -d 10     # trace for 10 seconds only
          ./sofdsnoop -n main   # only print process names containing "main"
      b5114229
Loading