public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Correction of gdb.dwarf2/pr13961.S
@ 2021-02-01  8:00 Sharma, Alok Kumar
  2021-02-01 17:03 ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Sharma, Alok Kumar @ 2021-02-01  8:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

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

Hi all,

I request you all to please review the patch. Below are the details.

Problem Description:
    Please consider output of objdump for the executable generated from pr13961.S
    -------------
    Contents of the .debug_info section:
    ...
     <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
        <63>   DW_AT_name        : foo2
        <68>   DW_AT_byte_size   : 4
        <69>   DW_AT_decl_file   : 1
        <6a>   DW_AT_decl_line   : 1
        <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
    ...
    Contents of the .debug_types section:
    ...
     <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
        <26>   DW_AT_specification: <0x2a>
     <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
        <2b>   DW_AT_name        : foo
        <2f>   DW_AT_byte_size   : 4
        <30>   DW_AT_decl_file   : 1
        <31>   DW_AT_decl_line   : 1
        <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
     <2><36>: Abbrev Number: 3 (DW_TAG_member)
        <37>   DW_AT_name        : bar
        <3b>   DW_AT_decl_file   : 1
        <3c>   DW_AT_decl_line   : 4
        <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
        <41>   DW_AT_data_member_location: 0
        <42>   DW_AT_accessibility: 1       (public)
     <2><43>: Abbrev Number: 0
     <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
        <45>   DW_AT_byte_size   : 4
        <46>   DW_AT_encoding    : 5        (signed)
        <47>   DW_AT_name        : int
    ...
    ---------------
    The original assembly is generated from a source file and then
    modified to insert DIE, with that the subsequent DIE references
    should have been updated, which were not.
    It is now getting updated to replace hardcoded DIE references with
    label-calculated references.

    gdb/testsuite/ChangeLog:

    2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>

            * gdb.dwarf2/pr13961.S: Corrected invalid DIE references.

Regards,
Alok

[-- Attachment #2: 0001-Correction-of-gdb.dwarf2-pr13961.S.patch --]
[-- Type: application/octet-stream, Size: 5325 bytes --]

From 8fc595cd25319689593e33545071f509be93141b Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 1 Feb 2021 10:24:59 +0530
Subject: [PATCH] Correction of gdb.dwarf2/pr13961.S

Please consider output of objdump for the executable generated from pr13961.S
-------------
Contents of the .debug_info section:
...
 <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
    <63>   DW_AT_name        : foo2
    <68>   DW_AT_byte_size   : 4
    <69>   DW_AT_decl_file   : 1
    <6a>   DW_AT_decl_line   : 1
    <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
...
Contents of the .debug_types section:
...
 <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
    <26>   DW_AT_specification: <0x2a>
 <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
    <2b>   DW_AT_name        : foo
    <2f>   DW_AT_byte_size   : 4
    <30>   DW_AT_decl_file   : 1
    <31>   DW_AT_decl_line   : 1
    <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
 <2><36>: Abbrev Number: 3 (DW_TAG_member)
    <37>   DW_AT_name        : bar
    <3b>   DW_AT_decl_file   : 1
    <3c>   DW_AT_decl_line   : 4
    <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
    <41>   DW_AT_data_member_location: 0
    <42>   DW_AT_accessibility: 1       (public)
 <2><43>: Abbrev Number: 0
 <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
    <45>   DW_AT_byte_size   : 4
    <46>   DW_AT_encoding    : 5        (signed)
    <47>   DW_AT_name        : int
...
---------------
The original assembly is generated from a source file and then
modified to insert DIE, with that the subsequent DIE references
should have been updated, which were not.
It is now getting updated to replace hardcoded DIE references with
label-calculated references.

gdb/testsuite/ChangeLog:

2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>

	* gdb.dwarf2/pr13961.S: Corrected invalide DIE references.

Change-Id: I4ed35bee37eb78715b8d913a8f4c96793d655502
---
 gdb/testsuite/ChangeLog            |  4 ++++
 gdb/testsuite/gdb.dwarf2/pr13961.S | 24 +++++++++++++-----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 36ba5d01c40..2cb676944a3 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
+
+	* gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
+
 2021-01-29  Tom de Vries  <tdevries@suse.de>
 
 	PR breakpoints/26063
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S
index 809e921215d..a6ba72ee3b3 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.S
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
@@ -103,26 +103,27 @@ SYMBOL(main):
 
 	/* Manually inserted to have a DW_AT_specification refering to
 	   something and appearing ahead of it.  */
-	.uleb128 0x8	/* DW_TAG_class_type */
+	.uleb128 0x8	/* (DIE (0x25) DW_TAG_class_type) */
 	.4byte .Ltu_class_type - .Ldebug_types0
 	/* End of manual insertion */
 
 .Ltu_class_type:
-	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
+	.uleb128 0x2	/* (DIE (0x2a) DW_TAG_class_type) */
 	.ascii "foo\0"	/* DW_AT_name */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
 	.byte	0x1	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_sibling */
-	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
+	.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_sibling */
+	.uleb128 0x3	/* (DIE (0x36) DW_TAG_member) */
 	.ascii "bar\0"	/* DW_AT_name */
 	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
 	.byte	0x4	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_type */
+	.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_type */
 	.byte	0	/* DW_AT_data_member_location */
 	.byte	0x1	/* DW_AT_accessibility */
 	.byte	0	/* end of children of DIE 0x25 */
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
+.Ltu_base_type:
+	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x5	/* DW_AT_encoding */
 	.ascii "int\0"	/* DW_AT_name */
@@ -184,7 +185,7 @@ SYMBOL(main):
 	.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
 
 .Lcu_int_type:
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
+	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x5	/* DW_AT_encoding */
 	.ascii "int\0"	/* DW_AT_name */
@@ -194,16 +195,17 @@ SYMBOL(main):
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
 	.byte	0x1	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_sibling */
-	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
+	.4byte	.Lcu_second_int_type - .Ldebug_info0	/* DW_AT_sibling */
+	.uleb128 0x3	/* (DIE (0x36) DW_TAG_member) */
 	.ascii "bar\0"	/* DW_AT_name */
 	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
 	.byte	0x4	/* DW_AT_decl_line */
-	.4byte	.Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
+	.4byte	.Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
 	.byte	0	/* DW_AT_data_member_location */
 	.byte	0x1	/* DW_AT_accessibility */
 	.byte	0	/* end of children of DIE 0x25 */
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
+.Lcu_second_int_type:
+	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x5	/* DW_AT_encoding */
 	.ascii "int\0"	/* DW_AT_name */
-- 
2.17.1


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

* Re: [PATCH] Correction of gdb.dwarf2/pr13961.S
  2021-02-01  8:00 [PATCH] Correction of gdb.dwarf2/pr13961.S Sharma, Alok Kumar
@ 2021-02-01 17:03 ` Simon Marchi
  2021-02-02  5:47   ` Sharma, Alok Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-02-01 17:03 UTC (permalink / raw)
  To: Sharma, Alok Kumar, gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

From 8fc595cd25319689593e33545071f509be93141b Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 1 Feb 2021 10:24:59 +0530
Subject: [PATCH] Correction of gdb.dwarf2/pr13961.S

> Please consider output of objdump for the executable generated from pr13961.S
> -------------
> Contents of the .debug_info section:
> ...
>  <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
>     <63>   DW_AT_name        : foo2
>     <68>   DW_AT_byte_size   : 4
>     <69>   DW_AT_decl_file   : 1
>     <6a>   DW_AT_decl_line   : 1
>     <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
> ...
> Contents of the .debug_types section:
> ...
>  <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
>     <26>   DW_AT_specification: <0x2a>
>  <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
>     <2b>   DW_AT_name        : foo
>     <2f>   DW_AT_byte_size   : 4
>     <30>   DW_AT_decl_file   : 1
>     <31>   DW_AT_decl_line   : 1
>     <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
>  <2><36>: Abbrev Number: 3 (DW_TAG_member)
>     <37>   DW_AT_name        : bar
>     <3b>   DW_AT_decl_file   : 1
>     <3c>   DW_AT_decl_line   : 4
>     <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
>     <41>   DW_AT_data_member_location: 0
>     <42>   DW_AT_accessibility: 1       (public)
>  <2><43>: Abbrev Number: 0
>  <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
>     <45>   DW_AT_byte_size   : 4
>     <46>   DW_AT_encoding    : 5        (signed)
>     <47>   DW_AT_name        : int
> ...
> ---------------
> The original assembly is generated from a source file and then
> modified to insert DIE, with that the subsequent DIE references
> should have been updated, which were not.
> It is now getting updated to replace hardcoded DIE references with
> label-calculated references.
> 
> gdb/testsuite/ChangeLog:
> 
> 2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
> 
> 	* gdb.dwarf2/pr13961.S: Corrected invalide DIE references.
> 
> Change-Id: I4ed35bee37eb78715b8d913a8f4c96793d655502
> ---
>  gdb/testsuite/ChangeLog            |  4 ++++
>  gdb/testsuite/gdb.dwarf2/pr13961.S | 24 +++++++++++++-----------
>  2 files changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
> index 36ba5d01c40..2cb676944a3 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
> +
> +	* gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
> +
>  2021-01-29  Tom de Vries  <tdevries@suse.de>
>  
>  	PR breakpoints/26063
> diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S
> index 809e921215d..a6ba72ee3b3 100644
> --- a/gdb/testsuite/gdb.dwarf2/pr13961.S
> +++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
> @@ -103,26 +103,27 @@ SYMBOL(main):
>  
>  	/* Manually inserted to have a DW_AT_specification refering to
>  	   something and appearing ahead of it.  */
> -	.uleb128 0x8	/* DW_TAG_class_type */
> +	.uleb128 0x8	/* (DIE (0x25) DW_TAG_class_type) */
>  	.4byte .Ltu_class_type - .Ldebug_types0
>  	/* End of manual insertion */
>  
>  .Ltu_class_type:
> -	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
> +	.uleb128 0x2	/* (DIE (0x2a) DW_TAG_class_type) */
>  	.ascii "foo\0"	/* DW_AT_name */
>  	.byte	0x4	/* DW_AT_byte_size */
>  	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
>  	.byte	0x1	/* DW_AT_decl_line */
> -	.4byte	0x3f	/* DW_AT_sibling */
> -	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
> +	.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_sibling */
> +	.uleb128 0x3	/* (DIE (0x36) DW_TAG_member) */
>  	.ascii "bar\0"	/* DW_AT_name */
>  	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
>  	.byte	0x4	/* DW_AT_decl_line */
> -	.4byte	0x3f	/* DW_AT_type */
> +	.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_type */
>  	.byte	0	/* DW_AT_data_member_location */
>  	.byte	0x1	/* DW_AT_accessibility */
>  	.byte	0	/* end of children of DIE 0x25 */
> -	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
> +.Ltu_base_type:
> +	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */
>  	.byte	0x4	/* DW_AT_byte_size */
>  	.byte	0x5	/* DW_AT_encoding */
>  	.ascii "int\0"	/* DW_AT_name */
> @@ -184,7 +185,7 @@ SYMBOL(main):
>  	.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
>  
>  .Lcu_int_type:
> -	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
> +	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */

I don't understand the new updated offsets, in parenthesis.  For
examples, this int DIE ends up at 0x5b for me, not 0x44:


    0x00000056:   DW_TAG_class_type
                    DW_AT_specification [DW_FORM_ref4]      (0x00000062 "foo2")

    0x0000005b:   DW_TAG_base_type
                    DW_AT_byte_size [DW_FORM_data1] (0x04)
                    DW_AT_encoding [DW_FORM_data1]  (DW_ATE_signed)
                    DW_AT_name [DW_FORM_string]     ("int")

I think it would be fine to just remove them.

What would help reading though would be to add some empty lines to
separates DIEs, and use indentation for children DIEs, a bit like this:

.Lcu_int_type:
	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */
	.byte	0x4	/* DW_AT_byte_size */
	.byte	0x5	/* DW_AT_encoding */
	.ascii "int\0"	/* DW_AT_name */

.Lcu_class_type:
	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
	.ascii "foo2\0"	/* DW_AT_name */
	.byte	0x4	/* DW_AT_byte_size */
	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
	.byte	0x1	/* DW_AT_decl_line */
	.4byte	.Lcu_second_int_type - .Ldebug_info0	/* DW_AT_sibling */

	    .uleb128 0x3	/* (DIE (0x36) DW_TAG_member) */
	    .ascii "bar\0"	/* DW_AT_name */
	    .byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
	    .byte	0x4	/* DW_AT_decl_line */
	    .4byte	.Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
	    .byte	0	/* DW_AT_data_member_location */
	    .byte	0x1	/* DW_AT_accessibility */

	.byte	0	/* end of children of DIE 0x25 */

.Lcu_second_int_type:
	.uleb128 0x4	/* (DIE (0x44) DW_TAG_base_type) */
	.byte	0x4	/* DW_AT_byte_size */
	.byte	0x5	/* DW_AT_encoding */
	.ascii "int\0"	/* DW_AT_name */
	/* End of manual insertion */

That makes it easier to follow with the objdump / llvm-dwarfdump output
on the side.

>  	.byte	0x4	/* DW_AT_byte_size */
>  	.byte	0x5	/* DW_AT_encoding */
>  	.ascii "int\0"	/* DW_AT_name */
> @@ -194,16 +195,17 @@ SYMBOL(main):
>  	.byte	0x4	/* DW_AT_byte_size */
>  	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
>  	.byte	0x1	/* DW_AT_decl_line */
> -	.4byte	0x3f	/* DW_AT_sibling */
> -	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
> +	.4byte	.Lcu_second_int_type - .Ldebug_info0	/* DW_AT_sibling */
> +	.uleb128 0x3	/* (DIE (0x36) DW_TAG_member) */
>  	.ascii "bar\0"	/* DW_AT_name */
>  	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
>  	.byte	0x4	/* DW_AT_decl_line */
> -	.4byte	.Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
> +	.4byte	.Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */

I don't understand why that one changes.  It referred to the first int
type, why does it now refer to the second int type?

Simon

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

* RE: [PATCH] Correction of gdb.dwarf2/pr13961.S
  2021-02-01 17:03 ` Simon Marchi
@ 2021-02-02  5:47   ` Sharma, Alok Kumar
  2021-02-08  4:31     ` Sharma, Alok Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Sharma, Alok Kumar @ 2021-02-02  5:47 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

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

Hi Simon,

Thanks for your comments. Please find the updated patch.

---------------- 
> -     .4byte  .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
> +     .4byte  .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */

I don't understand why that one changes.  It referred to the first int type, why does it now refer to the second int type?
---------------- 

Both the types are duplicates so it does not matter. I guess, it is what received from compiling original cc program. But I am okey to remove it in case that doesn't make sense.

Regards,
Alok


-----Original Message-----
From: Simon Marchi <simon.marchi@polymtl.ca> 
Sent: Monday, February 1, 2021 10:34 PM
To: Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; gdb-patches@sourceware.org
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>
Subject: Re: [PATCH] Correction of gdb.dwarf2/pr13961.S

[CAUTION: External Email]

From 8fc595cd25319689593e33545071f509be93141b Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 1 Feb 2021 10:24:59 +0530
Subject: [PATCH] Correction of gdb.dwarf2/pr13961.S

> Please consider output of objdump for the executable generated from 
> pr13961.S
> -------------
> Contents of the .debug_info section:
> ...
>  <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
>     <63>   DW_AT_name        : foo2
>     <68>   DW_AT_byte_size   : 4
>     <69>   DW_AT_decl_file   : 1
>     <6a>   DW_AT_decl_line   : 1
>     <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
> ...
> Contents of the .debug_types section:
> ...
>  <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
>     <26>   DW_AT_specification: <0x2a>
>  <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
>     <2b>   DW_AT_name        : foo
>     <2f>   DW_AT_byte_size   : 4
>     <30>   DW_AT_decl_file   : 1
>     <31>   DW_AT_decl_line   : 1
>     <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
>  <2><36>: Abbrev Number: 3 (DW_TAG_member)
>     <37>   DW_AT_name        : bar
>     <3b>   DW_AT_decl_file   : 1
>     <3c>   DW_AT_decl_line   : 4
>     <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
>     <41>   DW_AT_data_member_location: 0
>     <42>   DW_AT_accessibility: 1       (public)
>  <2><43>: Abbrev Number: 0
>  <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
>     <45>   DW_AT_byte_size   : 4
>     <46>   DW_AT_encoding    : 5        (signed)
>     <47>   DW_AT_name        : int
> ...
> ---------------
> The original assembly is generated from a source file and then 
> modified to insert DIE, with that the subsequent DIE references should 
> have been updated, which were not.
> It is now getting updated to replace hardcoded DIE references with 
> label-calculated references.
>
> gdb/testsuite/ChangeLog:
>
> 2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
>
>       * gdb.dwarf2/pr13961.S: Corrected invalide DIE references.
>
> Change-Id: I4ed35bee37eb78715b8d913a8f4c96793d655502
> ---
>  gdb/testsuite/ChangeLog            |  4 ++++
>  gdb/testsuite/gdb.dwarf2/pr13961.S | 24 +++++++++++++-----------
>  2 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 
> 36ba5d01c40..2cb676944a3 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
> +
> +     * gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
> +
>  2021-01-29  Tom de Vries  <tdevries@suse.de>
>
>       PR breakpoints/26063
> diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S 
> b/gdb/testsuite/gdb.dwarf2/pr13961.S
> index 809e921215d..a6ba72ee3b3 100644
> --- a/gdb/testsuite/gdb.dwarf2/pr13961.S
> +++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
> @@ -103,26 +103,27 @@ SYMBOL(main):
>
>       /* Manually inserted to have a DW_AT_specification refering to
>          something and appearing ahead of it.  */
> -     .uleb128 0x8    /* DW_TAG_class_type */
> +     .uleb128 0x8    /* (DIE (0x25) DW_TAG_class_type) */
>       .4byte .Ltu_class_type - .Ldebug_types0
>       /* End of manual insertion */
>
>  .Ltu_class_type:
> -     .uleb128 0x2    /* (DIE (0x25) DW_TAG_class_type) */
> +     .uleb128 0x2    /* (DIE (0x2a) DW_TAG_class_type) */
>       .ascii "foo\0"  /* DW_AT_name */
>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x1     /* DW_AT_decl_line */
> -     .4byte  0x3f    /* DW_AT_sibling */
> -     .uleb128 0x3    /* (DIE (0x31) DW_TAG_member) */
> +     .4byte  .Ltu_base_type - .Ldebug_types0 /* DW_AT_sibling */
> +     .uleb128 0x3    /* (DIE (0x36) DW_TAG_member) */
>       .ascii "bar\0"  /* DW_AT_name */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x4     /* DW_AT_decl_line */
> -     .4byte  0x3f    /* DW_AT_type */
> +     .4byte  .Ltu_base_type - .Ldebug_types0 /* DW_AT_type */
>       .byte   0       /* DW_AT_data_member_location */
>       .byte   0x1     /* DW_AT_accessibility */
>       .byte   0       /* end of children of DIE 0x25 */
> -     .uleb128 0x4    /* (DIE (0x3f) DW_TAG_base_type) */
> +.Ltu_base_type:
> +     .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */
>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x5     /* DW_AT_encoding */
>       .ascii "int\0"  /* DW_AT_name */ @@ -184,7 +185,7 @@ 
> SYMBOL(main):
>       .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
>
>  .Lcu_int_type:
> -     .uleb128 0x4    /* (DIE (0x3f) DW_TAG_base_type) */
> +     .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */

I don't understand the new updated offsets, in parenthesis.  For examples, this int DIE ends up at 0x5b for me, not 0x44:


    0x00000056:   DW_TAG_class_type
                    DW_AT_specification [DW_FORM_ref4]      (0x00000062 "foo2")

    0x0000005b:   DW_TAG_base_type
                    DW_AT_byte_size [DW_FORM_data1] (0x04)
                    DW_AT_encoding [DW_FORM_data1]  (DW_ATE_signed)
                    DW_AT_name [DW_FORM_string]     ("int")

I think it would be fine to just remove them.

What would help reading though would be to add some empty lines to separates DIEs, and use indentation for children DIEs, a bit like this:

.Lcu_int_type:
        .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */
        .byte   0x4     /* DW_AT_byte_size */
        .byte   0x5     /* DW_AT_encoding */
        .ascii "int\0"  /* DW_AT_name */

.Lcu_class_type:
        .uleb128 0x2    /* (DIE (0x25) DW_TAG_class_type) */
        .ascii "foo2\0" /* DW_AT_name */
        .byte   0x4     /* DW_AT_byte_size */
        .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
        .byte   0x1     /* DW_AT_decl_line */
        .4byte  .Lcu_second_int_type - .Ldebug_info0    /* DW_AT_sibling */

            .uleb128 0x3        /* (DIE (0x36) DW_TAG_member) */
            .ascii "bar\0"      /* DW_AT_name */
            .byte       0x1     /* DW_AT_decl_file (pr13961.cc) */
            .byte       0x4     /* DW_AT_decl_line */
            .4byte      .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
            .byte       0       /* DW_AT_data_member_location */
            .byte       0x1     /* DW_AT_accessibility */

        .byte   0       /* end of children of DIE 0x25 */

.Lcu_second_int_type:
        .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */
        .byte   0x4     /* DW_AT_byte_size */
        .byte   0x5     /* DW_AT_encoding */
        .ascii "int\0"  /* DW_AT_name */
        /* End of manual insertion */

That makes it easier to follow with the objdump / llvm-dwarfdump output on the side.

>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x5     /* DW_AT_encoding */
>       .ascii "int\0"  /* DW_AT_name */ @@ -194,16 +195,17 @@ 
> SYMBOL(main):
>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x1     /* DW_AT_decl_line */
> -     .4byte  0x3f    /* DW_AT_sibling */
> -     .uleb128 0x3    /* (DIE (0x31) DW_TAG_member) */
> +     .4byte  .Lcu_second_int_type - .Ldebug_info0    /* DW_AT_sibling */
> +     .uleb128 0x3    /* (DIE (0x36) DW_TAG_member) */
>       .ascii "bar\0"  /* DW_AT_name */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x4     /* DW_AT_decl_line */
> -     .4byte  .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
> +     .4byte  .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */

I don't understand why that one changes.  It referred to the first int type, why does it now refer to the second int type?

Simon

[-- Attachment #2: 0001-Correction-of-gdb.dwarf2-pr13961.S.patch --]
[-- Type: application/octet-stream, Size: 9357 bytes --]

From 4ecc5fb3a7f8e2f6be18a5e44da71fb2bd0aad48 Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 1 Feb 2021 10:24:59 +0530
Subject: [PATCH] Correction of gdb.dwarf2/pr13961.S

Please consider output of objdump for the executable generated from pr13961.S
-------------
Contents of the .debug_info section:
...
 <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
    <63>   DW_AT_name        : foo2
    <68>   DW_AT_byte_size   : 4
    <69>   DW_AT_decl_file   : 1
    <6a>   DW_AT_decl_line   : 1
    <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
...
Contents of the .debug_types section:
...
 <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
    <26>   DW_AT_specification: <0x2a>
 <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
    <2b>   DW_AT_name        : foo
    <2f>   DW_AT_byte_size   : 4
    <30>   DW_AT_decl_file   : 1
    <31>   DW_AT_decl_line   : 1
    <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
 <2><36>: Abbrev Number: 3 (DW_TAG_member)
    <37>   DW_AT_name        : bar
    <3b>   DW_AT_decl_file   : 1
    <3c>   DW_AT_decl_line   : 4
    <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
    <41>   DW_AT_data_member_location: 0
    <42>   DW_AT_accessibility: 1       (public)
 <2><43>: Abbrev Number: 0
 <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
    <45>   DW_AT_byte_size   : 4
    <46>   DW_AT_encoding    : 5        (signed)
    <47>   DW_AT_name        : int
...
---------------
The original assembly is generated from a source file and then
modified to insert DIE, with that the subsequent DIE references
should have been updated, which were not.
It is now getting updated to replace hardcoded DIE references with
label-calculated references.

gdb/testsuite/ChangeLog:

2021-02-02  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>

	* gdb.dwarf2/pr13961.S: Corrected invalide DIE references.

Change-Id: I4ed35bee37eb78715b8d913a8f4c96793d655502
---
 gdb/testsuite/ChangeLog            |   4 +
 gdb/testsuite/gdb.dwarf2/pr13961.S | 157 +++++++++++++++--------------
 2 files changed, 88 insertions(+), 73 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 36ba5d01c40..f4f8ed802e6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-02  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
+
+	* gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
+
 2021-01-29  Tom de Vries  <tdevries@suse.de>
 
 	PR breakpoints/26063
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S
index 809e921215d..fca66637f19 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.S
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
@@ -89,7 +89,7 @@ SYMBOL(main):
 	.byte	0x22
 	.byte	0x90
 	.4byte	.Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */
-	.uleb128 0x1	/* (DIE (0x17) DW_TAG_type_unit) */
+	.uleb128 0x1	/* DW_TAG_type_unit */
 	.byte	0x4	/* DW_AT_language */
 	.byte	0x73	/* DW_AT_GNU_odr_signature */
 	.byte	0xea
@@ -108,25 +108,28 @@ SYMBOL(main):
 	/* End of manual insertion */
 
 .Ltu_class_type:
-	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
+	.uleb128 0x2	/* (DW_TAG_class_type) */
 	.ascii "foo\0"	/* DW_AT_name */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
 	.byte	0x1	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_sibling */
-	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
-	.ascii "bar\0"	/* DW_AT_name */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x4	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_type */
-	.byte	0	/* DW_AT_data_member_location */
-	.byte	0x1	/* DW_AT_accessibility */
-	.byte	0	/* end of children of DIE 0x25 */
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
+	.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_sibling */
+
+		.uleb128 0x3	/* (DW_TAG_member) */
+		.ascii "bar\0"	/* DW_AT_name */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0x4	/* DW_AT_decl_line */
+		.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_type */
+		.byte	0	/* DW_AT_data_member_location */
+		.byte	0x1	/* DW_AT_accessibility */
+		.byte	0	/* end of children */
+
+.Ltu_base_type:
+	.uleb128 0x4	/* DW_TAG_base_type */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x5	/* DW_AT_encoding */
 	.ascii "int\0"	/* DW_AT_name */
-	.byte	0	/* end of children of DIE 0x17 */
+	.byte	0	/* end of children */
 
 .Ltu_end:
 
@@ -137,7 +140,8 @@ SYMBOL(main):
 	.2byte	0x4	/* DWARF version number */
 	.4byte	.Ldebug_abbrev0	/* Offset Into Abbrev. Section */
 	.byte	0x4	/* Pointer Size (in bytes) */
-	.uleb128 0x5	/* (DIE (0xb) DW_TAG_compile_unit) */
+
+	.uleb128 0x5	/* (DW_TAG_compile_unit) */
 	.4byte	.LASF0	/* DW_AT_producer: "GNU C++ 4.6.3 20120306" */
 	.byte	0x4	/* DW_AT_language */
 	.4byte	.LASF1	/* DW_AT_name: "pr13961.cc" */
@@ -145,71 +149,78 @@ SYMBOL(main):
 	.4byte	.Ltext0	/* DW_AT_low_pc */
 	.4byte	.Letext0	/* DW_AT_high_pc */
 	.4byte	.Ldebug_line0	/* DW_AT_stmt_list */
+
 .Lint_base_type:
-	.uleb128 0x4	/* (DIE (0x25) DW_TAG_base_type) */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x5	/* DW_AT_encoding */
-	.ascii "int\0"	/* DW_AT_name */
-	.uleb128 0x6	/* (DIE (0x2c) DW_TAG_subprogram) */
-			/* DW_AT_external */
-	.4byte	.LASF3	/* DW_AT_name: "main" */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0xa	/* DW_AT_decl_line */
-	.4byte	0x25	/* DW_AT_type */
-	.4byte	.LFB0	/* DW_AT_low_pc */
-	.4byte	.LFE0	/* DW_AT_high_pc */
-	.uleb128 0x1	/* DW_AT_frame_base */
-	.byte	0x9c	/* DW_OP_call_frame_cfa */
-			/* DW_AT_GNU_all_call_sites */
-	.uleb128 0x7	/* (DIE (0x41) DW_TAG_variable) */
-	.ascii "baz\0"	/* DW_AT_name */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x7	/* DW_AT_decl_line */
-	.byte	0x19	/* DW_AT_type */
-	.byte	0x8b
-	.byte	0x7e
-	.byte	0xac
-	.byte	0xce
-	.byte	0xf1
-	.byte	0x22
-	.byte	0x90
-			/* DW_AT_external */
-	.uleb128 0x5	/* DW_AT_location */
-	.byte	0x3	/* DW_OP_addr */
-	.4byte	baz
+		.uleb128 0x4	/* DW_TAG_base_type */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x5	/* DW_AT_encoding */
+		.ascii "int\0"	/* DW_AT_name */
 
-	/* Manually inserted to have a DW_AT_specification refering to
-	   something and appearing ahead of it.  */
-	.uleb128 0x8	/* DW_TAG_class_type */
-	.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
+		.uleb128 0x6	/* DW_TAG_subprogram */
+				/* DW_AT_external */
+		.4byte	.LASF3	/* DW_AT_name: "main" */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0xa	/* DW_AT_decl_line */
+		.4byte	0x25	/* DW_AT_type */
+		.4byte	.LFB0	/* DW_AT_low_pc */
+		.4byte	.LFE0	/* DW_AT_high_pc */
+		.uleb128 0x1	/* DW_AT_frame_base */
+		.byte	0x9c	/* DW_OP_call_frame_cfa */
+				/* DW_AT_GNU_all_call_sites */
+
+		.uleb128 0x7	/* DW_TAG_variable */
+		.ascii "baz\0"	/* DW_AT_name */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0x7	/* DW_AT_decl_line */
+		.byte	0x19	/* DW_AT_type */
+		.byte	0x8b
+		.byte	0x7e
+		.byte	0xac
+		.byte	0xce
+		.byte	0xf1
+		.byte	0x22
+		.byte	0x90
+				/* DW_AT_external */
+		.uleb128 0x5	/* DW_AT_location */
+		.byte	0x3	/* DW_OP_addr */
+		.4byte	baz
+
+		/* Manually inserted to have a DW_AT_specification refering to
+		   something and appearing ahead of it.  */
+		.uleb128 0x8	/* DW_TAG_class_type */
+		.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
 
 .Lcu_int_type:
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x5	/* DW_AT_encoding */
-	.ascii "int\0"	/* DW_AT_name */
+		.uleb128 0x4	/* DW_TAG_base_type */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x5	/* DW_AT_encoding */
+		.ascii "int\0"	/* DW_AT_name */
+
 .Lcu_class_type:
-	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
-	.ascii "foo2\0"	/* DW_AT_name */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x1	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_sibling */
-	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
-	.ascii "bar\0"	/* DW_AT_name */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x4	/* DW_AT_decl_line */
-	.4byte	.Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
-	.byte	0	/* DW_AT_data_member_location */
-	.byte	0x1	/* DW_AT_accessibility */
-	.byte	0	/* end of children of DIE 0x25 */
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x5	/* DW_AT_encoding */
-	.ascii "int\0"	/* DW_AT_name */
-	/* End of manual insertion */
+		.uleb128 0x2	/* DW_TAG_class_type */
+		.ascii "foo2\0"	/* DW_AT_name */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0x1	/* DW_AT_decl_line */
+		.4byte	.Lcu_second_int_type - .Ldebug_info0	/* DW_AT_sibling */
+
+			.uleb128 0x3	/* DW_TAG_member */
+			.ascii "bar\0"	/* DW_AT_name */
+			.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+			.byte	0x4	/* DW_AT_decl_line */
+			.4byte	.Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
+			.byte	0	/* DW_AT_data_member_location */
+			.byte	0x1	/* DW_AT_accessibility */
+			.byte	0	/* end of children */
+
+.Lcu_second_int_type:
+		.uleb128 0x4	/* DW_TAG_base_type */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x5	/* DW_AT_encoding */
+		.ascii "int\0"	/* DW_AT_name */
+		/* End of manual insertion */
 
-	.byte	0	/* end of children of DIE 0xb */
+		.byte	0	/* end of children */
 
 .Lcu_end:
 
-- 
2.17.1


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

* RE: [PATCH] Correction of gdb.dwarf2/pr13961.S
  2021-02-02  5:47   ` Sharma, Alok Kumar
@ 2021-02-08  4:31     ` Sharma, Alok Kumar
  2021-02-10  1:36       ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Sharma, Alok Kumar @ 2021-02-08  4:31 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

Hi Simon,

Do you have any more comments ?

Regards,
Alok

-----Original Message-----
From: Sharma, Alok Kumar 
Sent: Tuesday, February 2, 2021 11:17 AM
To: Simon Marchi <simon.marchi@polymtl.ca>; gdb-patches@sourceware.org
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>
Subject: RE: [PATCH] Correction of gdb.dwarf2/pr13961.S

Hi Simon,

Thanks for your comments. Please find the updated patch.

---------------- 
> -     .4byte  .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
> +     .4byte  .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */

I don't understand why that one changes.  It referred to the first int type, why does it now refer to the second int type?
---------------- 

Both the types are duplicates so it does not matter. I guess, it is what received from compiling original cc program. But I am okey to remove it in case that doesn't make sense.

Regards,
Alok


-----Original Message-----
From: Simon Marchi <simon.marchi@polymtl.ca>
Sent: Monday, February 1, 2021 10:34 PM
To: Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; gdb-patches@sourceware.org
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>
Subject: Re: [PATCH] Correction of gdb.dwarf2/pr13961.S

[CAUTION: External Email]

From 8fc595cd25319689593e33545071f509be93141b Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 1 Feb 2021 10:24:59 +0530
Subject: [PATCH] Correction of gdb.dwarf2/pr13961.S

> Please consider output of objdump for the executable generated from 
> pr13961.S
> -------------
> Contents of the .debug_info section:
> ...
>  <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
>     <63>   DW_AT_name        : foo2
>     <68>   DW_AT_byte_size   : 4
>     <69>   DW_AT_decl_file   : 1
>     <6a>   DW_AT_decl_line   : 1
>     <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
> ...
> Contents of the .debug_types section:
> ...
>  <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
>     <26>   DW_AT_specification: <0x2a>
>  <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
>     <2b>   DW_AT_name        : foo
>     <2f>   DW_AT_byte_size   : 4
>     <30>   DW_AT_decl_file   : 1
>     <31>   DW_AT_decl_line   : 1
>     <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
>  <2><36>: Abbrev Number: 3 (DW_TAG_member)
>     <37>   DW_AT_name        : bar
>     <3b>   DW_AT_decl_file   : 1
>     <3c>   DW_AT_decl_line   : 4
>     <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
>     <41>   DW_AT_data_member_location: 0
>     <42>   DW_AT_accessibility: 1       (public)
>  <2><43>: Abbrev Number: 0
>  <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
>     <45>   DW_AT_byte_size   : 4
>     <46>   DW_AT_encoding    : 5        (signed)
>     <47>   DW_AT_name        : int
> ...
> ---------------
> The original assembly is generated from a source file and then 
> modified to insert DIE, with that the subsequent DIE references should 
> have been updated, which were not.
> It is now getting updated to replace hardcoded DIE references with 
> label-calculated references.
>
> gdb/testsuite/ChangeLog:
>
> 2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
>
>       * gdb.dwarf2/pr13961.S: Corrected invalide DIE references.
>
> Change-Id: I4ed35bee37eb78715b8d913a8f4c96793d655502
> ---
>  gdb/testsuite/ChangeLog            |  4 ++++
>  gdb/testsuite/gdb.dwarf2/pr13961.S | 24 +++++++++++++-----------
>  2 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index
> 36ba5d01c40..2cb676944a3 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-02-01  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
> +
> +     * gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
> +
>  2021-01-29  Tom de Vries  <tdevries@suse.de>
>
>       PR breakpoints/26063
> diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S
> b/gdb/testsuite/gdb.dwarf2/pr13961.S
> index 809e921215d..a6ba72ee3b3 100644
> --- a/gdb/testsuite/gdb.dwarf2/pr13961.S
> +++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
> @@ -103,26 +103,27 @@ SYMBOL(main):
>
>       /* Manually inserted to have a DW_AT_specification refering to
>          something and appearing ahead of it.  */
> -     .uleb128 0x8    /* DW_TAG_class_type */
> +     .uleb128 0x8    /* (DIE (0x25) DW_TAG_class_type) */
>       .4byte .Ltu_class_type - .Ldebug_types0
>       /* End of manual insertion */
>
>  .Ltu_class_type:
> -     .uleb128 0x2    /* (DIE (0x25) DW_TAG_class_type) */
> +     .uleb128 0x2    /* (DIE (0x2a) DW_TAG_class_type) */
>       .ascii "foo\0"  /* DW_AT_name */
>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x1     /* DW_AT_decl_line */
> -     .4byte  0x3f    /* DW_AT_sibling */
> -     .uleb128 0x3    /* (DIE (0x31) DW_TAG_member) */
> +     .4byte  .Ltu_base_type - .Ldebug_types0 /* DW_AT_sibling */
> +     .uleb128 0x3    /* (DIE (0x36) DW_TAG_member) */
>       .ascii "bar\0"  /* DW_AT_name */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x4     /* DW_AT_decl_line */
> -     .4byte  0x3f    /* DW_AT_type */
> +     .4byte  .Ltu_base_type - .Ldebug_types0 /* DW_AT_type */
>       .byte   0       /* DW_AT_data_member_location */
>       .byte   0x1     /* DW_AT_accessibility */
>       .byte   0       /* end of children of DIE 0x25 */
> -     .uleb128 0x4    /* (DIE (0x3f) DW_TAG_base_type) */
> +.Ltu_base_type:
> +     .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */
>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x5     /* DW_AT_encoding */
>       .ascii "int\0"  /* DW_AT_name */ @@ -184,7 +185,7 @@
> SYMBOL(main):
>       .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
>
>  .Lcu_int_type:
> -     .uleb128 0x4    /* (DIE (0x3f) DW_TAG_base_type) */
> +     .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */

I don't understand the new updated offsets, in parenthesis.  For examples, this int DIE ends up at 0x5b for me, not 0x44:


    0x00000056:   DW_TAG_class_type
                    DW_AT_specification [DW_FORM_ref4]      (0x00000062 "foo2")

    0x0000005b:   DW_TAG_base_type
                    DW_AT_byte_size [DW_FORM_data1] (0x04)
                    DW_AT_encoding [DW_FORM_data1]  (DW_ATE_signed)
                    DW_AT_name [DW_FORM_string]     ("int")

I think it would be fine to just remove them.

What would help reading though would be to add some empty lines to separates DIEs, and use indentation for children DIEs, a bit like this:

.Lcu_int_type:
        .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */
        .byte   0x4     /* DW_AT_byte_size */
        .byte   0x5     /* DW_AT_encoding */
        .ascii "int\0"  /* DW_AT_name */

.Lcu_class_type:
        .uleb128 0x2    /* (DIE (0x25) DW_TAG_class_type) */
        .ascii "foo2\0" /* DW_AT_name */
        .byte   0x4     /* DW_AT_byte_size */
        .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
        .byte   0x1     /* DW_AT_decl_line */
        .4byte  .Lcu_second_int_type - .Ldebug_info0    /* DW_AT_sibling */

            .uleb128 0x3        /* (DIE (0x36) DW_TAG_member) */
            .ascii "bar\0"      /* DW_AT_name */
            .byte       0x1     /* DW_AT_decl_file (pr13961.cc) */
            .byte       0x4     /* DW_AT_decl_line */
            .4byte      .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
            .byte       0       /* DW_AT_data_member_location */
            .byte       0x1     /* DW_AT_accessibility */

        .byte   0       /* end of children of DIE 0x25 */

.Lcu_second_int_type:
        .uleb128 0x4    /* (DIE (0x44) DW_TAG_base_type) */
        .byte   0x4     /* DW_AT_byte_size */
        .byte   0x5     /* DW_AT_encoding */
        .ascii "int\0"  /* DW_AT_name */
        /* End of manual insertion */

That makes it easier to follow with the objdump / llvm-dwarfdump output on the side.

>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x5     /* DW_AT_encoding */
>       .ascii "int\0"  /* DW_AT_name */ @@ -194,16 +195,17 @@
> SYMBOL(main):
>       .byte   0x4     /* DW_AT_byte_size */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x1     /* DW_AT_decl_line */
> -     .4byte  0x3f    /* DW_AT_sibling */
> -     .uleb128 0x3    /* (DIE (0x31) DW_TAG_member) */
> +     .4byte  .Lcu_second_int_type - .Ldebug_info0    /* DW_AT_sibling */
> +     .uleb128 0x3    /* (DIE (0x36) DW_TAG_member) */
>       .ascii "bar\0"  /* DW_AT_name */
>       .byte   0x1     /* DW_AT_decl_file (pr13961.cc) */
>       .byte   0x4     /* DW_AT_decl_line */
> -     .4byte  .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
> +     .4byte  .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */

I don't understand why that one changes.  It referred to the first int type, why does it now refer to the second int type?

Simon

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

* Re: [PATCH] Correction of gdb.dwarf2/pr13961.S
  2021-02-08  4:31     ` Sharma, Alok Kumar
@ 2021-02-10  1:36       ` Simon Marchi
  2021-02-16 12:45         ` Sharma, Alok Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-02-10  1:36 UTC (permalink / raw)
  To: Sharma, Alok Kumar, gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

On 2021-02-07 11:31 p.m., Sharma, Alok Kumar wrote:
> Hi Simon,
> 
> Do you have any more comments ?
> 
> Regards,
> Alok

Hi Alok,

Thanks for doing the indentation and adding newlines to split by DIEs, I
think it's more readable like this.

I noticed there are other DW_AT_type of form DW_FORM_ref4 that use
hard-coded values.  Could you convert them too to symbolic form?  I
think it's better to convert them, because it's easier to read the .S
file this way, and it avoids any future breakage of the same type.
Apart from that, the other attributes I see that are a reference to
another DIE are DW_AT_specification and DW_AT_sibling, but you already
converted them, so I think those DW_AT_type's are the only ones
remaining.

Thanks,

Simon

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

* RE: [PATCH] Correction of gdb.dwarf2/pr13961.S
  2021-02-10  1:36       ` Simon Marchi
@ 2021-02-16 12:45         ` Sharma, Alok Kumar
  2021-02-16 16:50           ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Sharma, Alok Kumar @ 2021-02-16 12:45 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

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

Please find attached patch. 

It includes one more entry changed for DW_AT_type. I left another entry unchanged which has of type DW_FORM_ref_sig8 and seems to have some intended long value.

Regards,
Alok

-----Original Message-----
From: Simon Marchi <simon.marchi@polymtl.ca> 
Sent: Wednesday, February 10, 2021 7:06 AM
To: Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; gdb-patches@sourceware.org
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>
Subject: Re: [PATCH] Correction of gdb.dwarf2/pr13961.S

[CAUTION: External Email]

On 2021-02-07 11:31 p.m., Sharma, Alok Kumar wrote:
> Hi Simon,
>
> Do you have any more comments ?
>
> Regards,
> Alok

Hi Alok,

Thanks for doing the indentation and adding newlines to split by DIEs, I think it's more readable like this.

I noticed there are other DW_AT_type of form DW_FORM_ref4 that use hard-coded values.  Could you convert them too to symbolic form?  I think it's better to convert them, because it's easier to read the .S file this way, and it avoids any future breakage of the same type.
Apart from that, the other attributes I see that are a reference to another DIE are DW_AT_specification and DW_AT_sibling, but you already converted them, so I think those DW_AT_type's are the only ones remaining.

Thanks,

Simon

[-- Attachment #2: 0001-Correction-of-gdb.dwarf2-pr13961.S.patch --]
[-- Type: application/octet-stream, Size: 9415 bytes --]

From 14916d2d4559564cb42fef1d1b96ccfbc6bb67fd Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 1 Feb 2021 10:24:59 +0530
Subject: [PATCH] Correction of gdb.dwarf2/pr13961.S

Please consider output of objdump for the executable generated from pr13961.S
-------------
Contents of the .debug_info section:
...
 <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
    <63>   DW_AT_name        : foo2
    <68>   DW_AT_byte_size   : 4
    <69>   DW_AT_decl_file   : 1
    <6a>   DW_AT_decl_line   : 1
    <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
...
Contents of the .debug_types section:
...
 <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
    <26>   DW_AT_specification: <0x2a>
 <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
    <2b>   DW_AT_name        : foo
    <2f>   DW_AT_byte_size   : 4
    <30>   DW_AT_decl_file   : 1
    <31>   DW_AT_decl_line   : 1
    <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
 <2><36>: Abbrev Number: 3 (DW_TAG_member)
    <37>   DW_AT_name        : bar
    <3b>   DW_AT_decl_file   : 1
    <3c>   DW_AT_decl_line   : 4
    <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
    <41>   DW_AT_data_member_location: 0
    <42>   DW_AT_accessibility: 1       (public)
 <2><43>: Abbrev Number: 0
 <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
    <45>   DW_AT_byte_size   : 4
    <46>   DW_AT_encoding    : 5        (signed)
    <47>   DW_AT_name        : int
...
---------------
The original assembly is generated from a source file and then
modified to insert DIE, with that the subsequent DIE references
should have been updated, which were not.
It is now getting updated to replace hardcoded DIE references with
label-calculated references.

gdb/testsuite/ChangeLog:

2021-02-16  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>

	* gdb.dwarf2/pr13961.S: Corrected invalide DIE references.

Change-Id: I4ed35bee37eb78715b8d913a8f4c96793d655502
---
 gdb/testsuite/ChangeLog            |   4 +
 gdb/testsuite/gdb.dwarf2/pr13961.S | 157 +++++++++++++++--------------
 2 files changed, 88 insertions(+), 73 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 52b0752276b..f3002b23970 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-16  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
+
+	* gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
+
 2021-02-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.fortran/allocated.exp: New file.
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S
index 809e921215d..2c9aca86836 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.S
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.S
@@ -89,7 +89,7 @@ SYMBOL(main):
 	.byte	0x22
 	.byte	0x90
 	.4byte	.Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */
-	.uleb128 0x1	/* (DIE (0x17) DW_TAG_type_unit) */
+	.uleb128 0x1	/* DW_TAG_type_unit */
 	.byte	0x4	/* DW_AT_language */
 	.byte	0x73	/* DW_AT_GNU_odr_signature */
 	.byte	0xea
@@ -108,25 +108,28 @@ SYMBOL(main):
 	/* End of manual insertion */
 
 .Ltu_class_type:
-	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
+	.uleb128 0x2	/* (DW_TAG_class_type) */
 	.ascii "foo\0"	/* DW_AT_name */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
 	.byte	0x1	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_sibling */
-	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
-	.ascii "bar\0"	/* DW_AT_name */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x4	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_type */
-	.byte	0	/* DW_AT_data_member_location */
-	.byte	0x1	/* DW_AT_accessibility */
-	.byte	0	/* end of children of DIE 0x25 */
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
+	.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_sibling */
+
+		.uleb128 0x3	/* (DW_TAG_member) */
+		.ascii "bar\0"	/* DW_AT_name */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0x4	/* DW_AT_decl_line */
+		.4byte	.Ltu_base_type - .Ldebug_types0	/* DW_AT_type */
+		.byte	0	/* DW_AT_data_member_location */
+		.byte	0x1	/* DW_AT_accessibility */
+		.byte	0	/* end of children */
+
+.Ltu_base_type:
+	.uleb128 0x4	/* DW_TAG_base_type */
 	.byte	0x4	/* DW_AT_byte_size */
 	.byte	0x5	/* DW_AT_encoding */
 	.ascii "int\0"	/* DW_AT_name */
-	.byte	0	/* end of children of DIE 0x17 */
+	.byte	0	/* end of children */
 
 .Ltu_end:
 
@@ -137,7 +140,8 @@ SYMBOL(main):
 	.2byte	0x4	/* DWARF version number */
 	.4byte	.Ldebug_abbrev0	/* Offset Into Abbrev. Section */
 	.byte	0x4	/* Pointer Size (in bytes) */
-	.uleb128 0x5	/* (DIE (0xb) DW_TAG_compile_unit) */
+
+	.uleb128 0x5	/* (DW_TAG_compile_unit) */
 	.4byte	.LASF0	/* DW_AT_producer: "GNU C++ 4.6.3 20120306" */
 	.byte	0x4	/* DW_AT_language */
 	.4byte	.LASF1	/* DW_AT_name: "pr13961.cc" */
@@ -145,71 +149,78 @@ SYMBOL(main):
 	.4byte	.Ltext0	/* DW_AT_low_pc */
 	.4byte	.Letext0	/* DW_AT_high_pc */
 	.4byte	.Ldebug_line0	/* DW_AT_stmt_list */
+
 .Lint_base_type:
-	.uleb128 0x4	/* (DIE (0x25) DW_TAG_base_type) */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x5	/* DW_AT_encoding */
-	.ascii "int\0"	/* DW_AT_name */
-	.uleb128 0x6	/* (DIE (0x2c) DW_TAG_subprogram) */
-			/* DW_AT_external */
-	.4byte	.LASF3	/* DW_AT_name: "main" */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0xa	/* DW_AT_decl_line */
-	.4byte	0x25	/* DW_AT_type */
-	.4byte	.LFB0	/* DW_AT_low_pc */
-	.4byte	.LFE0	/* DW_AT_high_pc */
-	.uleb128 0x1	/* DW_AT_frame_base */
-	.byte	0x9c	/* DW_OP_call_frame_cfa */
-			/* DW_AT_GNU_all_call_sites */
-	.uleb128 0x7	/* (DIE (0x41) DW_TAG_variable) */
-	.ascii "baz\0"	/* DW_AT_name */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x7	/* DW_AT_decl_line */
-	.byte	0x19	/* DW_AT_type */
-	.byte	0x8b
-	.byte	0x7e
-	.byte	0xac
-	.byte	0xce
-	.byte	0xf1
-	.byte	0x22
-	.byte	0x90
-			/* DW_AT_external */
-	.uleb128 0x5	/* DW_AT_location */
-	.byte	0x3	/* DW_OP_addr */
-	.4byte	baz
+		.uleb128 0x4	/* DW_TAG_base_type */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x5	/* DW_AT_encoding */
+		.ascii "int\0"	/* DW_AT_name */
 
-	/* Manually inserted to have a DW_AT_specification refering to
-	   something and appearing ahead of it.  */
-	.uleb128 0x8	/* DW_TAG_class_type */
-	.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
+		.uleb128 0x6	/* DW_TAG_subprogram */
+				/* DW_AT_external */
+		.4byte	.LASF3	/* DW_AT_name: "main" */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0xa	/* DW_AT_decl_line */
+		.4byte	.Lint_base_type - .Ldebug_info0	/* DW_AT_type */
+		.4byte	.LFB0	/* DW_AT_low_pc */
+		.4byte	.LFE0	/* DW_AT_high_pc */
+		.uleb128 0x1	/* DW_AT_frame_base */
+		.byte	0x9c	/* DW_OP_call_frame_cfa */
+				/* DW_AT_GNU_all_call_sites */
+
+		.uleb128 0x7	/* DW_TAG_variable */
+		.ascii "baz\0"	/* DW_AT_name */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0x7	/* DW_AT_decl_line */
+		.byte	0x19	/* DW_AT_type */
+		.byte	0x8b
+		.byte	0x7e
+		.byte	0xac
+		.byte	0xce
+		.byte	0xf1
+		.byte	0x22
+		.byte	0x90
+				/* DW_AT_external */
+		.uleb128 0x5	/* DW_AT_location */
+		.byte	0x3	/* DW_OP_addr */
+		.4byte	baz
+
+		/* Manually inserted to have a DW_AT_specification refering to
+		   something and appearing ahead of it.  */
+		.uleb128 0x8	/* DW_TAG_class_type */
+		.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
 
 .Lcu_int_type:
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x5	/* DW_AT_encoding */
-	.ascii "int\0"	/* DW_AT_name */
+		.uleb128 0x4	/* DW_TAG_base_type */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x5	/* DW_AT_encoding */
+		.ascii "int\0"	/* DW_AT_name */
+
 .Lcu_class_type:
-	.uleb128 0x2	/* (DIE (0x25) DW_TAG_class_type) */
-	.ascii "foo2\0"	/* DW_AT_name */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x1	/* DW_AT_decl_line */
-	.4byte	0x3f	/* DW_AT_sibling */
-	.uleb128 0x3	/* (DIE (0x31) DW_TAG_member) */
-	.ascii "bar\0"	/* DW_AT_name */
-	.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
-	.byte	0x4	/* DW_AT_decl_line */
-	.4byte	.Lcu_int_type - .Ldebug_info0 /* DW_AT_type */
-	.byte	0	/* DW_AT_data_member_location */
-	.byte	0x1	/* DW_AT_accessibility */
-	.byte	0	/* end of children of DIE 0x25 */
-	.uleb128 0x4	/* (DIE (0x3f) DW_TAG_base_type) */
-	.byte	0x4	/* DW_AT_byte_size */
-	.byte	0x5	/* DW_AT_encoding */
-	.ascii "int\0"	/* DW_AT_name */
-	/* End of manual insertion */
+		.uleb128 0x2	/* DW_TAG_class_type */
+		.ascii "foo2\0"	/* DW_AT_name */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+		.byte	0x1	/* DW_AT_decl_line */
+		.4byte	.Lcu_second_int_type - .Ldebug_info0	/* DW_AT_sibling */
+
+			.uleb128 0x3	/* DW_TAG_member */
+			.ascii "bar\0"	/* DW_AT_name */
+			.byte	0x1	/* DW_AT_decl_file (pr13961.cc) */
+			.byte	0x4	/* DW_AT_decl_line */
+			.4byte	.Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
+			.byte	0	/* DW_AT_data_member_location */
+			.byte	0x1	/* DW_AT_accessibility */
+			.byte	0	/* end of children */
+
+.Lcu_second_int_type:
+		.uleb128 0x4	/* DW_TAG_base_type */
+		.byte	0x4	/* DW_AT_byte_size */
+		.byte	0x5	/* DW_AT_encoding */
+		.ascii "int\0"	/* DW_AT_name */
+		/* End of manual insertion */
 
-	.byte	0	/* end of children of DIE 0xb */
+		.byte	0	/* end of children */
 
 .Lcu_end:
 
-- 
2.17.1


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

* Re: [PATCH] Correction of gdb.dwarf2/pr13961.S
  2021-02-16 12:45         ` Sharma, Alok Kumar
@ 2021-02-16 16:50           ` Simon Marchi
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2021-02-16 16:50 UTC (permalink / raw)
  To: Sharma, Alok Kumar, gdb-patches
  Cc: George, Jini Susan, Achra, Nitika, E, Nagajyothi

> It includes one more entry changed for DW_AT_type. I left another
> entry unchanged which has of type DW_FORM_ref_sig8 and seems to have
> some intended long value.

That's correct, the attribute with form DW_FORM_ref_sig8 should not be
changed.

The patch is OK, thanks.

Simon

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

end of thread, other threads:[~2021-02-16 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01  8:00 [PATCH] Correction of gdb.dwarf2/pr13961.S Sharma, Alok Kumar
2021-02-01 17:03 ` Simon Marchi
2021-02-02  5:47   ` Sharma, Alok Kumar
2021-02-08  4:31     ` Sharma, Alok Kumar
2021-02-10  1:36       ` Simon Marchi
2021-02-16 12:45         ` Sharma, Alok Kumar
2021-02-16 16:50           ` Simon Marchi

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