Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: nitachra <Nitika.Achra@amd.com>
To: gdb-patches@sourceware.org, tom@tromey.com, tdevries@suse.de
Cc: JiniSusan.George@amd.com, nitachra <Nitika.Achra@amd.com>
Subject: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
Date: Mon, 11 May 2020 23:20:22 +0530	[thread overview]
Message-ID: <20200511175022.26123-1-Nitika.Achra@amd.com> (raw)

Thanks Tom for the review. Incorporated the review comment.
Thanks Tom de Vries for adding the test case. This test fails before the patch 
and pass afterward.

---
Following complaint is observed with the executable compiled with -gdwarf-5
and -gpubnames flags- "During symbol reading: Unsupported .debug_names form
DW_FORM_ref4". This is the form corresponding to DW_IDX_die_offset attribute.
This patch fixes this complaint. Tested with clang 10.0.0. Test case used-

int main()
{
int sum,a,b;
sum = a + b;
return sum;
}

clang -gdwarf-5 -gpubnames test.c -o test.out

gdb -q test.out -ex "set complaints 1" -ex "start"

Reading symbols from test.out...
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module
/home/nitika/workspace/test.out] Temporary breakpoint 1 at 0x400484
Starting program: /home/nitika/workspace/test.out
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module
/home/nitika/workspace/test.out]
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module
/home/nitika/workspace/test.out]
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 [in module
/home/nitika/workspace/test.out]

gdb/dwarf2/ChangeLog:

*read.c (dw2_debug_names_iterator::next): Handle DW_FORM_ref*
 and DW_IDX_die_offset. If there is no compilation unit attribute in the index
 entry, then there is a single CU. Return the CU at O index of compilation
 unit vector.
---
 gdb/dwarf2/read.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 1813085d0d..08a3bed1a9 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5352,6 +5352,18 @@ dw2_debug_names_iterator::next ()
 	  ull = read_unsigned_leb128 (abfd, m_addr, &bytes_read);
 	  m_addr += bytes_read;
 	  break;
+	case DW_FORM_ref4:
+	  ull = read_4_bytes (abfd, m_addr);
+	  m_addr += 4;
+	  break;
+	case DW_FORM_ref8:
+	  ull = read_8_bytes (abfd, m_addr);
+	  m_addr += 8;
+	  break;
+	case DW_FORM_ref_sig8:
+	  ull = read_8_bytes (abfd, m_addr);
+	  m_addr += 8;
+	  break;
 	default:
 	  complaint (_("Unsupported .debug_names form %s [in module %s]"),
 		     dwarf_form_name (attr.form),
@@ -5384,6 +5396,12 @@ dw2_debug_names_iterator::next ()
 	    }
 	  per_cu = &dwarf2_per_objfile->get_tu (ull)->per_cu;
 	  break;
+	case DW_IDX_die_offset:
+	  /* In a per_cu index, index entries without CU attribute implicitly
+	     refer to the single CU.  */
+	  if (per_cu == NULL)
+	    per_cu = dwarf2_per_objfile->get_cu (0);
+	  break;
 	case DW_IDX_GNU_internal:
 	  if (!m_map.augmentation_is_gdb)
 	    break;
-- 
2.17.1



             reply	other threads:[~2020-05-11 17:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 17:50 nitachra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-05-04  6:13 nitachra
2020-05-07 13:26 ` Tom Tromey
2020-05-08 14:36   ` Tom de Vries
2020-05-08 15:16     ` Tom de Vries
2020-05-09  8:05       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200511175022.26123-1-Nitika.Achra@amd.com \
    --to=nitika.achra@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox