Re: How can i read the stack frames of running process?
On Oct 17, 4:09 pm, r...@hoekstra-uitgeverij.nl (Richard Bos) wrote:
> harshal <harshalsh...@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.
Can you please explain this in simple words.
from what you are saying it looks like it is nearly impossible.
but my question is that if a function can print its name with
__FUNCTION__
macro then why it can not print its callers name.
then what harm is there with printing its callers name ?
actually i thought of this thing because i want to resolve some memory
leak issues.
and for that purpose i was thinking to print the callers name in
kmalloc.
by the way i am using eCos as operating system.
Thanks and Regards
Harshal
|