public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
@ 2020-05-04  6:13 nitachra
  2020-05-07 13:26 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: nitachra @ 2020-05-04  6:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: JiniSusan.George, nitachra

Requesting review for the patch.

Regards,
Nitika

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..0bb8135e09 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
  2020-05-04  6:13 [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form nitachra
@ 2020-05-07 13:26 ` Tom Tromey
  2020-05-08 14:36   ` Tom de Vries
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2020-05-07 13:26 UTC (permalink / raw)
  To: nitachra; +Cc: gdb-patches, JiniSusan.George

>>>>> ">" == nitachra  <Nitika.Achra@amd.com> writes:

>> 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;
>> }

Does it fail some existing test in the gdb testsuite?
Normally what we like to see is either that a patch fixes some existing
failure (perhaps when the test suite is run in a certain way); or a new
test that fails before the patch and passes afterward.

>> +	case DW_IDX_die_offset:
>> +	  /* In a per_cu index, index entries without CU attribute implicitly refer to the

This line looks too long to me.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
  2020-05-07 13:26 ` Tom Tromey
@ 2020-05-08 14:36   ` Tom de Vries
  2020-05-08 15:16     ` Tom de Vries
  0 siblings, 1 reply; 6+ messages in thread
From: Tom de Vries @ 2020-05-08 14:36 UTC (permalink / raw)
  To: Tom Tromey, nitachra; +Cc: JiniSusan.George, gdb-patches

On 07-05-2020 15:26, Tom Tromey wrote:
>>>>>> ">" == nitachra  <Nitika.Achra@amd.com> writes:
> 
>>> 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;
>>> }
> 
> Does it fail some existing test in the gdb testsuite?

I don't think so, that is, not unless you use:
- clang as CC_FOR_TARGET, and
- target board unix/-gdwarf-5/-gpubnames.

> Normally what we like to see is either that a patch fixes some existing
> failure (perhaps when the test suite is run in a certain way); or a new
> test that fails before the patch and passes afterward.
> 

I've add a dwarf assembly test-case for this (
https://sourceware.org/pipermail/gdb-patches/2020-May/168244.html ).

It should kfail without this patch, and pass with this patch (though it
doesn't pass for me on openSUSE due to the problem described in PR25941).

Thanks,
- Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
  2020-05-08 14:36   ` Tom de Vries
@ 2020-05-08 15:16     ` Tom de Vries
  2020-05-09  8:05       ` Tom de Vries
  0 siblings, 1 reply; 6+ messages in thread
From: Tom de Vries @ 2020-05-08 15:16 UTC (permalink / raw)
  To: Tom Tromey, nitachra; +Cc: JiniSusan.George, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On 08-05-2020 16:36, Tom de Vries wrote:
> On 07-05-2020 15:26, Tom Tromey wrote:
>>>>>>> ">" == nitachra  <Nitika.Achra@amd.com> writes:
>>
>>>> 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;
>>>> }
>>
>> Does it fail some existing test in the gdb testsuite?
> 
> I don't think so, that is, not unless you use:
> - clang as CC_FOR_TARGET, and
> - target board unix/-gdwarf-5/-gpubnames.
> 
>> Normally what we like to see is either that a patch fixes some existing
>> failure (perhaps when the test suite is run in a certain way); or a new
>> test that fails before the patch and passes afterward.
>>
> 
> I've add a dwarf assembly test-case for this (
> https://sourceware.org/pipermail/gdb-patches/2020-May/168244.html ).
> 
> It should kfail without this patch, and pass with this patch (though it
> doesn't pass for me on openSUSE due to the problem described in PR25941).
> 

So, if someone can verify that the test-case passes with this patch,
I'll commit.

Thanks,
- Tom


[-- Attachment #2: 0001-Fix-for-the-complaint-observed-when-symbol-reading-due-to-unsupported-.debug_names-form.patch --]
[-- Type: text/x-patch, Size: 3406 bytes --]

Fix for the complaint observed when symbol reading due to unsupported .debug_names form

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 test.out]
Temporary breakpoint 1 at 0x400484
Starting program: test.out
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]

gdb/dwarf2/ChangeLog:

2020-05-08  Nitika Achra  <Nitika.Achra@amd.com>

	PR symtab/25952
	* 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/testsuite/ChangeLog:

2020-05-08  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/clang-debug-names.exp: Remove PR25952 kfail.

---
 gdb/dwarf2/read.c                              | 18 ++++++++++++++++++
 gdb/testsuite/gdb.dwarf2/clang-debug-names.exp | 13 +------------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ac208991ff..fc48bb6006 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 (as opposed to a per-module 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;
diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp
index 8bd60401c4..a6e33c1d89 100644
--- a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp
+++ b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp
@@ -142,15 +142,4 @@ set pass_re \
     [multi_line \
 	 $cmd \
 	 "type = int \\(\\)"]
-set kfail_re \
-    [multi_line \
-	 $cmd \
-	 "type = <unknown return type> \\(\\)"]
-gdb_test_multiple $cmd "" {
-    -re -wrap $pass_re {
-	pass $gdb_test_name
-    }
-    -re -wrap $kfail_re {
-	kfail symtab/25952 $gdb_test_name
-    }
-}
+gdb_test $cmd $pass_re

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
  2020-05-08 15:16     ` Tom de Vries
@ 2020-05-09  8:05       ` Tom de Vries
  0 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2020-05-09  8:05 UTC (permalink / raw)
  To: Tom Tromey, nitachra; +Cc: JiniSusan.George, gdb-patches

On 08-05-2020 17:16, Tom de Vries wrote:
> On 08-05-2020 16:36, Tom de Vries wrote:
>> On 07-05-2020 15:26, Tom Tromey wrote:
>>>>>>>> ">" == nitachra  <Nitika.Achra@amd.com> writes:
>>>
>>>>> 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;
>>>>> }
>>>
>>> Does it fail some existing test in the gdb testsuite?
>>
>> I don't think so, that is, not unless you use:
>> - clang as CC_FOR_TARGET, and
>> - target board unix/-gdwarf-5/-gpubnames.
>>
>>> Normally what we like to see is either that a patch fixes some existing
>>> failure (perhaps when the test suite is run in a certain way); or a new
>>> test that fails before the patch and passes afterward.
>>>
>>
>> I've add a dwarf assembly test-case for this (
>> https://sourceware.org/pipermail/gdb-patches/2020-May/168244.html ).
>>
>> It should kfail without this patch, and pass with this patch (though it
>> doesn't pass for me on openSUSE due to the problem described in PR25941).
>>
> 
> So, if someone can verify that the test-case passes with this patch,
> I'll commit.

I've done this on an ubuntu 18.04 system.

Committed.

Thanks,
- Tom



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form.
@ 2020-05-11 17:50 nitachra
  0 siblings, 0 replies; 6+ messages in thread
From: nitachra @ 2020-05-11 17:50 UTC (permalink / raw)
  To: gdb-patches, tom, tdevries; +Cc: JiniSusan.George, nitachra

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-11 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04  6:13 [PATCH] Fix for the complaint observed when symbol reading due to unsupported .debug_names form 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
2020-05-11 17:50 nitachra

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).