Posts

Showing posts from February, 2012

simple application-level tracing with atrace.sh

Linux provides a plethora of useful trace tools. Two of the most command and the most useful being strace , for tracing system calls and ltrace that traces library calls (it can also trace system calls). There a quite a few other exotic and experimental tools available but there seemed to me there was a gap in the coverage... Recently, I had cause to need an application-level trace. For the problem at hand, I didn't care a hoot about system calls or indeed library calls -  I wanted a trace log file that showed a call to " main ", and then entries for all the other functions I had written in the application . A quick search around didn't reveal much, but some lateral thinking saved the day. What tool can display application-level function names? gdb of course! The question was how to coerce it into working as a trace tool. It's actually very simple. What you do is this: Set breakpoints on every function in your application. Make GDB display the frame wheneve...