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

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