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

Robert Meier list1c30fe42 at bellsouth.net
Tue Jan 29 03:24:35 EST 2008


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?



Example:

static int tak(int x, int y, int z) {
  return x > y ? tak(tak(x-1, y, z),tak(y-1, z, x),tak(z-1, x, y)) : z;
}

I don't expect a human readable record,
but need to be able to trace execution,
similar to the following.

  tak(3,2,1)
    tak(0,3,2)
  2=tak(0,3,2)
    tak(1,1,3)
  3=tak(1,1,3)
    tak(2,2,1)
  1=tak(2,2,1)
   tak(1,3,2)
 2=tak(1,3,2)
2=tak(3,2,1)

TIA,
-- 
Bob

  "A computer once beat me at chess,
   but it was no match for me at kick boxing."
     -- Emo Philips



More information about the mdlug mailing list