How can i read the stack frames of running process?



Hi all,

Can we read the stack frame's of the current process.
as we know that whenever a function call is made in c new functions
stack frame
is created and pushed on to the stack. and when the function returns
it is popped out from the stack. i want to know the caller functions
name.

i mean i want something like this

int a()
{
printf("File = %s\n",__FILE__);
/* i want to print the callers name over here. something like this
printf("Caller function = %s\n",__CALLER_FUN__); it should print
b*/
return 0;
}

int b()
{
a();
return 0;
}

int main()
{
b();
}

if there is any way please tell me.

Thanks and Regards
Harshal Shete

.



Relevant Pages

  • Re: How can i read the stack frames of running process?
    ... Can we read the stack frame's of the current process. ... i want to know the caller functions ... int a ...
    (comp.lang.c)
  • Re: How can i read the stack frames of running process?
    ... Can we read the stack frame's of the current process. ... i want to know the caller functions ... int a ... try parsing throught the generated assembly file and get to know the ...
    (comp.lang.c)
  • Re: Having C code looking like C++ code
    ... providing an integer stack. ... | extern int push; ... | typedef struct stacktype { ... muck around inside the encapsulation to use the interface. ...
    (comp.lang.c)
  • Re: [OT] C programming, variable size array
    ... The trick to understanding here is to know how memory gets allocated. ... int main{ ... The stack holds "automatic" variables used in C, ... Will automatically allocate and deallocate 1K of data on the stack. ...
    (Debian-User)
  • Re: Link Instruction & tt command
    ... In order to do the trace, ... than C, the routine's entry point is non-standard, or the task's stack ... int f_c ... framepointer, and you can not make any stacktraces. ...
    (comp.os.vxworks)