Afficher un message
Vieux 17/10/2007, 13h06   #3
karthikbalaguru
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How can i read the stack frames of running process?

On Oct 17, 3:56 pm, harshal <harshalsh...@gmail.com> wrote:
> 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.
>


You need to understand the architecture of your system, assembly,
compiler very well.
Write a logic in such a way that, you
try parsing throught the generated assembly file and get to know the
function that is calling it.
In the case of M68K there will be something like
JSR _a inside 'b' function.

Karthik Balaguru

  Réponse avec citation
 
Page generated in 0,05216 seconds with 9 queries