From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8014837296882547577==" MIME-Version: 1.0 From: Florian Weimer To: elfutils-devel@lists.fedorahosted.org Subject: [PATCH v3 1/6] dwarf_elf_begin: Add .gnu_debugaltlink to the sectiondata array Date: Tue, 15 Apr 2014 14:04:19 +0200 Message-ID: In-Reply-To: cover.1397586259.git.fweimer@redhat.com --===============8014837296882547577== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable And use it if DWZ mode is enabled. Signed-off-by: Florian Weimer --- libdw/ChangeLog | 8 ++++++++ libdw/dwarf_begin_elf.c | 33 +++++++++++++++------------------ libdw/libdwP.h | 1 + 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 6e63973..d740b2b 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,11 @@ +2014-04-15 Florian Weimer + + * libdwP.h (enum IDX_gnu_debugaltlink): New. + * dwarf_begin_elf.c (dwarf_scnnames): Increase string size and add + .gnu_debugaltlink. + (check_section): Obtain .gnu_debugaltlink section from the + setiondata array. + 2014-04-11 Mark Wielaard = * libdw.map (ELFUTILS_0.159): New. Add dwelf_elf_gnu_debuglink. diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c index 34ea373..5f69c61 100644 --- a/libdw/dwarf_begin_elf.c +++ b/libdw/dwarf_begin_elf.c @@ -54,7 +54,7 @@ = = /* Section names. */ -static const char dwarf_scnnames[IDX_last][17] =3D +static const char dwarf_scnnames[IDX_last][18] =3D { [IDX_debug_info] =3D ".debug_info", [IDX_debug_types] =3D ".debug_types", @@ -67,7 +67,8 @@ static const char dwarf_scnnames[IDX_last][17] =3D [IDX_debug_str] =3D ".debug_str", [IDX_debug_macinfo] =3D ".debug_macinfo", [IDX_debug_macro] =3D ".debug_macro", - [IDX_debug_ranges] =3D ".debug_ranges" + [IDX_debug_ranges] =3D ".debug_ranges", + [IDX_gnu_debugaltlink] =3D ".gnu_debugaltlink" }; #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[= 0])) = @@ -223,22 +224,6 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn= *scn, bool inscngrp) return NULL; } = -#ifdef ENABLE_DWZ - /* For dwz multifile support, ignore if it looks wrong. */ - if (strcmp (scnname, ".gnu_debugaltlink") =3D=3D 0) - { - Elf_Data *data =3D elf_getdata (scn, NULL); - if (data !=3D NULL && data->d_size !=3D 0) - { - const char *alt_name =3D data->d_buf; - const void *build_id =3D memchr (data->d_buf, '\0', data->d_size); - const int id_len =3D data->d_size - (build_id - data->d_buf + 1); - if (alt_name && build_id && id_len > 0) - return open_debugaltlink (result, alt_name, build_id + 1, id_len); - } - } -#endif /* ENABLE_DWZ */ - /* Recognize the various sections. Most names start with .debug_. */ size_t cnt; for (cnt =3D 0; cnt < ndwarf_scnnames; ++cnt) @@ -334,6 +319,18 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn= *scn, bool inscngrp) } #endif = +#ifdef ENABLE_DWZ + Elf_Data *data =3D result->sectiondata[IDX_gnu_debugaltlink]; + if (data !=3D NULL && data->d_size !=3D 0) + { + const char *alt_name =3D data->d_buf; + const void *build_id =3D memchr (data->d_buf, '\0', data->d_size); + const int id_len =3D data->d_size - (build_id - data->d_buf + 1); + if (alt_name && build_id && id_len > 0) + return open_debugaltlink (result, alt_name, build_id + 1, id_len); + } +#endif /* ENABLE_DWZ */ + return result; } = diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 4939200..a688456 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -74,6 +74,7 @@ enum IDX_debug_macinfo, IDX_debug_macro, IDX_debug_ranges, + IDX_gnu_debugaltlink, IDX_last }; = -- = 1.9.0 --===============8014837296882547577==--