Re: How can i read the stack frames of running process?
harshal <harshalshete@gmail.com> wrote:
> Can we read the stack frame's of the current process.
In reliable ISO C, you don't even know that you have something called a
"current process"[1], nor a "stack frame", let alone anything that is in
this stack frame's possession. All these details are system-specific,
all functions to read them are necessarily also system-specific, and in
all probability, old systems make doing so a brittle, unreliable process
while more modern systems (wisely) forbid you to put your grubby mitts
inside the running program's data without pre-arranged permission.
> as we know that whenever a function call is made in c new functions
> stack frame is created and pushed on to the stack.
You may think you know that; I think you merely suspect it.
> i want to know the caller functions name.
Pass it. Don't rely on dangerous, unportable, and dirty hackery.
(BTW: in English, the first person singular personal pronoun is
capitalised, except by pretentious bankers like E.E. Cummings.)
> if there is any way please tell me.
There is no way that I would trust with my computer's mental health.
Richard
[1] Unless you touch a live wire.
|