Hi,
Some time ago on the dwarf branch the the dwarf string functions were split out of readelf.c into dwarfstrings.c plus dwarfstrings.h so they could easily be reused in other elfutils programs. Over time they diverged a bit.
Attached is a patch to merge the changes from the master readelf.c version to the dwarf dwarfstrings.c version. Another to merge the changes from the dwarfstrings.c version to the readelf.c master version.
To prevent further divergence and make merging changes easier there is also a patch to make the same readelf/dwarfstrings for master.
Would it be OK to apply these patches to the branch and/or master?
Thanks,
Mark
The place to start for master is just to update the readelf.c tables without reorganizing anything. Commit that first.
On the dwarf branch, we should be getting rid of all hand-maintained tables entirely. We have libdw/known-dwarf.h, which is updated automagically under --enable-maintainer-mode. Anything using C++ code, such as dwarflint, should be using the existing interfaces built from that, like dwarf::tags::identifier and dwarf::attributes::identifier (or ::name, depending what output you want). There is also dwarf::forms and dwarf::ops. The attribute-value name tables are only available via dwarf*::dwarf_enum::to_string. It's possible we need to add something to make those easier to use outside their uses in ...::attribute::to_string. But off hand it looks to me like you can just instantiate a dwarf_{data,edit}::dwarf_enum object and use the to_string, identifier, or name methods on it.
After we've cleaned up all the existing stuff, I'm not sure there will be any pure C cases other than readelf. If there are, we can think about it. If not, then it will probably make sense to put the known-dwarf.h generation stuff onto master and use it directly in readelf.c to replace the existing hand-maintained tables.
Thanks, Roland
On Thu, 2011-02-24 at 14:36 -0800, Roland McGrath wrote:
The place to start for master is just to update the readelf.c tables without reorganizing anything. Commit that first.
OK, pushed that. And a matching commit to the dwarf branch, just to make sure that for now they are in sync.
On the dwarf branch, we should be getting rid of all hand-maintained tables entirely. We have libdw/known-dwarf.h, which is updated automagically under --enable-maintainer-mode. Anything using C++ code, such as dwarflint, should be using the existing interfaces built from that, like dwarf::tags::identifier and dwarf::attributes::identifier (or ::name, depending what output you want). There is also dwarf::forms and dwarf::ops. The attribute-value name tables are only available via dwarf*::dwarf_enum::to_string. It's possible we need to add something to make those easier to use outside their uses in ...::attribute::to_string. But off hand it looks to me like you can just instantiate a dwarf_{data,edit}::dwarf_enum object and use the to_string, identifier, or name methods on it.
I cleaned up the usage in the tests that I added. Haven't gone over the other usage in dwarflint. Petr let me know if you want me to do that.
Thanks,
Mark
elfutils-devel@lists.fedorahosted.org