Upgrade to Pro — share decks privately, control downloads, hide ads and more …

strace(1) all the things!

Dan Miller
November 13, 2014

strace(1) all the things!

Presented at the Marist College Computer Society meeting, 11/12/14

Dan Miller

November 13, 2014
Tweet

More Decks by Dan Miller

Other Decks in Programming

Transcript

  1. @jazzdan strace(1) all the things What is strace(1)? How to

    see what a program does without the source A quick aside about man(1) pages How does ls(1) work?
  2. execve() executes the program pointed to by filename. filename must

    be either a binary executable, or a script starting with a line of the form: ! #! interpreter [optional-arg]
  3. Given a pathname for a file, open() returns a file

    descriptor, a small, nonnegative integer for use in subsequent system calls (read(2), write(2), lseek(2), fcntl(2), etc.).
  4. This system call is equivalent to exit(2) except that it

    terminates not only the calling thread, but all threads in the calling process's thread group.
  5. @jazzdan When is strace(1) useful? • Anything involving files or

    sockets • Path issues • See what is being sent over a network interface
  6. @jazzdan When is strace(1) not useful? • In production (performance

    is terrible) • When no syscalls are being executed