Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix .debug_abbrev terminators
Date: Tue, 3 Nov 2020 17:41:45 +0100	[thread overview]
Message-ID: <20201103164143.GA10785@delia> (raw)

Hi,

The abbreviations table for a single compilation unit has two types of
terminators:
- a ".byte 0" pair denoting the end of an attribute list
- a single ".byte 0" denoting the end of the table

However, at the end of the .debug_abbrev section in dw2-line-number-zero-dw.S,
we have four ".byte 0" entries:
...
        .uleb128        0x12            /* DW_AT_high_pc */
        .uleb128        0x01            /* DW_FORM_addr */
        .byte        0x0                /* Terminator */
        .byte        0x0                /* Terminator */
        .byte        0x0                /* Terminator */
        .byte        0x0                /* Terminator */
...

The first two are the attribute list terminator, the third is the end-of-table
terminator, and the last is superfluous/incorrect.

Fix this by emitting instead:
...
        .uleb128        0x12            /* DW_AT_high_pc */
        .uleb128        0x01            /* DW_FORM_addr */
        .byte        0x0                /* DW_AT - Terminator */
        .byte        0x0                /* DW_FORM - Terminator */
        .byte        0x0                /* Abbrev end - Terminator */
...
where the last comment resembles the comment for other abbreviation codes:
...
        .section .debug_abbrev
.Labbrev1_begin:
        .uleb128        2               /* Abbrev start */
...

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix .debug_abbrev terminators

gdb/testsuite/ChangeLog:

2020-11-03  Tom de Vries  <tdevries@suse.de>

	* lib/dwarf.exp (Dwarf::_handle_DW_TAG): Improve attribute list
	terminator comments.
	(Dwarf::cu, Dwarf::tu): Remove superfluous abbreviation table
	terminator.

---
 gdb/testsuite/lib/dwarf.exp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 1a0cbf689e..c585621ac4 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -723,8 +723,8 @@ namespace eval Dwarf {
 
 	_defer_output $_abbrev_section {
 	    # Terminator.
-	    _op .byte 0x0 Terminator
-	    _op .byte 0x0 Terminator
+	    _op .byte 0x0 "DW_AT - Terminator"
+	    _op .byte 0x0 "DW_FORM - Terminator"
 	}
 
 	if {$has_children} {
@@ -1111,8 +1111,7 @@ namespace eval Dwarf {
 
 	_defer_output $_abbrev_section {
 	    # Emit the terminator.
-	    _op .byte 0x0 Terminator
-	    _op .byte 0x0 Terminator
+	    _op .byte 0x0 "Abbrev end - Terminator"
 	}
 
 	define_label $end_label
@@ -1220,8 +1219,7 @@ namespace eval Dwarf {
 
 	_defer_output $_abbrev_section {
 	    # Emit the terminator.
-	    _op .byte 0x0 Terminator
-	    _op .byte 0x0 Terminator
+	    _op .byte 0x0 "Abbrev end - Terminator"
 	}
 
 	define_label $end_label

                 reply	other threads:[~2020-11-03 16:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201103164143.GA10785@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /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