Date: Sat, 4 Jan 2020 10:07:43 +0100 From: Matthias Apitz <guru@unixarea.de> To: freebsd-hackers@freebsd.org Subject: getting the name of a C-function in the C-code based on a pointer to the function Message-ID: <20200104090743.GA3017@c720-r342378>
next in thread | raw e-mail | index | archive | help
--J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello hackers, What I'm locking for is how to get the name of a function, into a string po= inter for logging purpose as printf("function called: %s\n", p); based on a pointer to the function because in our realworld code it looks l= ike this: int fun(*module(), ...) { char *p =3D .... 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)=20 Any (portable idea)? Thanks matthias --=20 Matthias Apitz, =E2=9C=89 guru@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 durc= hschaut" "Believe little, scrutinise all, think by your own: How see through manipul= ations" ISBN-10: 386489218X --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEXmn7rBYYViyzy/vBR8z35Hb+nREFAl4QVdwACgkQR8z35Hb+ nREjeA//VHh2BUuyGQqaueFkBwab6HreLD0d8zuCv07j9Dsf3R9SKGcKV76+rWcx 5iuR9xdVhqiBttLsPuOBSLZVEo8rcFFsfRjHhZVLAqycdIrP2NVmdJaSVijx0xBp xKa02uVq/wp2ChKY6xKJjNjpGuoSS6l71qPJv6IieRftwPzXdWRVFU8sXqSObUru 5HSx5I9oKJAzXIgwWtSJO1biyrrcJrRg8pPPG64+pqZQ5DdRjrGhxBlHz9UUf1Ek yxlBi9dcC+vpsW/429hZdPdtg4DuGh+kpBZ6ILQJPlaflLHbVSlYvGleA9qwbA7E MMDzmonreeqeab+8dgTG895jzjgdR8iq0gaxcfz7Wf6UKKG1MK6f1kRmx/tdIf5y IFQ7LuTaoCuEiN64S8mSDmKNKmVEgPplios3feVfKIIyD6wDbEVwNQqm5sobza5f TlGOlx/SKug0M4SO6y2P9MTow5ueYkRRjgo3dgSeZg5hczuO0quo8Ef4Lc3hy33s Db4B+C0L6zmVvlendGl0Q6H+TEpUAO8XZjsD9wpDyIWN8f35DN2XSYowgG7rauGM kRmgza++O33qhijfLJZEYGW88nXDTgBuSLfzpvov12HBuUxeo/CBgKY+Gl7TQ/lf +6SzzyqflKvbK8vlN3yvclbkv0fbLgATpvy2pVwcOgRhb7RRQZU= =vTii -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200104090743.GA3017>