Re: How can i read the stack frames of running process?



harshal wrote:
On Oct 17, 4:09 pm, r...@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos) wrote:

Can you please explain this in simple words.
OK - simple words follow:-

It is very difficult to do in any particular implementation.

It is impossible to produce a general solution.

from what you are saying it looks like it is nearly impossible.

That's about right.

but my question is that if a function can print its name with
__FUNCTION__
macro then why it can not print its callers name.

The __FUNCTION__ macro is handled by the preprocessor and is simply a textual replacement at compile time. It's not (terribly) difficult for the preprocessor to track which function it's processing at a time.

actually i thought of this thing because i want to resolve some memory
leak issues.

It can be a useful approach. But unless someone else has already implemented it, it won't be at all easy...

and for that purpose i was thinking to print the callers name in
kmalloc.

I've never heard of kmalloc...

by the way i am using eCos as operating system.

Then perhaps you could ask in a newsgroup or forum related to that operating system.
.



Relevant Pages

  • Re: Sacla loop: a new loop implementation
    ... way without demanding that the necessary type information is available ... necessary information for the macro to expand. ... > available at compile time" ... A statically typed language is a language where types are known at ...
    (comp.lang.lisp)
  • Re: macrology
    ... I'm trying to build a macro, pat-case, which is a case for patterns. ... takes a pattern, and input, and a list of forms to be executed (with ... Should return "LION TIGER" ... which will be all fixed in place at compile time, ...
    (comp.lang.lisp)
  • Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
    ... forth and macro. ... execute at compile time like immediate words did thirty years ... design point I am interested in what it should/could do. ... found I only used each of the instructions RA SA RE SE once!!!! ...
    (comp.lang.forth)
  • Re: Sacla loop: a new loop implementation
    ... >> portably in common lisp, because the facilities just aren't there. ... No, macro expansion is a macroexpand-time operation, which occurs at ... > information must be produced at compile time. ... type information. ...
    (comp.lang.lisp)
  • Re: encrypting with preprocessor
    ... Here is a macro which compute the FNV hash function of the first 32 characters of a litteral string at compile time. ... The original litteral string 'str' does not appear in the binary. ... I let you adapt this macro to do encryption instead of computing hash code. ...
    (comp.lang.c)