public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/31592] New: [gdb/testsuite] gdb.dwarf2/dw2-epilogue-begin.exp drops epilogue_begin entry
@ 2024-04-02  6:37 vries at gcc dot gnu.org
  2024-04-02  6:38 ` [Bug testsuite/31592] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2024-04-02  6:37 UTC (permalink / raw)
  To: gdb-prs

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.

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

end of thread, other threads:[~2024-04-17 10:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02  6:37 [Bug testsuite/31592] New: [gdb/testsuite] gdb.dwarf2/dw2-epilogue-begin.exp drops epilogue_begin entry vries at gcc dot gnu.org
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

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