[mdlug] [Request] (dis)recommendations for gcc function call sequence

Richard Herrell rherrell at twmi.rr.com
Tue Jan 29 13:04:52 EST 2008


When you hit a breakpoint or fault, type "bt" -> backtrace to see the 
call stack.  "up" and "down" get you to each calling function's local 
context.  You'll still need the '-g' flag.  Otherwise, you'll have to 
manually review the stack to find the return address in each function, 
which is no fun.  You'll need a core file and the map file from the linker.

Richard

Aaron Kulkis wrote:
> Robert Meier wrote:
>   
>> C programmers,
>>
>> I am trying to map (i.e. determine) the history of function calls in c code.
>> The compiler is gcc-2.96, with associated gdb, gprof, and most other tools.
>> I can generally add any compile/link flags I need,
>> but cannot practically spend the time to alter the source code.
>>
>> AFAIK, gprof, (gmon.out format) only collects a histogram (caller
>> and duration) of calls, and discards the sequence of calls.
>>
>> What tools do you (dis)recommend?
>> Is there a (set of) gcc options to record entry/exit of each function?
>>
>>
>>     
>
> compile with the -g flag, fire up gdb and use single-step mode.
> Laborious, but it works.
>
>
> _______________________________________________
> mdlug mailing list
> mdlug at mdlug.org
> http://mdlug.org/mailman/listinfo/mdlug
>
>   




More information about the mdlug mailing list