Backtrace_symbols and .symtab
Yury Gribov
y.gribov@samsung.com
Fri Oct 24 13:44:00 GMT 2014
On 10/24/2014 05:29 PM, Steven Munroe wrote:
> 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.
Sure, this will be a separate API because we don't want to slow existing
users. So either add some flags parameter or a completely new function.
-Y
More information about the Libc-alpha
mailing list