public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/31592] New: [gdb/testsuite] gdb.dwarf2/dw2-epilogue-begin.exp drops epilogue_begin entry
Date: Tue, 02 Apr 2024 06:37:04 +0000	[thread overview]
Message-ID: <bug-31592-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=31592

            Bug ID: 31592
           Summary: [gdb/testsuite] gdb.dwarf2/dw2-epilogue-begin.exp
                    drops epilogue_begin entry
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

In https://sourceware.org/pipermail/gdb-patches/2024-March/207709.html it was
mentioned that test-case gdb.dwarf2/dw2-epilogue-begin.exp exercises cornercase
behaviour, so I investigated and found the following.

Test-case gdb.dwarf2/dw2-epilogue-begin.exp contains the following dwarf
assembly:
...
            DW_LNE_set_address main_epilogue
            line $main_epilogue
            DW_LNS_set_epilogue_begin
            DW_LNS_copy

            DW_LNE_end_sequence
...
which translates into the following decoded linetable with readelf -wL:
...
dw2-epilogue-begin.c:
File name                        Line number    Starting address    View   
Stmt

/data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c:
dw2-epilogue-begin.c                      20            0x4004b7              
x
dw2-epilogue-begin.c                      27            0x4004be              
x
dw2-epilogue-begin.c                      34            0x4004d0              
x
dw2-epilogue-begin.c                      37            0x4004de              
x
dw2-epilogue-begin.c                      38            0x4004ec              
x
dw2-epilogue-begin.c                      43            0x4004ef              
x
dw2-epilogue-begin.c                      47            0x4004fa              
x
dw2-epilogue-begin.c                      50            0x4004ff              
x
dw2-epilogue-begin.c                       -            0x4004ff
...
or alternatively, with llvm-dwarfdump --debug-line:
...
Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x00000000004004b7     20      0      0   0             0  is_stmt prologue_end
epilogue_begin
0x00000000004004be     27      0      0   0             0  is_stmt
0x00000000004004d0     34      0      0   0             0  is_stmt prologue_end
0x00000000004004de     37      0      0   0             0  is_stmt
epilogue_begin
0x00000000004004ec     38      0      0   0             0  is_stmt
0x00000000004004ef     43      0      0   0             0  is_stmt prologue_end
0x00000000004004fa     47      0      0   0             0  is_stmt
0x00000000004004ff     50      0      0   0             0  is_stmt
epilogue_begin
0x00000000004004ff     50      0      0   0             0  is_stmt end_sequence
...

Note that the end of sequence is at 0x4004ff, which excludes the entry at line
50 with the same address from that sequence, which gdb indeed does:
...
$ gdb -q -batch outputs/gdb.dwarf2/dw2-epilogue-begin/dw2-epilogue-begin -ex
start -ex "maint info line-tab"
Temporary breakpoint 1 at 0x4004ef: file
/data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c, line 43.

Temporary breakpoint 1, main () at
/data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c:43
43      {                                                       /* main
prologue */
objfile:
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-epilogue-begin/dw2-epilogue-begin
((struct objfile *) 0x3ed4570)
compunit_symtab: dw2-prologue-end.c ((struct compunit_symtab *) 0x3ebec70)
symtab: dw2-prologue-end.c ((struct symtab *) 0x3ebf370)
linetable: ((struct linetable *) 0x0):
No line table.

objfile:
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-epilogue-begin/dw2-epilogue-begin
((struct objfile *) 0x3ed4570)
compunit_symtab: dw2-prologue-end.c ((struct compunit_symtab *) 0x3ebec70)
symtab:
/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c
((struct symtab *) 0x3ebed00)
linetable: ((struct linetable *) 0x3ebf2d0):
INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
EPILOGUE-BEGIN 
0      20     0x00000000004004b7 0x00000000004004b7 Y       Y            Y      
1      27     0x00000000004004be 0x00000000004004be Y                           
2      34     0x00000000004004d0 0x00000000004004d0 Y       Y                   
3      37     0x00000000004004de 0x00000000004004de Y                    Y      
4      38     0x00000000004004ec 0x00000000004004ec Y                           
5      43     0x00000000004004ef 0x00000000004004ef Y       Y                   
6      47     0x00000000004004fa 0x00000000004004fa Y                           
7      END    0x00000000004004ff 0x00000000004004ff Y                           
...

So, either this is intended behaviour and the test-case requires a comment, or
the test-case needs fixing.

Anyway the test-case passes in the current form, so it's not clear if the
dropped entry is actually needed.

Note that dropping the entry explicitly in the dwarf assembly like so:
...
@@ -130,10 +130,6 @@ Dwarf::assemble $asm_file {
            DW_LNS_copy

            DW_LNE_set_address main_epilogue
-           line $main_epilogue
-           DW_LNS_set_epilogue_begin
-           DW_LNS_copy
-
            DW_LNE_end_sequence
        }
     }
...
still exercises the same cornercase.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2024-04-02  6:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  6:37 vries at gcc dot gnu.org [this message]
2024-04-02  6:38 ` [Bug testsuite/31592] " vries at gcc dot gnu.org
2024-04-02  7:22 ` vries at gcc dot gnu.org
2024-04-04 15:20 ` vries at gcc dot gnu.org
2024-04-04 19:17 ` blarsen at redhat dot com
2024-04-17 10:54 ` cvs-commit at gcc dot gnu.org
2024-04-17 10:55 ` vries at gcc dot gnu.org

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=bug-31592-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).