Backtrace_symbols and .symtab
Steven Munroe
munroesj@linux.vnet.ibm.comcom
Fri Oct 24 13:30:00 GMT 2014
On Wed, 2014-10-22 at 21:14 +0400, Yury Gribov wrote:
> On 10/22/2014 08:44 PM, Roland McGrath wrote:
> > Please be specific about exactly what you propose. How would the program
> > find its own executable file from which to read .symtab?
>
> dladdr(3) already provides us with info about module which symbol
> belongs to so we can call this and use it's results to mmap .symtab (and
> .strtab) from the module and then use sections to map address to name.
> I'm indeed somewhat skimming over details because this email was
> intended as a general check whether this functionality would be
> liked/accepted by glibc folks.
>
> > The reason it
> > uses only .dynsym is that only .dynsym is part of the memory image in a
> > running program.
>
> Not only that but also search in .dynsym is much faster.
>
> > You mentioned sprof, but this is a completely different case. That's a
> > program that reads an ELF file off disk.
>
> Sure, .symtab would need to be read from disk on demand (and probably
> cached) somewhere inside backtrace_symbols.
>
Some tools that use backtrace need fast/simple function and this
proposal would slow it down significantly.
This is a bad idea.
More information about the Libc-alpha
mailing list