* Where to find definition for __FUNCTION__ macro
@ 2006-08-23 10:02 Shriek
2006-08-23 10:13 ` Mihai Dontu
[not found] ` <6eee1c40608230324t63154c45xa4b54c6d6cc9850d@mail.gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Shriek @ 2006-08-23 10:02 UTC (permalink / raw)
To: linux-c-programming
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Where to find definition for __FUNCTION__ macro
2006-08-23 10:02 Where to find definition for __FUNCTION__ macro Shriek
@ 2006-08-23 10:13 ` Mihai Dontu
[not found] ` <6eee1c40608230324t63154c45xa4b54c6d6cc9850d@mail.gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Mihai Dontu @ 2006-08-23 10:13 UTC (permalink / raw)
To: linux-c-programming
Shriek wrote:
> Hi
> Where can I find the implementation of the __FUNCTION__ macro, does
> it use symbol table look up or something ... thanks and regards ...
A.f.a.i.k __FUNCTION__ is a gcc builtin macro. It's not defined as
regular macros.
M.D.
--
This message was scanned for viruses by BitDefender for Linux Mail Servers.
For more information please visit http://www.bitdefender.com/
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <6eee1c40608230324t63154c45xa4b54c6d6cc9850d@mail.gmail.com>]
* Re: Where to find definition for __FUNCTION__ macro
[not found] ` <6eee1c40608230324t63154c45xa4b54c6d6cc9850d@mail.gmail.com>
@ 2006-08-23 10:48 ` Shriek
2006-08-23 11:11 ` Glynn Clements
0 siblings, 1 reply; 5+ messages in thread
From: Shriek @ 2006-08-23 10:48 UTC (permalink / raw)
To: Vadiraj, Mihai Dontu; +Cc: linux-c-programming
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.cs@gmail.com> wrote:
> __FUNCTION__ is not defined macro part of compiler(GCC).
>
>
> On 8/23/06, Shriek <shriek.007@gmail.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 majordomo@vger.kernel.org
> More majordomo info at
> http://vger.kernel.org/majordomo-info.html
>
>
>
>
> --
> cheers,
> Vadi
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Where to find definition for __FUNCTION__ macro
2006-08-23 10:48 ` Shriek
@ 2006-08-23 11:11 ` Glynn Clements
2006-08-23 12:49 ` Shorty Porty
0 siblings, 1 reply; 5+ messages in thread
From: Glynn Clements @ 2006-08-23 11:11 UTC (permalink / raw)
To: Shriek; +Cc: Vadiraj, Mihai Dontu, linux-c-programming
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 <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Where to find definition for __FUNCTION__ macro
2006-08-23 11:11 ` Glynn Clements
@ 2006-08-23 12:49 ` Shorty Porty
0 siblings, 0 replies; 5+ messages in thread
From: Shorty Porty @ 2006-08-23 12:49 UTC (permalink / raw)
To: 'Glynn Clements', 'Shriek'
Cc: 'Vadiraj', 'Mihai Dontu', linux-c-programming
My understanding is that __FUNCTION__ is substituted at compile time. So
__FUNCTION__ doesn't run anything, it's just a string, like __FILE__ or
__LINE__.
shorty
-----Original Message-----
From: linux-c-programming-owner@vger.kernel.org
[mailto:linux-c-programming-owner@vger.kernel.org] On Behalf Of Glynn
Clements
Sent: Wednesday, 23 August 2006 9:12 PM
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-08-23 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 10:02 Where to find definition for __FUNCTION__ macro Shriek
2006-08-23 10:13 ` Mihai Dontu
[not found] ` <6eee1c40608230324t63154c45xa4b54c6d6cc9850d@mail.gmail.com>
2006-08-23 10:48 ` Shriek
2006-08-23 11:11 ` Glynn Clements
2006-08-23 12:49 ` Shorty Porty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).