Aller au contenu
  1. Articles/

Tracing

·1 min·
Sommaire
Memos - Cet article fait partie d'une série.
Partie 1: Cet article

Multiple tools can be use to trace programs execution, gdb, valgrind,…

Strace
#

Using strace and some options I often use.

# trace a whole process
strace process 2>&1

# filter by system calls to $file
strace -e open process 2>&1 | grep "$file"
strace -e open,access 2>&1 | grep "$file"

# specify a pid
strace -p $pid

# print only a summary
strace --summary-only -p $pid

# tracing network process
# in this example `nc www.example.com 80`
strace -e poll,select,connect,recvfrom,sendto nc www.example.com 80

Valgrind
#

 valgrind -v $command

GDB
#

 gdb $command
Memos - Cet article fait partie d'une série.
Partie 1: Cet article