From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2114) id 3DE78385828E; Tue, 5 Jul 2022 11:32:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DE78385828E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alok Kumar Sharma To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Support for location and range lists for split-dwarf and dwarf-5. X-Act-Checkin: binutils-gdb X-Git-Author: Bhuvanendra Kumar N X-Git-Refname: refs/heads/master X-Git-Oldrev: c368d2a8023052c011b5029471de4f42605c1ed3 X-Git-Newrev: 4694a0e5fe233c5a33f0e4e4b99c9c92021b8c88 Message-Id: <20220705113255.3DE78385828E@sourceware.org> Date: Tue, 5 Jul 2022 11:32:55 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 11:32:55 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4694a0e5fe23= 3c5a33f0e4e4b99c9c92021b8c88 commit 4694a0e5fe233c5a33f0e4e4b99c9c92021b8c88 Author: Bhuvanendra Kumar N Date: Tue Jul 5 16:53:45 2022 +0530 Support for location and range lists for split-dwarf and dwarf-5. =20 Adding support for location and range lists for split-dwarf and dwarf-5. Following issues are taken care. 1. Display of the index values for DW_FORM_loclistx and DW_FORM_rnglist= x. 2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections. =20 * dwarf.c(read_and_display_attr_value): Handle DW_FORM_loclistx and DW_FORM_rnglistx for .dwo files. (process_debug_info): Load .debug_loclists.dwo and .debug_rnglists.dwo if exists. (load_separate_debug_files): Load .debug_loclists and .debug_rnglists if exists. Include 2 entries in debug_displays table. * dwarf.h (enum dwarf_section_display_enum): Include 2 entries. Diff: --- binutils/dwarf.c | 41 ++++++++++++++++++++++++++++++++--------- binutils/dwarf.h | 2 ++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 71f2617e5a7..beb69544e38 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -2744,10 +2744,17 @@ read_and_display_attr_value (unsigned long = attribute, if (!do_loc) { dwarf_vma base, index; + const char *suffix =3D strrchr (section->name, '.'); + bool dwo =3D suffix && strcmp (suffix, ".dwo") =3D=3D 0; =20 if (form =3D=3D DW_FORM_loclistx) { - if (debug_info_p =3D=3D NULL) + if (dwo) + { + index =3D fetch_indexed_value (uvalue, loclists_dwo, 0); + index +=3D (offset_size =3D=3D 8) ? 20 : 12; + } + else if (debug_info_p =3D=3D NULL) { index =3D fetch_indexed_value (uvalue, loclists, 0); } @@ -2763,14 +2770,22 @@ read_and_display_attr_value (unsigned long = attribute, } else if (form =3D=3D DW_FORM_rnglistx) { - if (debug_info_p =3D=3D NULL) - base =3D 0; + if (dwo) + { + index =3D fetch_indexed_value (uvalue, rnglists_dwo, 0); + index +=3D (offset_size =3D=3D 8) ? 20 : 12; + } else - base =3D debug_info_p->rnglists_base; - /* We do not have a cached value this time, so we perform the - computation manually. */ - index =3D fetch_indexed_value (uvalue, rnglists, base); - index +=3D base; + { + if (debug_info_p =3D=3D NULL) + base =3D 0; + else + base =3D debug_info_p->rnglists_base; + /* We do not have a cached value this time, so we perform the + computation manually. */ + index =3D fetch_indexed_value (uvalue, rnglists, base); + index +=3D base; + } } else { @@ -3623,7 +3638,9 @@ process_debug_info (struct dwarf_section * section, load_debug_section_with_follow (abbrev_sec, file); load_debug_section_with_follow (loclists, file); load_debug_section_with_follow (rnglists, file); - =20 + load_debug_section_with_follow (loclists_dwo, file); + load_debug_section_with_follow (rnglists_dwo, file); + if (debug_displays [abbrev_sec].section.start =3D=3D NULL) { warn (_("Unable to locate %s section!\n"), @@ -11959,6 +11976,10 @@ load_separate_debug_files (void * file, const char= * filename) load_debug_section (debug_addr, file); /* Load the .debug_str_offsets section, if it exists. */ load_debug_section (str_index, file); + /* Load the .debug_loclists section, if it exists. */ + load_debug_section (loclists, file); + /* Load the .debug_rnglists section, if it exists. */ + load_debug_section (rnglists, file); =20 free_dwo_info (); =20 @@ -12292,10 +12313,12 @@ struct dwarf_section_display debug_displays[] =3D { { ".debug_line_str", ".zdebug_line_str", "", NO_ABBREVS }, = display_debug_str, &do_debug_str, false }, { { ".debug_loc", ".zdebug_loc", ".dwloc", NO_ABBREVS }, d= isplay_debug_loc, &do_debug_loc, true }, { { ".debug_loclists", ".zdebug_loclists", "", NO_ABBREVS }, = display_debug_loc, &do_debug_loc, true }, + { { ".debug_loclists.dwo", ".zdebug_loclists.dwo", "", NO_ABBREV= S }, display_debug_loc, &do_debug_loc, true }, { { ".debug_pubtypes", ".zdebug_pubtypes", ".dwpbtyp", NO_ABBREV= S }, display_debug_pubnames, &do_debug_pubtypes, false }, { { ".debug_gnu_pubtypes", ".zdebug_gnu_pubtypes", "", NO_ABBREVS }, = display_debug_gnu_pubnames, &do_debug_pubtypes, false }, { { ".debug_ranges", ".zdebug_ranges", ".dwrnges", NO_ABBREVS }= , display_debug_ranges, &do_debug_ranges, true }, { { ".debug_rnglists", ".zdebug_rnglists", "", NO_ABBREVS }, = display_debug_ranges, &do_debug_ranges, true }, + { { ".debug_rnglists.dwo", ".zdebug_rnglists.dwo", "", NO_ABBREV= S }, display_debug_ranges, &do_debug_ranges, true }, { { ".debug_static_func", ".zdebug_static_func", "", NO_ABBREVS }, = display_debug_not_supported, NULL, false }, { { ".debug_static_vars", ".zdebug_static_vars", "", NO_ABBREVS }, = display_debug_not_supported, NULL, false }, { { ".debug_types", ".zdebug_types", "", ABBREV (abbrev) }, di= splay_debug_types, &do_debug_info, true }, diff --git a/binutils/dwarf.h b/binutils/dwarf.h index adbf20f9a28..d21e6c1b080 100644 --- a/binutils/dwarf.h +++ b/binutils/dwarf.h @@ -92,10 +92,12 @@ enum dwarf_section_display_enum line_str, loc, loclists, + loclists_dwo, pubtypes, gnu_pubtypes, ranges, rnglists, + rnglists_dwo, static_func, static_vars, types,