[patch 1/4] Fix dwfl_module_addrsym for minidebuginfo

Mark Wielaard mjw at redhat.com
Wed Nov 13 11:30:17 UTC 2013


Hi Jan,

On Wed, 2013-11-06 at 22:10 +0100, Jan Kratochvil wrote:
> jankratochvil/xauxfile
> 
> the existing condition is clearly wrong:
> 	((size_t) i < mod->syments ? mod->symfile : &mod->aux_sym)

Yes, dwfl_module_addrsym is inconsistent with how dwfl_module_getsym
calculates this.

> Additionally same_section() cannot compare section number from file X with
> section number from file Y

Urgh. Indeed, I completely missed that. This is somewhat ugly in
general. It is already not easy to see what file the st_shndx or the
returned shndx section number refers to (either the main elf file for
dynsym or the debug file for symtab, which might or might not be the
same). Adding aux_file makes it worse. Wish I had realized that when I
added it.

I am not sure this is fixable, even if we would remove the aux_file
support. Should we just add a comment to the function that the
st_shndx/shndxp cannot be relied upon? Or should we provide a new dwfl
interface that provides the Elf file given a symbol index (somewhat like
this i_to_symfile function)?

>     libdwfl/
>     2013-11-06  Jan Kratochvil  <jan.kratochvil at redhat.com>
>     
>     	Fix dwfl_module_addrsym for minidebuginfo.
>     	* dwfl_module_addrsym.c (dwfl_module_addrsym): New variable
>     	addr_symfile.
>     	(dwfl_module_addrsym) (same_section): Use it.
>     	(dwfl_module_addrsym) (i_to_symfile): New function.
>     	(dwfl_module_addrsym) (search_table): Use it.

This looks correct.

Thanks,

Mark



More information about the elfutils-devel mailing list