GNOME Bugzilla – Bug 588141
char *g_lookup_symbol (gpointer address)
Last modified: 2013-02-03 05:07:56 UTC
It would be nice to have a simple way to lookup functions inside glib. This would be most useful for producing debug output, like generating stack traces. My ideal function for that is what I posted in the summary: char *g_lookup_symbol (gpointer address); I could hand it a function pointer and have it return a description that is as useful as possible, ideally something like "my_function() [myfile.c:1337]" It can fall back to returning g_strdup_printf ("%p", address) on unsupported platforms easily. Bug 588077 has a patch that contains code to practically implements it, however it depends on libbfd which is GPL3. I guess this is problematic. Would conditionally compiling the libbfd code when --enable-debug=yes be a good idea for this?
Another option is to pull in a mini-bsd implementation, like the ones in use by sysprof or Chris Wilson's odin: <ickle> sysprof memprof have one, but I prefer (I'm biased ;-) http://cgit.freedesktop.org/~ickle/odin/tree/src/minibfd <ickle> and you have to remove demangle as that's GPLv2 <ickle> but the rest you are free to use under LPGL (even though they currently say GPLv3)
closing some old bugs