List Info

Thread: Where to find definition for __FUNCTION__ macro




Where to find definition for __FUNCTION__ macro
user name
2006-08-23 10:48:49
Alright, I might just as well present my problem here... I
am trying
to debug some call back handlers which are actualy
registered as
function pointers at boot time for a router, now lets say
there is  a
central notification framework and looking at the msg-type
it calls a
specific handler, so there is some statement like

               ev_msg_handlers[msg->rtsm_type].
So I was thinking if I could get the internals of the
__FUNCTION__
macro and if my assumption that it looks it up in system map
then I
could possibly attempt to modify it so as to accept the
handler
address and return the function name it is entering ... what
say ???

On 8/23/06, Vadiraj <vadiraj.csgmail.com> wrote:
> __FUNCTION__ is not defined macro part of
compiler(GCC).
>
>
> On 8/23/06, Shriek <shriek.007gmail.com> wrote:
> >
> Hi
>   Where can I find the implementation of the
__FUNCTION__ macro, does
> it use symbol table look up  or something ... thanks
and regards ...
>
> Shrikanth R K
> -
> To unsubscribe from this list: send the line
"unsubscribe
> linux-c-programming" in
> the body of a message to majordomovger.kernel.org
> More majordomo info at
> http://vge
r.kernel.org/majordomo-info.html
>
>
>
>
> --
> cheers,
> Vadi
-
To unsubscribe from this list: send the line
"unsubscribe linux-c-programming" in
the body of a message to majordomovger.kernel.org
More majordomo info at  http://vge
r.kernel.org/majordomo-info.html
Where to find definition for __FUNCTION__ macro
user name
2006-08-23 11:11:38
Shriek wrote:

> Alright, I might just as well present my problem
here... I am trying
> to debug some call back handlers which are actualy
registered as
> function pointers at boot time for a router, now lets
say there is  a
> central notification framework and looking at the
msg-type it calls a
> specific handler, so there is some statement like
> 
>                ev_msg_handlers[msg->rtsm_type].
> So I was thinking if I could get the internals of the
__FUNCTION__
> macro and if my assumption that it looks it up in
system map then I
> could possibly attempt to modify it so as to accept the
handler
> address and return the function name it is entering ...
what say ???

__FUNCTION__ won't help you here.

You need to be able to read either the executable's symbol
table (for
a dynamically-linked executable) or its debug information
(for an
executable with debug info). For a statically-linked
executable with
no debug info, it's impossible; the function's names
simply don't
exist anywhere at run-time.

I'd suggest looking at the source code for "nm"
for details on reading
symbol information.

-- 
Glynn Clements <glynngclements.plus.com>
-
To unsubscribe from this list: send the line
"unsubscribe linux-c-programming" in
the body of a message to majordomovger.kernel.org
More majordomo info at  http://vge
r.kernel.org/majordomo-info.html
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )