dwfl_module_get|addrsym_elf (Was: [commit] [patch 2/4] Provide __libdwfl_module_getsym to get dwfl_file *)

Mark Wielaard mjw at redhat.com
Tue Nov 26 14:07:20 UTC 2013


On Wed, 2013-11-13 at 20:08 +0100, Jan Kratochvil wrote:
> On Wed, 13 Nov 2013 12:48:29 +0100, Mark Wielaard wrote:
> > So, I think the user might also want to get hold of the file. Do you
> > think it makes sense to provide the user with extended versions of
> > getsym and addrsym based on this?
> > 
> > const char *dwfl_module_getsym_elf (Dwfl_Module *mod, int ndx,
> >                                     GElf_Sym *sym, GElf_Word *shndxp,
> >                                     Elf *elf)
> > 
> > char *dwfl_module_addrsym_elf (Dwfl_Module *mod, GElf_Addr address,
> >                                GElf_Sym *sym, GElf_Word *shndxp,
> >                                Elf *elf)
> > 
> > Where elf will be the main or debug file.
> 
> Primarily the current functions
> 
> extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx,
>                                        GElf_Sym *sym, GElf_Word *shndxp)
> extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address,
>                                         GElf_Sym *sym, GElf_Word *shndxp)
> 
> do not make sense as they are.  And current src/ subdir never uses their
> *SHNDXP.  Therefore either 'GElf_Word *shndxp' should be removed from them
> (in API incompatible but ABI compatible way, as usual) or there should be
> added the parameter 'Elf *elfp' (again in API incompatible but ABI compatible
> way).

They don't make sense if referring to non-special section constants, but
you can still check against special section constants like SHN_UNDEF and
SHN_ABS. So we should clearly document that.

For source compatibility it matters more that code outside core/src
elfutils uses the functions than those within. And these functions are
used in e.g. systemtap (they do check shndx against SHN_UNDEF).

I don't like breaking source compatibility for public functions that are
actually used, and aren't fundamentally broken (which these aren't IMHO,
they are just not as useful as they could be) it prevents building older
versions against a newer elfutils release.

In this particular case it makes more sense to keep the old functions,
but also introduce more capable functions that do provide the ELF file
to be able to refer to non-special section indexes.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libdwfl-Add-dwfl_module_addrsym_elf-and-dwfl_module_.patch
Type: text/x-patch
Size: 23012 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20131126/8b81f084/attachment-0001.bin>


More information about the elfutils-devel mailing list