* [PATCH] Support for location and range lists for split-dwarf and dwarf-5
@ 2022-07-04 20:54 Kumar N, Bhuvanendra
2022-07-05 10:24 ` Nick Clifton
0 siblings, 1 reply; 3+ messages in thread
From: Kumar N, Bhuvanendra @ 2022-07-04 20:54 UTC (permalink / raw)
To: binutils; +Cc: George, Jini Susan, Natarajan, Kavitha
[-- Attachment #1: Type: text/plain, Size: 6691 bytes --]
[Public]
Hi,
As part of some of the previous fixes for "split-dwarf and dwarf-5", new/updated attributes/forms used to represent DWO name and DWO ID were taken care and display of basic sections like .debug_info.dwo, .debug_abbrev.dwo, .debug_str.dwo etc. works fine. i.e. separate debug file(DWO file) was recognized and basic sections dump works fine.
This patch takes care of .debug_loclists.dwo and .debug_rnglists.dwo sections dump and index values for DW_FORM_loclistx and DW_FORM_rnglistx.
PATCH inlined :
From e3e13e7082467382d9df202d67e693ee7e7fe3e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= Bhuvanendra.KumarN@amd.com<mailto:Bhuvanendra.KumarN@amd.com>
Date: Tue, 5 Jul 2022 01:26:48 +0530
Subject: [PATCH] [PATCH] Support for location and range lists for split-dwarf
and dwarf-5.
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_rnglistx.
2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections.
* 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.
Change-Id: I0a39ab3c4d77b80f1fdbb2b4532d51ac20d2b99b
---
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 744ff932b9d..2b1eec49422 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 = strrchr (section->name, '.');
+ bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
if (form == DW_FORM_loclistx)
{
- if (debug_info_p == NULL)
+ if (dwo)
+ {
+ index = fetch_indexed_value (uvalue, loclists_dwo, 0);
+ index += (offset_size == 8) ? 20 : 12;
+ }
+ else if (debug_info_p == NULL)
{
index = fetch_indexed_value (uvalue, loclists, 0);
}
@@ -2763,14 +2770,22 @@ read_and_display_attr_value (unsigned long attribute,
}
else if (form == DW_FORM_rnglistx)
{
- if (debug_info_p == NULL)
- base = 0;
+ if (dwo)
+ {
+ index = fetch_indexed_value (uvalue, rnglists_dwo, 0);
+ index += (offset_size == 8) ? 20 : 12;
+ }
else
- base = debug_info_p->rnglists_base;
- /* We do not have a cached value this time, so we perform the
- computation manually. */
- index = fetch_indexed_value (uvalue, rnglists, base);
- index += base;
+ {
+ if (debug_info_p == NULL)
+ base = 0;
+ else
+ base = debug_info_p->rnglists_base;
+ /* We do not have a cached value this time, so we perform the
+ computation manually. */
+ index = fetch_indexed_value (uvalue, rnglists, base);
+ index += base;
+ }
}
else
{
@@ -3624,7 +3639,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);
-
+ load_debug_section_with_follow (loclists_dwo, file);
+ load_debug_section_with_follow (rnglists_dwo, file);
+
if (debug_displays [abbrev_sec].section.start == NULL)
{
warn (_("Unable to locate %s section!\n"),
@@ -11960,6 +11977,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);
free_dwo_info ();
@@ -12293,10 +12314,12 @@ struct dwarf_section_display debug_displays[] =
{ { ".debug_line_str", ".zdebug_line_str", "", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
{ { ".debug_loc", ".zdebug_loc", ".dwloc", NO_ABBREVS }, display_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_ABBREVS }, display_debug_loc, &do_debug_loc, true },
{ { ".debug_pubtypes", ".zdebug_pubtypes", ".dwpbtyp", NO_ABBREVS }, 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_ABBREVS }, 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) }, display_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,
--
2.17.1
[-- Attachment #2: 0001-PATCH-Support-for-location-and-range-lists-for-split.patch --]
[-- Type: application/octet-stream, Size: 5720 bytes --]
From e3e13e7082467382d9df202d67e693ee7e7fe3e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= <Bhuvanendra.KumarN@amd.com>
Date: Tue, 5 Jul 2022 01:26:48 +0530
Subject: [PATCH] [PATCH] Support for location and range lists for split-dwarf
and dwarf-5.
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_rnglistx.
2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections.
* 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.
Change-Id: I0a39ab3c4d77b80f1fdbb2b4532d51ac20d2b99b
---
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 744ff932b9d..2b1eec49422 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 = strrchr (section->name, '.');
+ bool dwo = suffix && strcmp (suffix, ".dwo") == 0;
if (form == DW_FORM_loclistx)
{
- if (debug_info_p == NULL)
+ if (dwo)
+ {
+ index = fetch_indexed_value (uvalue, loclists_dwo, 0);
+ index += (offset_size == 8) ? 20 : 12;
+ }
+ else if (debug_info_p == NULL)
{
index = fetch_indexed_value (uvalue, loclists, 0);
}
@@ -2763,14 +2770,22 @@ read_and_display_attr_value (unsigned long attribute,
}
else if (form == DW_FORM_rnglistx)
{
- if (debug_info_p == NULL)
- base = 0;
+ if (dwo)
+ {
+ index = fetch_indexed_value (uvalue, rnglists_dwo, 0);
+ index += (offset_size == 8) ? 20 : 12;
+ }
else
- base = debug_info_p->rnglists_base;
- /* We do not have a cached value this time, so we perform the
- computation manually. */
- index = fetch_indexed_value (uvalue, rnglists, base);
- index += base;
+ {
+ if (debug_info_p == NULL)
+ base = 0;
+ else
+ base = debug_info_p->rnglists_base;
+ /* We do not have a cached value this time, so we perform the
+ computation manually. */
+ index = fetch_indexed_value (uvalue, rnglists, base);
+ index += base;
+ }
}
else
{
@@ -3624,7 +3639,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);
-
+ load_debug_section_with_follow (loclists_dwo, file);
+ load_debug_section_with_follow (rnglists_dwo, file);
+
if (debug_displays [abbrev_sec].section.start == NULL)
{
warn (_("Unable to locate %s section!\n"),
@@ -11960,6 +11977,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);
free_dwo_info ();
@@ -12293,10 +12314,12 @@ struct dwarf_section_display debug_displays[] =
{ { ".debug_line_str", ".zdebug_line_str", "", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
{ { ".debug_loc", ".zdebug_loc", ".dwloc", NO_ABBREVS }, display_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_ABBREVS }, display_debug_loc, &do_debug_loc, true },
{ { ".debug_pubtypes", ".zdebug_pubtypes", ".dwpbtyp", NO_ABBREVS }, 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_ABBREVS }, 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) }, display_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,
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Support for location and range lists for split-dwarf and dwarf-5
2022-07-04 20:54 [PATCH] Support for location and range lists for split-dwarf and dwarf-5 Kumar N, Bhuvanendra
@ 2022-07-05 10:24 ` Nick Clifton
2022-07-05 11:34 ` Kumar N, Bhuvanendra
0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2022-07-05 10:24 UTC (permalink / raw)
To: Kumar N, Bhuvanendra, binutils; +Cc: George, Jini Susan, Natarajan, Kavitha
Hi Kumar,
> * 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.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] Support for location and range lists for split-dwarf and dwarf-5
2022-07-05 10:24 ` Nick Clifton
@ 2022-07-05 11:34 ` Kumar N, Bhuvanendra
0 siblings, 0 replies; 3+ messages in thread
From: Kumar N, Bhuvanendra @ 2022-07-05 11:34 UTC (permalink / raw)
To: Nick Clifton, binutils
Cc: George, Jini Susan, Natarajan, Kavitha, Sharma, Alok Kumar
[AMD Official Use Only - General]
Thanks, I pushed the fix now
commit 4694a0e5fe233c5a33f0e4e4b99c9c92021b8c88 (HEAD -> master, origin/master, origin/HEAD)
Author: Bhuvanendra Kumar N <Bhuvanendra.KumarN@amd.com>
Date: Tue Jul 5 16:53:45 2022 +0530
Support for location and range lists for split-dwarf and dwarf-5.
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_rnglistx.
2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections.
* 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.
-----Original Message-----
From: Nick Clifton <nickc@redhat.com>
Sent: Tuesday, July 5, 2022 3:54 PM
To: Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>; binutils@sourceware.org
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Natarajan, Kavitha <Kavitha.Natarajan@amd.com>
Subject: Re: [PATCH] Support for location and range lists for split-dwarf and dwarf-5
[CAUTION: External Email]
Hi Kumar,
> * 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.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-05 11:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 20:54 [PATCH] Support for location and range lists for split-dwarf and dwarf-5 Kumar N, Bhuvanendra
2022-07-05 10:24 ` Nick Clifton
2022-07-05 11:34 ` Kumar N, Bhuvanendra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).