Skip to contentSkip to conversation

libunwind question

DISCUSSION Umut Aymakoglu 2 participants 2 messages Oct 13, 2003

lore
Share & tools
lore
#0 lore raw

Hi -
During unwinding is there a way to tell if the ip is from a shared
library or from an executable and get the name of the object it is from?

I use the unw_get_proc_name() call to get the symbol name but would like
to get the name of the object as well.

thanks,
Umut

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Umut Aymakoglu

Umut> During unwinding is there a way to tell if the ip is from a Umut> shared library or from an executable and get the name of the Umut> object it is from?

Not with libunwind itself.

Umut> I use the unw_get_proc_name() call to get the symbol name but Umut> would like to get the name of the object as well.

You should be able to get that by walking the list of mapped objects. You can get that with dl_iterate_phdr(). The callback will be invoked once for each object and then you can check the ELF PHDR to see if the IP falls inside the object.

	--david

PS: I'm cc'ing libunwind, since that's probably a more appropriate place
to discuss such issues.