[PATCH 2/2 v2] Generalize cu_sec_idx

Mark Wielaard mark@klomp.org
Wed Dec 20 18:09:00 GMT 2017

On Thu, 2017-12-14 at 14:53 +0100, Ulf Hermann wrote:
> On 12/14/2017 02:51 PM, Mark Wielaard wrote:
> > This is clever and indeed cu_sec_idx () is not generic enough.
> > But this is also somewhat inefficient. I am working on DWARF5 support
> > and there a CU can come from even more different sections (or file). So
> > I am changing Dwarf_CU to have an explicit section to which is it is
> > associated. This can then also be used by the "fake" CUs like created
> > in dwarf_getmacros.
> Mind that the two most common cases are 0 and 1. In fact nothing else
> was supported before this change. So, most of the time this will not
> do a lot of iteration.

yes, but the original code really was not correct. The attached patch
fixes it by adding an explicit sec_idx field to the Dwarf_CU struct
that is set whenever a struct Dwarf_CU is created, so that we never
have to guess.

This patch combined with the overflow fix makes all testcases PASS.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libdw-Add-explicit-section-index-to-struct-Dwarf_CU.patch
Type: text/x-patch
Size: 4023 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/elfutils-devel/attachments/20171220/e1a8848b/attachment.bin>

More information about the Elfutils-devel mailing list