This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Backtrace_symbols and .symtab


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.

-Y


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]