getting the name of a C-function in the C-code based on a pointer to the function

Matthias Apitz guru at unixarea.de
Sat Jan 4 09:07:50 UTC 2020


Hello hackers,

What I'm locking for is how to get the name of a function, into a string pointer
for logging purpose as

printf("function called: %s\n", p);

based on a pointer to the function because in our realworld code it looks like this:

int fun(*module(), ...)
{
   char *p = ....
   printf("calling module %s\n", p);
   (*module)(int i);
}

i.e. the function fun() gets only a pointer to a function to be called (one
of around 400 different functions of a shared lib) 

Any (portable idea)? Thanks

	matthias


-- 
Matthias Apitz, ✉ guru at unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

"Glaube wenig, hinterfrage alles, denke selbst: Wie man Manipulationen durchschaut"
"Believe little, scrutinise all, think by your own: How see through manipulations"
ISBN-10: 386489218X
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20200104/49f338fe/attachment.sig>


More information about the freebsd-hackers mailing list