# run strace attached to pid with filter rules
strace -p <PID> -e trace=recvmsg,poll
Links:
You must build the binary with the debug flag -g
, I personally use -Og -g3
for debug optmization and to maximize the details;
# valgrind report
valgrind --leak-check=full --show-leak-kinds=all --show-reachable=yes \
--track-origins=yes binary
# run helgrind tool
valgrind --tool=helgrind bin
Links:
# execute binary with arguments in gdb
gdb --args binary arg1 arg2 arg3
- If segfault are driving you nuts, you can set a GDB environment variable
called MALLOC_CHECK_, you get the following behaviors:
- if set to 0: any detected heap corruption is silently ignored;
- if set to 1: a diagnostic is printed on stderr;
- if set to 2, abort is called immediately;
# in gdb console
set environment MALLOC_CHECK_ 2
Links:
This program translate addresses into filename and linenumbers.
# example of usage
gcc teste -g -o app
objdump -d app
addr2line -f -e app 4004d8
# main
# /tmp/hello.c:3