* [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence
@ 2024-04-08 12:04 Tom de Vries
2024-04-08 12:04 ` [PATCH v2 2/4] [gdb/testsuite] Require address update for DW_LNS_copy Tom de Vries
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Tom de Vries @ 2024-04-08 12:04 UTC (permalink / raw)
To: gdb-patches
With test-case gdb.dwarf2/dw2-epilogue-begin.exp, we have an end_sequence
entry with the same address as the line entry before it:
...
File name Line number Starting address View Stmt
dw2-epilogue-begin.c 44 0x4101e8 x
dw2-epilogue-begin.c 47 0x4101ec x
dw2-epilogue-begin.c - 0x4101ec
...
and consequently the line entry is removed by gdb:
...
INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT PRO EPI
0 20 0x00000000004101a8 0x00000000004101a8 Y Y Y
1 27 0x00000000004101b0 0x00000000004101b0 Y
2 32 0x00000000004101b8 0x00000000004101b8 Y Y
3 34 0x00000000004101c0 0x00000000004101c0 Y Y
4 35 0x00000000004101c8 0x00000000004101c8 Y
5 40 0x00000000004101d4 0x00000000004101d4 Y Y
6 44 0x00000000004101e8 0x00000000004101e8 Y
7 END 0x00000000004101ec 0x00000000004101ec Y
...
This is a common mistake in dwarf assembly test-cases.
Fix this by:
- requiring an address update for each DW_LNE_end_sequence, and
- fixing the test-cases where that triggers an error.
I also encountered the error in test-case gdb.dwarf2/dw2-bad-elf.exp, and in
this case I worked around it using "DW_LNS_advance_pc 0".
Tested on aarch64-linux.
PR testsuite/31592
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31592
---
gdb/testsuite/gdb.base/until-trailing-insns.exp | 3 +--
gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp | 6 ++++++
.../gdb.dwarf2/dw2-disasm-over-non-stmt.exp | 1 -
gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp | 1 +
.../gdb.dwarf2/dw2-inline-small-func.exp | 2 ++
gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp | 1 +
gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp | 6 ------
gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp | 15 +++++----------
gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp | 4 ----
.../gdb.dwarf2/locexpr-data-member-location.exp | 7 +++----
gdb/testsuite/lib/dwarf.exp | 13 +++++++++++++
11 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/gdb/testsuite/gdb.base/until-trailing-insns.exp b/gdb/testsuite/gdb.base/until-trailing-insns.exp
index aed36814809..baa5f1fa32c 100644
--- a/gdb/testsuite/gdb.base/until-trailing-insns.exp
+++ b/gdb/testsuite/gdb.base/until-trailing-insns.exp
@@ -147,9 +147,8 @@ Dwarf::assemble $asm_file {
line [gdb_get_line_number "TAG: main return"]
DW_LNS_negate_stmt
DW_LNS_copy
+
DW_LNE_set_address $main_end
- line [expr [gdb_get_line_number "TAG: main return"] + 1]
- DW_LNS_copy
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
index 71c5bf9014d..63d83fb9416 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
@@ -128,9 +128,12 @@ Dwarf::assemble $asm_file {
DW_LNE_set_address [lindex $main_result 0]
DW_LNS_advance_line 10
DW_LNS_copy
+
DW_LNS_advance_pc [lindex $main_result 1]
DW_LNS_advance_line 19
DW_LNS_copy
+
+ DW_LNS_advance_pc 0
DW_LNE_end_sequence
}
}
@@ -144,9 +147,12 @@ Dwarf::assemble $asm_file {
DW_LNE_set_address some_func
DW_LNS_advance_line 5
DW_LNS_copy
+
DW_LNS_advance_pc 64
DW_LNS_advance_line 8
DW_LNS_copy
+
+ DW_LNS_advance_pc 0
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
index 425dd971333..aa84a20b09c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
@@ -87,7 +87,6 @@ Dwarf::assemble $asm_file {
DW_LNS_copy
DW_LNE_set_address $main_end
- DW_LNS_copy
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp
index f646e23da62..7ae14fa9b5a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp
@@ -134,6 +134,7 @@ Dwarf::assemble $asm_file {
DW_LNS_set_epilogue_begin
DW_LNS_copy
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
index 1ba346b9758..b117c8910f0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
@@ -108,6 +108,8 @@ Dwarf::assemble $asm_file {
DW_LNE_set_address line_label_3
DW_LNS_copy
+
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
index 8d85464a826..caa40861f87 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
@@ -72,6 +72,7 @@ Dwarf::assemble $asm_file {
line [gdb_get_line_number "main end"]
DW_LNS_copy
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
index 13e7c98dcf1..1a3d53c2116 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
@@ -79,24 +79,18 @@ Dwarf::assemble $asm_file {
DW_LNS_advance_line 10
DW_LNS_copy
DW_LNS_advance_pc [lindex $main_func 1]
- DW_LNS_advance_line 19
- DW_LNS_copy
DW_LNE_end_sequence
DW_LNE_set_address [lindex $frame2_func 0]
DW_LNS_advance_line 20
DW_LNS_copy
DW_LNS_advance_pc [lindex $frame2_func 1]
- DW_LNS_advance_line 29
- DW_LNS_copy
DW_LNE_end_sequence
DW_LNE_set_address [lindex $frame3_func 0]
DW_LNS_advance_line 30
DW_LNS_copy
DW_LNS_advance_pc [lindex $frame3_func 1]
- DW_LNS_advance_line 39
- DW_LNS_copy
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
index ea69af44601..c952e82b335 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
@@ -133,9 +133,8 @@ proc do_test {suffix} {
DW_LNE_set_address main_label2
line [gdb_get_line_number "main return"]
DW_LNS_copy
+
DW_LNE_set_address $main_end
- line [expr [gdb_get_line_number "main end"] + 1]
- DW_LNS_copy
DW_LNE_end_sequence
DW_LNE_set_address $foo_start
@@ -150,25 +149,22 @@ proc do_test {suffix} {
DW_LNE_set_address foo_label3
line [gdb_get_line_number "foo end"]
DW_LNS_copy
+
DW_LNE_set_address $foo_end
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
DW_LNE_set_address $bar_start
line [gdb_get_line_number "bar end"]
DW_LNS_copy
+
DW_LNS_advance_pc $bar_len
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
DW_LNE_set_address $baz_start
line [gdb_get_line_number "baz end"]
DW_LNS_copy
+
DW_LNS_advance_pc $baz_len
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
DW_LNE_set_address $foo_cold_start
@@ -180,9 +176,8 @@ proc do_test {suffix} {
DW_LNE_set_address foo_cold_label2
line [gdb_get_line_number "foo_cold end"]
DW_LNS_copy
+
DW_LNE_set_address $foo_cold_end
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
index d2ea91e2d3d..567049adc87 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
@@ -93,8 +93,6 @@ Dwarf::assemble $asm_file_1 {
DW_LNS_copy
DW_LNE_set_address $func_end
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
}
}
@@ -177,8 +175,6 @@ Dwarf::assemble $asm_file_2 {
DW_LNS_copy
DW_LNE_set_address $main_end
- DW_LNS_advance_line 2
- DW_LNS_copy
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
index ca597aaaa3e..a1c0e7705b3 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
@@ -283,11 +283,11 @@ Dwarf::assemble ${asm_file} {
DW_LNS_copy
line [gdb_get_line_number "foo end" $libsrc]
DW_LNS_copy
+
DW_LNE_set_address $foo_end
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
+
DW_LNE_set_address $bar_start
line [gdb_get_line_number "bar prologue" $libsrc]
DW_LNS_copy
@@ -296,9 +296,8 @@ Dwarf::assemble ${asm_file} {
DW_LNS_copy
line [gdb_get_line_number "bar end" $libsrc]
DW_LNS_copy
+
DW_LNE_set_address $bar_end
- DW_LNS_advance_line 1
- DW_LNS_copy
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index d085f835f07..816440f975f 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2545,13 +2545,17 @@ namespace eval Dwarf {
proc program { body } {
variable _line_header_end_label
variable _line
+ variable _line_address_update
set _line 1
+ set _line_address_update 0
_line_finalize_header
proc DW_LNE_set_address {addr} {
+ variable _line_address_update
+ set _line_address_update 1
_op .byte 0
set start [new_label "set_address_start"]
set end [new_label "set_address_end"]
@@ -2567,6 +2571,11 @@ namespace eval Dwarf {
}
proc DW_LNE_end_sequence {} {
+ variable _line_address_update
+ if { $_line_address_update == 0 } {
+ error "Missing address update for end_sequence"
+ }
+ set _line_address_update 0
variable _line
_op .byte 0
_op .uleb128 1
@@ -2591,6 +2600,8 @@ namespace eval Dwarf {
}
proc DW_LNS_copy {} {
+ variable _line_address_update
+ set _line_address_update 0
_op .byte 1
}
@@ -2607,6 +2618,8 @@ namespace eval Dwarf {
}
proc DW_LNS_advance_pc {offset} {
+ variable _line_address_update
+ set _line_address_update 1
_op .byte 2
_op .uleb128 ${offset}
}
base-commit: 94a94c904da29bb733c19b5a0a168557c1819720
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/4] [gdb/testsuite] Require address update for DW_LNS_copy
2024-04-08 12:04 [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
@ 2024-04-08 12:04 ` Tom de Vries
2024-04-08 12:04 ` [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses Tom de Vries
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2024-04-08 12:04 UTC (permalink / raw)
To: gdb-patches
No address update before a DW_LNS_copy might mean an incorrect dwarf
assembly test-case.
Try to catch such incorrect dwarf assembly test-cases by:
- requiring an explicit address update for each DW_LNS_copy, and
- handling the cases where an update is indeed not needed, by adding
"DW_LNS_advance_pc 0".
Tested on aarch64-linux.
---
| 1 +
| 1 +
| 1 +
gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp | 3 +++
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 1 +
gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp | 6 ++++++
gdb/testsuite/lib/dwarf.exp | 3 +++
7 files changed, 16 insertions(+)
--git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
index 5268e7815ad..6d12e968f41 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
@@ -129,6 +129,7 @@ proc do_test { start_label func_name tag } {
DW_LNS_advance_line 1
DW_LNS_copy
+ DW_LNS_advance_pc 0
DW_LNS_advance_line -4
DW_LNS_set_file 1
DW_LNS_negate_stmt
--git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
index d3a1fd38ed2..6a5f7d6dd76 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
@@ -119,6 +119,7 @@ Dwarf::assemble $asm_file {
DW_LNS_advance_line 1
DW_LNS_copy
+ DW_LNS_advance_pc 0
DW_LNS_advance_line -4
DW_LNS_set_file 1
DW_LNS_negate_stmt
--git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
index 66d9f645cf3..b3db154db25 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
@@ -108,6 +108,7 @@ Dwarf::assemble $asm_file {
DW_LNS_advance_line 1
DW_LNS_copy
+ DW_LNS_advance_pc 0
DW_LNS_advance_line -4
DW_LNS_set_file 1
DW_LNS_negate_stmt
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
index b117c8910f0..ed7166983d5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
@@ -91,13 +91,16 @@ Dwarf::assemble $asm_file {
line $f1_l1
DW_LNS_copy
+ DW_LNS_advance_pc 0
line ${f1_l2}
DW_LNS_copy
+ DW_LNS_advance_pc 0
DW_LNS_set_file 2
line ${f2_l1}
DW_LNS_copy
+ DW_LNS_advance_pc 0
DW_LNS_negate_stmt
DW_LNS_copy
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
index 4f59c9b2639..968378620a0 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
@@ -96,6 +96,7 @@ Dwarf::assemble $asm_file {
DW_LNS_advance_line 1
DW_LNS_copy
+ DW_LNS_advance_pc 0
DW_LNS_advance_line -4
DW_LNS_negate_stmt
DW_LNS_copy
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
index a1c0e7705b3..2001b28989f 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
@@ -278,9 +278,12 @@ Dwarf::assemble ${asm_file} {
DW_LNE_set_address $foo_start
line [gdb_get_line_number "foo prologue" $libsrc]
DW_LNS_copy
+
DW_LNE_set_address foo_label
line [gdb_get_line_number "foo return" $libsrc]
DW_LNS_copy
+
+ DW_LNS_advance_pc 0
line [gdb_get_line_number "foo end" $libsrc]
DW_LNS_copy
@@ -291,9 +294,12 @@ Dwarf::assemble ${asm_file} {
DW_LNE_set_address $bar_start
line [gdb_get_line_number "bar prologue" $libsrc]
DW_LNS_copy
+
DW_LNE_set_address bar_label
line [gdb_get_line_number "bar return" $libsrc]
DW_LNS_copy
+
+ DW_LNS_advance_pc 0
line [gdb_get_line_number "bar end" $libsrc]
DW_LNS_copy
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 816440f975f..254f88f1055 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2601,6 +2601,9 @@ namespace eval Dwarf {
proc DW_LNS_copy {} {
variable _line_address_update
+ if { $_line_address_update == 0 } {
+ error "Missing address update for copy"
+ }
set _line_address_update 0
_op .byte 1
}
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-08 12:04 [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
2024-04-08 12:04 ` [PATCH v2 2/4] [gdb/testsuite] Require address update for DW_LNS_copy Tom de Vries
@ 2024-04-08 12:04 ` Tom de Vries
2024-04-24 17:45 ` Carl Love
2024-04-08 12:04 ` [PATCH v2 4/4] [gdb/testsuite] Require DW_LNE_end_sequence Tom de Vries
2024-04-17 10:58 ` [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
3 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2024-04-08 12:04 UTC (permalink / raw)
To: gdb-patches
I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
...
00000000004102c4 <end_of_sequence>:
4102c4: 52800000 mov w0, #0x0 // #0
4102c8: 9100c3ff add sp, sp, #0x30
4102cc: d65f03c0 ret
...
is not described by the line table:
...
File name Line number Starting address View Stmt
...
map-to-same-line.c 54 0x4102ac x
map-to-same-line.c - 0x4102c4
...
Fix this by ending the line table at $main_end.
Likewise in a few other test-cases, found using:
...
$ find gdb/testsuite/ -type f \
| xargs grep -B1 DW_LNE_end_sequence \
| grep set_address \
| egrep -v "_end|_len"
...
Tested on aarch64-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
| 2 +-
| 2 +-
| 2 +-
gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
10 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
index 1880f4cb7fb..5d6e13a9ae0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
@@ -70,7 +70,7 @@ Dwarf::assemble $asm_file {
line [line_for bar_label]
DW_LNS_copy
- DW_LNE_set_address bar_label_2
+ DW_LNE_set_address $bar_end
DW_LNE_end_sequence
}
}
--git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
index 6d12e968f41..1f30c5c3316 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
@@ -146,7 +146,7 @@ proc do_test { start_label func_name tag } {
DW_LNS_advance_line 1
DW_LNS_copy
- DW_LNE_set_address line_label_7
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
--git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
index 6a5f7d6dd76..68f1fc83859 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
@@ -134,7 +134,7 @@ Dwarf::assemble $asm_file {
DW_LNS_advance_line 1
DW_LNS_copy
- DW_LNE_set_address line_label_7
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
--git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
index b3db154db25..1b8d136e70e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
@@ -123,7 +123,7 @@ Dwarf::assemble $asm_file {
DW_LNS_negate_stmt
DW_LNS_copy
- DW_LNE_set_address line_label_7
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
index 603a616930a..c510de42037 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
@@ -27,6 +27,9 @@ Dwarf::assemble $asm_file {
declare_labels Llines
global srcdir subdir srcfile
+ get_func_info bar1
+ get_func_info bar2
+
cu {} {
compile_unit {
{language @DW_LANG_C}
@@ -69,7 +72,7 @@ Dwarf::assemble $asm_file {
line 33
DW_LNS_copy
- DW_LNE_set_address bar1_label_5
+ DW_LNE_set_address $bar1_end
DW_LNE_end_sequence
@@ -91,7 +94,7 @@ Dwarf::assemble $asm_file {
line 47
DW_LNS_copy
- DW_LNE_set_address bar2_label_5
+ DW_LNE_set_address $bar2_end
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
index 5fd6ae04d38..85d5e9c8afb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
@@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
line [line_for bar_label_4]
DW_LNS_copy
- DW_LNE_set_address bar_label_5
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
index 671e3e634ac..5a0705fc613 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
@@ -30,6 +30,8 @@ Dwarf::assemble $asm_file {
set DW_LNE_lo_usr 0x80
set DW_LNE_hi_usr 0xff
+ get_func_info main
+
cu {} {
compile_unit {
{language @DW_LANG_C}
@@ -54,7 +56,7 @@ Dwarf::assemble $asm_file {
DW_LNE_user 2 $DW_LNE_hi_usr
DW_LNS_copy
- DW_LNE_set_address main_label_2
+ DW_LNE_set_address $main_end
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
index 968378620a0..5817b2b0f53 100644
--- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
@@ -110,7 +110,7 @@ Dwarf::assemble $asm_file {
DW_LNS_negate_stmt
DW_LNS_copy
- DW_LNE_set_address line_label_7
+ DW_LNE_set_address "$func_start + $func_len"
DW_LNE_end_sequence
}
}
diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.c b/gdb/testsuite/gdb.reverse/map-to-same-line.c
index 45e7ffb0f06..7185955f40a 100644
--- a/gdb/testsuite/gdb.reverse/map-to-same-line.c
+++ b/gdb/testsuite/gdb.reverse/map-to-same-line.c
@@ -53,6 +53,5 @@ main (void)
asm ("main_return: .globl main_return");
k = j; f3 = f2; str_3 = str_2; /* TAG: main return */
- asm ("end_of_sequence: .globl end_of_sequence");
return 0; /* TAG: main return */
}
diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.exp b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
index b556e7cb676..067fe012702 100644
--- a/gdb/testsuite/gdb.reverse/map-to-same-line.exp
+++ b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
@@ -100,7 +100,8 @@ Dwarf::assemble $asm_file {
DW_LNE_set_address main_return
line [gdb_get_line_number "TAG: main return"]
DW_LNS_copy
- DW_LNE_set_address end_of_sequence
+
+ DW_LNE_set_address $main_end
DW_LNE_end_sequence
}
}
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 4/4] [gdb/testsuite] Require DW_LNE_end_sequence
2024-04-08 12:04 [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
2024-04-08 12:04 ` [PATCH v2 2/4] [gdb/testsuite] Require address update for DW_LNS_copy Tom de Vries
2024-04-08 12:04 ` [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses Tom de Vries
@ 2024-04-08 12:04 ` Tom de Vries
2024-04-17 10:58 ` [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
3 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2024-04-08 12:04 UTC (permalink / raw)
To: gdb-patches
The dwarf standard requires that every line number program sequence ends
with a DW_LNE_end_sequence instruction.
Enforce this in the dwarf assembler for the last sequence in a line number
program (we have no means to enforce this for earlier sequences), and fix a
few test-case that don't have it.
Tested on aarch64-linux.
PR testsuite/31618
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31618
---
gdb/testsuite/gdb.dwarf2/dw2-noloc.exp | 3 +++
.../gdb.dwarf2/dw2-symtab-includes-lookup.exp | 7 +++++
.../gdb.dwarf2/dw2-symtab-includes.exp | 7 +++++
gdb/testsuite/lib/dwarf.exp | 26 +++++++++++++++++++
4 files changed, 43 insertions(+)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
index 8c96ab8b0c5..bd74760e29c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
@@ -203,6 +203,9 @@ Dwarf::assemble $asm_file {
line [gdb_get_line_number "main start"]
DW_LNS_set_prologue_end
DW_LNS_copy
+
+ DW_LNE_set_address $main_end
+ DW_LNE_end_sequence
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
index 14bc84882be..96a528498da 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
@@ -50,6 +50,8 @@ Dwarf::assemble $asm_file {
declare_labels partial_label lines_label
global srcdir subdir srcfile
+ get_func_info main
+
cu {} {
partial_label: partial_unit {
{stmt_list ${lines_label} DW_FORM_sec_offset}
@@ -77,7 +79,12 @@ Dwarf::assemble $asm_file {
include_dir "${srcdir}/${subdir}"
file_name "dw2-symtab-includes.h" 1
program {
+ DW_LNE_set_address $main_start
DW_LNS_advance_line 1
+ DW_LNS_copy
+
+ DW_LNE_set_address $main_end
+ DW_LNE_end_sequence
}
}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
index 09007f22200..dc4a788bd70 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
@@ -29,6 +29,8 @@ Dwarf::assemble $asm_file {
declare_labels partial_label lines_label
global srcdir subdir srcfile
+ get_func_info main
+
cu {} {
partial_label: partial_unit {} {
}
@@ -49,7 +51,12 @@ Dwarf::assemble $asm_file {
include_dir "${srcdir}/${subdir}"
file_name "dw2-symtab-includes.h" 1
program {
+ DW_LNE_set_address $main_start
DW_LNS_advance_line 1
+ DW_LNS_copy
+
+ DW_LNE_set_address $main_end
+ DW_LNE_end_sequence
}
}
}
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 254f88f1055..c694375b534 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2546,16 +2546,20 @@ namespace eval Dwarf {
variable _line_header_end_label
variable _line
variable _line_address_update
+ variable _line_program_terminated
set _line 1
set _line_address_update 0
+ set _line_program_terminated 0
_line_finalize_header
proc DW_LNE_set_address {addr} {
variable _line_address_update
set _line_address_update 1
+ variable _line_program_terminated
+ set _line_program_terminated 0
_op .byte 0
set start [new_label "set_address_start"]
set end [new_label "set_address_end"]
@@ -2576,6 +2580,8 @@ namespace eval Dwarf {
error "Missing address update for end_sequence"
}
set _line_address_update 0
+ variable _line_program_terminated
+ set _line_program_terminated 1
variable _line
_op .byte 0
_op .uleb128 1
@@ -2584,6 +2590,8 @@ namespace eval Dwarf {
}
proc DW_LNE_user { len opcode } {
+ variable _line_program_terminated
+ set _line_program_terminated 0
set DW_LNE_lo_usr 0x80
set DW_LNE_hi_usr 0xff
if { $DW_LNE_lo_usr <= $opcode
@@ -2605,22 +2613,32 @@ namespace eval Dwarf {
error "Missing address update for copy"
}
set _line_address_update 0
+ variable _line_program_terminated
+ set _line_program_terminated 0
_op .byte 1
}
proc DW_LNS_negate_stmt {} {
+ variable _line_program_terminated
+ set _line_program_terminated 0
_op .byte 6
}
proc DW_LNS_set_prologue_end {} {
+ variable _line_program_terminated
+ set _line_program_terminated 0
_op .byte 0x0a
}
proc DW_LNS_set_epilogue_begin {} {
+ variable _line_program_terminated
+ set _line_program_terminated 0
_op .byte 0x0b
}
proc DW_LNS_advance_pc {offset} {
+ variable _line_program_terminated
+ set _line_program_terminated 0
variable _line_address_update
set _line_address_update 1
_op .byte 2
@@ -2628,6 +2646,8 @@ namespace eval Dwarf {
}
proc DW_LNS_advance_line {offset} {
+ variable _line_program_terminated
+ set _line_program_terminated 0
variable _line
_op .byte 3
_op .sleb128 ${offset}
@@ -2650,11 +2670,17 @@ namespace eval Dwarf {
}
proc DW_LNS_set_file {num} {
+ variable _line_program_terminated
+ set _line_program_terminated 0
_op .byte 4
_op .sleb128 ${num}
}
uplevel $body
+
+ if { $_line_program_terminated == 0 } {
+ error "Missing end_seq"
+ }
}
uplevel $body
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence
2024-04-08 12:04 [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
` (2 preceding siblings ...)
2024-04-08 12:04 ` [PATCH v2 4/4] [gdb/testsuite] Require DW_LNE_end_sequence Tom de Vries
@ 2024-04-17 10:58 ` Tom de Vries
3 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2024-04-17 10:58 UTC (permalink / raw)
To: gdb-patches
On 4/8/24 14:04, Tom de Vries wrote:
I've pushed this series.
Thanks,
- Tom
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-08 12:04 ` [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses Tom de Vries
@ 2024-04-24 17:45 ` Carl Love
2024-04-24 18:07 ` Carl Love
2024-04-24 18:28 ` Carl Love
0 siblings, 2 replies; 11+ messages in thread
From: Carl Love @ 2024-04-24 17:45 UTC (permalink / raw)
To: gdb-patches, Tom de Vries, Carl Love
Tom:
I am seeing a regression on Power 10 with this patch. Specifically the change to file dw2-lines.exp.
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
@@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
line [line_for bar_label_4]
DW_LNS_copy
- DW_LNE_set_address bar_label_5
+ DW_LNE_set_address "$main_start + $main_len"
DW_LNE_end_sequence
}
}
The change results in the test failing on PowerPC.
Running /home/carll/GDB/build-current/gdb/testsuite/../../../binutils-gdb-current/gdb/testsuite/gdb.dwarf2/dw2-lines.exp ...
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: continue to breakpoint: foo \(1\) (the program exited)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: next to foo (2) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: next to foo (3) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: next to foo (4) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: continue to breakpoint: foo \(1\) (the program exited)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: next to foo (2) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: next to foo (3) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: next to foo (4) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: continue to breakpoint: foo \(1\) (the program exited)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: next to foo (2) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: next to foo (3) (the program is no longer running)
FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: next to foo (4) (the program is no longer running)
etc.
If I edit the file and change the line back to bar_label_5 the test passes. I am only seeing an issue with the change to in this file. I specifically tested dw2-inline-header-2.exp and the change seems to work just fine there. I am really puzzled as to why it doesn't work in file dw2-lines.exp.
I put the print statement in:
puts "CARLL, main_start = $main_start, main_len = $main_len"
DW_LNE_set_address "$main_start + $main_len"
I get
CARLL, main_start = main_label - 28, main_len = 76
I tried printing main_label but it doesn't seem to be defined.
ERROR: in testcase /../binutils-gdb-current/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
ERROR: can't read "main_label": no such variable
ERROR: tcl error code TCL LOOKUP VARNAME main_label
ERROR: tcl error info:
can't read "main_label": no such variable
I was hoping to be able to verify that bar_label_5 and "$main_start + $main_len" are the same but no luck.
Anyway, any thoughts as to why this is failing on PowerPC? I assume it works fine on X86.
At the moment, I am a little puzzled as to what the right fix is.
Carl
On 4/8/24 05:04, Tom de Vries wrote:
> I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
> ...
> 00000000004102c4 <end_of_sequence>:
> 4102c4: 52800000 mov w0, #0x0 // #0
> 4102c8: 9100c3ff add sp, sp, #0x30
> 4102cc: d65f03c0 ret
> ...
> is not described by the line table:
> ...
> File name Line number Starting address View Stmt
> ...
> map-to-same-line.c 54 0x4102ac x
> map-to-same-line.c - 0x4102c4
> ...
>
> Fix this by ending the line table at $main_end.
>
> Likewise in a few other test-cases, found using:
> ...
> $ find gdb/testsuite/ -type f \
> | xargs grep -B1 DW_LNE_end_sequence \
> | grep set_address \
> | egrep -v "_end|_len"
> ...
>
> Tested on aarch64-linux.
> ---
> gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
> gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
> gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
> gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
> 10 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
> index 1880f4cb7fb..5d6e13a9ae0 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
> @@ -70,7 +70,7 @@ Dwarf::assemble $asm_file {
> line [line_for bar_label]
> DW_LNS_copy
>
> - DW_LNE_set_address bar_label_2
> + DW_LNE_set_address $bar_end
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
> index 6d12e968f41..1f30c5c3316 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
> @@ -146,7 +146,7 @@ proc do_test { start_label func_name tag } {
> DW_LNS_advance_line 1
> DW_LNS_copy
>
> - DW_LNE_set_address line_label_7
> + DW_LNE_set_address "$main_start + $main_len"
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
> index 6a5f7d6dd76..68f1fc83859 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
> @@ -134,7 +134,7 @@ Dwarf::assemble $asm_file {
> DW_LNS_advance_line 1
> DW_LNS_copy
>
> - DW_LNE_set_address line_label_7
> + DW_LNE_set_address "$main_start + $main_len"
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
> index b3db154db25..1b8d136e70e 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
> @@ -123,7 +123,7 @@ Dwarf::assemble $asm_file {
> DW_LNS_negate_stmt
> DW_LNS_copy
>
> - DW_LNE_set_address line_label_7
> + DW_LNE_set_address "$main_start + $main_len"
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
> index 603a616930a..c510de42037 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
> @@ -27,6 +27,9 @@ Dwarf::assemble $asm_file {
> declare_labels Llines
> global srcdir subdir srcfile
>
> + get_func_info bar1
> + get_func_info bar2
> +
> cu {} {
> compile_unit {
> {language @DW_LANG_C}
> @@ -69,7 +72,7 @@ Dwarf::assemble $asm_file {
> line 33
> DW_LNS_copy
>
> - DW_LNE_set_address bar1_label_5
> + DW_LNE_set_address $bar1_end
> DW_LNE_end_sequence
>
>
> @@ -91,7 +94,7 @@ Dwarf::assemble $asm_file {
> line 47
> DW_LNS_copy
>
> - DW_LNE_set_address bar2_label_5
> + DW_LNE_set_address $bar2_end
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> index 5fd6ae04d38..85d5e9c8afb 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> @@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
> line [line_for bar_label_4]
> DW_LNS_copy
>
> - DW_LNE_set_address bar_label_5
> + DW_LNE_set_address "$main_start + $main_len"
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
> index 671e3e634ac..5a0705fc613 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
> @@ -30,6 +30,8 @@ Dwarf::assemble $asm_file {
> set DW_LNE_lo_usr 0x80
> set DW_LNE_hi_usr 0xff
>
> + get_func_info main
> +
> cu {} {
> compile_unit {
> {language @DW_LANG_C}
> @@ -54,7 +56,7 @@ Dwarf::assemble $asm_file {
> DW_LNE_user 2 $DW_LNE_hi_usr
> DW_LNS_copy
>
> - DW_LNE_set_address main_label_2
> + DW_LNE_set_address $main_end
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
> index 968378620a0..5817b2b0f53 100644
> --- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
> +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
> @@ -110,7 +110,7 @@ Dwarf::assemble $asm_file {
> DW_LNS_negate_stmt
> DW_LNS_copy
>
> - DW_LNE_set_address line_label_7
> + DW_LNE_set_address "$func_start + $func_len"
> DW_LNE_end_sequence
> }
> }
> diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.c b/gdb/testsuite/gdb.reverse/map-to-same-line.c
> index 45e7ffb0f06..7185955f40a 100644
> --- a/gdb/testsuite/gdb.reverse/map-to-same-line.c
> +++ b/gdb/testsuite/gdb.reverse/map-to-same-line.c
> @@ -53,6 +53,5 @@ main (void)
> asm ("main_return: .globl main_return");
> k = j; f3 = f2; str_3 = str_2; /* TAG: main return */
>
> - asm ("end_of_sequence: .globl end_of_sequence");
> return 0; /* TAG: main return */
> }
> diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.exp b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
> index b556e7cb676..067fe012702 100644
> --- a/gdb/testsuite/gdb.reverse/map-to-same-line.exp
> +++ b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
> @@ -100,7 +100,8 @@ Dwarf::assemble $asm_file {
> DW_LNE_set_address main_return
> line [gdb_get_line_number "TAG: main return"]
> DW_LNS_copy
> - DW_LNE_set_address end_of_sequence
> +
> + DW_LNE_set_address $main_end
> DW_LNE_end_sequence
> }
> }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-24 17:45 ` Carl Love
@ 2024-04-24 18:07 ` Carl Love
2024-04-24 18:28 ` Carl Love
1 sibling, 0 replies; 11+ messages in thread
From: Carl Love @ 2024-04-24 18:07 UTC (permalink / raw)
To: gdb-patches, Tom de Vries, Carl Love
Tom:
I think I see the issue. bar_label_5 is a label in function bar. But "$main_start + $main_len" this
will give us an address in main, not bar. So, we need to set the address relative to the beginning of function bar?
Carl
On 4/24/24 10:45, Carl Love wrote:
> Tom:
>
> I am seeing a regression on Power 10 with this patch. Specifically the change to file dw2-lines.exp.
>
> --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> @@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
> line [line_for bar_label_4]
> DW_LNS_copy
>
> - DW_LNE_set_address bar_label_5
> + DW_LNE_set_address "$main_start + $main_len"
> DW_LNE_end_sequence
> }
> }
>
> The change results in the test failing on PowerPC.
>
> Running /home/carll/GDB/build-current/gdb/testsuite/../../../binutils-gdb-current/gdb/testsuite/gdb.dwarf2/dw2-lines.exp ...
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: continue to breakpoint: foo \(1\) (the program exited)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: next to foo (2) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: next to foo (3) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: next to foo (4) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: continue to breakpoint: foo \(1\) (the program exited)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: next to foo (2) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: next to foo (3) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=64: next to foo (4) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: continue to breakpoint: foo \(1\) (the program exited)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: next to foo (2) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: next to foo (3) (the program is no longer running)
> FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=64: lv=2: ldw=32: next to foo (4) (the program is no longer running)
> etc.
>
> If I edit the file and change the line back to bar_label_5 the test passes. I am only seeing an issue with the change to in this file. I specifically tested dw2-inline-header-2.exp and the change seems to work just fine there. I am really puzzled as to why it doesn't work in file dw2-lines.exp.
>
> I put the print statement in:
>
> puts "CARLL, main_start = $main_start, main_len = $main_len"
> DW_LNE_set_address "$main_start + $main_len"
>
> I get
>
> CARLL, main_start = main_label - 28, main_len = 76
>
> I tried printing main_label but it doesn't seem to be defined.
>
> ERROR: in testcase /../binutils-gdb-current/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> ERROR: can't read "main_label": no such variable
> ERROR: tcl error code TCL LOOKUP VARNAME main_label
> ERROR: tcl error info:
> can't read "main_label": no such variable
>
> I was hoping to be able to verify that bar_label_5 and "$main_start + $main_len" are the same but no luck.
> Anyway, any thoughts as to why this is failing on PowerPC? I assume it works fine on X86.
>
> At the moment, I am a little puzzled as to what the right fix is.
>
> Carl
>
> On 4/8/24 05:04, Tom de Vries wrote:
>> I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
>> ...
>> 00000000004102c4 <end_of_sequence>:
>> 4102c4: 52800000 mov w0, #0x0 // #0
>> 4102c8: 9100c3ff add sp, sp, #0x30
>> 4102cc: d65f03c0 ret
>> ...
>> is not described by the line table:
>> ...
>> File name Line number Starting address View Stmt
>> ...
>> map-to-same-line.c 54 0x4102ac x
>> map-to-same-line.c - 0x4102c4
>> ...
>>
>> Fix this by ending the line table at $main_end.
>>
>> Likewise in a few other test-cases, found using:
>> ...
>> $ find gdb/testsuite/ -type f \
>> | xargs grep -B1 DW_LNE_end_sequence \
>> | grep set_address \
>> | egrep -v "_end|_len"
>> ...
>>
>> Tested on aarch64-linux.
>> ---
>> gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
>> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
>> gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
>> gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
>> gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
>> 10 files changed, 16 insertions(+), 11 deletions(-)
>>
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
>> index 1880f4cb7fb..5d6e13a9ae0 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp
>> @@ -70,7 +70,7 @@ Dwarf::assemble $asm_file {
>> line [line_for bar_label]
>> DW_LNS_copy
>>
>> - DW_LNE_set_address bar_label_2
>> + DW_LNE_set_address $bar_end
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
>> index 6d12e968f41..1f30c5c3316 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
>> @@ -146,7 +146,7 @@ proc do_test { start_label func_name tag } {
>> DW_LNS_advance_line 1
>> DW_LNS_copy
>>
>> - DW_LNE_set_address line_label_7
>> + DW_LNE_set_address "$main_start + $main_len"
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
>> index 6a5f7d6dd76..68f1fc83859 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
>> @@ -134,7 +134,7 @@ Dwarf::assemble $asm_file {
>> DW_LNS_advance_line 1
>> DW_LNS_copy
>>
>> - DW_LNE_set_address line_label_7
>> + DW_LNE_set_address "$main_start + $main_len"
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
>> index b3db154db25..1b8d136e70e 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
>> @@ -123,7 +123,7 @@ Dwarf::assemble $asm_file {
>> DW_LNS_negate_stmt
>> DW_LNS_copy
>>
>> - DW_LNE_set_address line_label_7
>> + DW_LNE_set_address "$main_start + $main_len"
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
>> index 603a616930a..c510de42037 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
>> @@ -27,6 +27,9 @@ Dwarf::assemble $asm_file {
>> declare_labels Llines
>> global srcdir subdir srcfile
>>
>> + get_func_info bar1
>> + get_func_info bar2
>> +
>> cu {} {
>> compile_unit {
>> {language @DW_LANG_C}
>> @@ -69,7 +72,7 @@ Dwarf::assemble $asm_file {
>> line 33
>> DW_LNS_copy
>>
>> - DW_LNE_set_address bar1_label_5
>> + DW_LNE_set_address $bar1_end
>> DW_LNE_end_sequence
>>
>>
>> @@ -91,7 +94,7 @@ Dwarf::assemble $asm_file {
>> line 47
>> DW_LNS_copy
>>
>> - DW_LNE_set_address bar2_label_5
>> + DW_LNE_set_address $bar2_end
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>> index 5fd6ae04d38..85d5e9c8afb 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>> @@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
>> line [line_for bar_label_4]
>> DW_LNS_copy
>>
>> - DW_LNE_set_address bar_label_5
>> + DW_LNE_set_address "$main_start + $main_len"
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
>> index 671e3e634ac..5a0705fc613 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
>> @@ -30,6 +30,8 @@ Dwarf::assemble $asm_file {
>> set DW_LNE_lo_usr 0x80
>> set DW_LNE_hi_usr 0xff
>>
>> + get_func_info main
>> +
>> cu {} {
>> compile_unit {
>> {language @DW_LANG_C}
>> @@ -54,7 +56,7 @@ Dwarf::assemble $asm_file {
>> DW_LNE_user 2 $DW_LNE_hi_usr
>> DW_LNS_copy
>>
>> - DW_LNE_set_address main_label_2
>> + DW_LNE_set_address $main_end
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
>> index 968378620a0..5817b2b0f53 100644
>> --- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
>> +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
>> @@ -110,7 +110,7 @@ Dwarf::assemble $asm_file {
>> DW_LNS_negate_stmt
>> DW_LNS_copy
>>
>> - DW_LNE_set_address line_label_7
>> + DW_LNE_set_address "$func_start + $func_len"
>> DW_LNE_end_sequence
>> }
>> }
>> diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.c b/gdb/testsuite/gdb.reverse/map-to-same-line.c
>> index 45e7ffb0f06..7185955f40a 100644
>> --- a/gdb/testsuite/gdb.reverse/map-to-same-line.c
>> +++ b/gdb/testsuite/gdb.reverse/map-to-same-line.c
>> @@ -53,6 +53,5 @@ main (void)
>> asm ("main_return: .globl main_return");
>> k = j; f3 = f2; str_3 = str_2; /* TAG: main return */
>>
>> - asm ("end_of_sequence: .globl end_of_sequence");
>> return 0; /* TAG: main return */
>> }
>> diff --git a/gdb/testsuite/gdb.reverse/map-to-same-line.exp b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
>> index b556e7cb676..067fe012702 100644
>> --- a/gdb/testsuite/gdb.reverse/map-to-same-line.exp
>> +++ b/gdb/testsuite/gdb.reverse/map-to-same-line.exp
>> @@ -100,7 +100,8 @@ Dwarf::assemble $asm_file {
>> DW_LNE_set_address main_return
>> line [gdb_get_line_number "TAG: main return"]
>> DW_LNS_copy
>> - DW_LNE_set_address end_of_sequence
>> +
>> + DW_LNE_set_address $main_end
>> DW_LNE_end_sequence
>> }
>> }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-24 17:45 ` Carl Love
2024-04-24 18:07 ` Carl Love
@ 2024-04-24 18:28 ` Carl Love
2024-04-24 21:07 ` Tom de Vries
1 sibling, 1 reply; 11+ messages in thread
From: Carl Love @ 2024-04-24 18:28 UTC (permalink / raw)
To: gdb-patches, Tom de Vries, Carl Love
Tom:
The following patch fixes the issue for me on PowerPC. Please let me know if it looks ok and if the patch works on your systems as well. Thanks.
Carl
----------------------------------------------------------------------
Fix end_sequence addresses for dw2-lines.exp
The patch:
From f0d556d14b1d1c3f8e2f9c13b08adca22e1b8c9c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 17 Apr 2024 12:55:00 +0200
Subject: [PATCH] [gdb/testsuite] Fix end_sequence addresses
I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
...
00000000004102c4 <end_of_sequence>:
4102c4: 52800000 mov w0, #0x0 // #0
4102c8: 9100c3ff add sp, sp, #0x30
4102cc: d65f03c0 ret
...
is not described by the line table:
...
File name Line number Starting address View Stmt
...
map-to-same-line.c 54 0x4102ac x
map-to-same-line.c - 0x4102c4
...
Fix this by ending the line table at $main_end.
Likewise in a few other test-cases, found using:
...
$ find gdb/testsuite/ -type f \
| xargs grep -B1 DW_LNE_end_sequence \
| grep set_address \
| egrep -v "_end|_len"
...
Tested on aarch64-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
10 files changed, 16 insertions(+), 11 deletions(-)
The issue in file dw2-lines.exp is the change
- DW_LNE_set_address bar_label_5
+ DW_LNE_set_address "$main_start + $main_len"
The label bar_label_5 is in function bar, not function main. The new
set address should have been $bar_start + $bar_len.
---
gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
index 85d5e9c8afb..af5b6b71768 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
@@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
line [line_for bar_label_4]
DW_LNS_copy
- DW_LNE_set_address "$main_start + $main_len"
+ DW_LNE_set_address "$bar_start + $bar_len"
DW_LNE_end_sequence
}
}
--
2.44.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-24 18:28 ` Carl Love
@ 2024-04-24 21:07 ` Tom de Vries
2024-04-25 17:05 ` Carl Love
0 siblings, 1 reply; 11+ messages in thread
From: Tom de Vries @ 2024-04-24 21:07 UTC (permalink / raw)
To: Carl Love, gdb-patches
On 4/24/24 20:28, Carl Love wrote:
>
> Tom:
>
> The following patch fixes the issue for me on PowerPC. Please let me know if it looks ok and if the patch works on your systems as well. Thanks.
>
> Carl
Hi Carl,
I don't see the FAILs you mentioned, but your patch is correct, and
doesn't regress the test-case for me on x86_64-linux.
Thanks for finding, reporting and fixing this.
So, approved, but consider making the commit message shorter.
Including the entire commit message of the patch you're fixing is a bit
of an overkill.
Approved-By: Tom de Vries <tdevries@suse.de>
Thanks,
- Tom
>
> ----------------------------------------------------------------------
>
> Fix end_sequence addresses for dw2-lines.exp
>
> The patch:
>
> From f0d556d14b1d1c3f8e2f9c13b08adca22e1b8c9c Mon Sep 17 00:00:00 2001
> From: Tom de Vries <tdevries@suse.de>
> Date: Wed, 17 Apr 2024 12:55:00 +0200
> Subject: [PATCH] [gdb/testsuite] Fix end_sequence addresses
>
> I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
> ...
> 00000000004102c4 <end_of_sequence>:
> 4102c4: 52800000 mov w0, #0x0 // #0
> 4102c8: 9100c3ff add sp, sp, #0x30
> 4102cc: d65f03c0 ret
> ...
> is not described by the line table:
> ...
> File name Line number Starting address View Stmt
> ...
> map-to-same-line.c 54 0x4102ac x
> map-to-same-line.c - 0x4102c4
> ...
>
> Fix this by ending the line table at $main_end.
>
> Likewise in a few other test-cases, found using:
> ...
> $ find gdb/testsuite/ -type f \
> | xargs grep -B1 DW_LNE_end_sequence \
> | grep set_address \
> | egrep -v "_end|_len"
> ...
>
> Tested on aarch64-linux.
> ---
> gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
> gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
> gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
> gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
> gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
> 10 files changed, 16 insertions(+), 11 deletions(-)
>
> The issue in file dw2-lines.exp is the change
>
>
> - DW_LNE_set_address bar_label_5
> + DW_LNE_set_address "$main_start + $main_len"
>
> The label bar_label_5 is in function bar, not function main. The new
> set address should have been $bar_start + $bar_len.
> ---
> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> index 85d5e9c8afb..af5b6b71768 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
> @@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
> line [line_for bar_label_4]
> DW_LNS_copy
>
> - DW_LNE_set_address "$main_start + $main_len"
> + DW_LNE_set_address "$bar_start + $bar_len"
> DW_LNE_end_sequence
> }
> }
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-24 21:07 ` Tom de Vries
@ 2024-04-25 17:05 ` Carl Love
2024-04-25 20:46 ` Tom de Vries
0 siblings, 1 reply; 11+ messages in thread
From: Carl Love @ 2024-04-25 17:05 UTC (permalink / raw)
To: Tom de Vries, gdb-patches, Carl Love
Tom:
Thanks for verifying the patch on X86. I agree, including the entire commit message from your patch
is a little overkill. I cut down your commit message and made the description of my fix a little better.
Here is what I now have for the commit message:
------------------------------------------------------
Fix end_sequence addresses for dw2-lines.exp
The patch:
From f0d556d14b1d1c3f8e2f9c13b08adca22e1b8c9c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 17 Apr 2024 12:55:00 +0200
Subject: [PATCH] [gdb/testsuite] Fix end_sequence addresses
I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
...
00000000004102c4 <end_of_sequence>:
4102c4: 52800000 mov w0, #0x0 // #0
4102c8: 9100c3ff add sp, sp, #0x30
4102cc: d65f03c0 ret
...
is not described by the line table:
...
<snip>
The regression failure on PowerPC is due to the change in file
dw2-lines.exp,
- DW_LNE_set_address bar_label_5
+ DW_LNE_set_address "$main_start + $main_len"
The label bar_label_5 is in function bar, not function main. The new
set address should have been $bar_start + $bar_len.
--------------------------------------------------------
Please let me know if that looks reasonable and I will then commit the fix. Thanks!
Carl
On 4/24/24 14:07, Tom de Vries wrote:
> On 4/24/24 20:28, Carl Love wrote:
>>
>> Tom:
>>
>> The following patch fixes the issue for me on PowerPC. Please let me know if it looks ok and if the patch works on your systems as well. Thanks.
>>
>> Carl
>
> Hi Carl,
>
> I don't see the FAILs you mentioned, but your patch is correct, and doesn't regress the test-case for me on x86_64-linux.
>
> Thanks for finding, reporting and fixing this.
>
> So, approved, but consider making the commit message shorter. Including the entire commit message of the patch you're fixing is a bit of an overkill.
>
> Approved-By: Tom de Vries <tdevries@suse.de>
>
> Thanks,
> - Tom
>
>>
>> ----------------------------------------------------------------------
>>
>> Fix end_sequence addresses for dw2-lines.exp
>>
>> The patch:
>>
>> From f0d556d14b1d1c3f8e2f9c13b08adca22e1b8c9c Mon Sep 17 00:00:00 2001
>> From: Tom de Vries <tdevries@suse.de>
>> Date: Wed, 17 Apr 2024 12:55:00 +0200
>> Subject: [PATCH] [gdb/testsuite] Fix end_sequence addresses
>>
>> I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
>> ...
>> 00000000004102c4 <end_of_sequence>:
>> 4102c4: 52800000 mov w0, #0x0 // #0
>> 4102c8: 9100c3ff add sp, sp, #0x30
>> 4102cc: d65f03c0 ret
>> ...
>> is not described by the line table:
>> ...
>> File name Line number Starting address View Stmt
>> ...
>> map-to-same-line.c 54 0x4102ac x
>> map-to-same-line.c - 0x4102c4
>> ...
>>
>> Fix this by ending the line table at $main_end.
>>
>> Likewise in a few other test-cases, found using:
>> ...
>> $ find gdb/testsuite/ -type f \
>> | xargs grep -B1 DW_LNE_end_sequence \
>> | grep set_address \
>> | egrep -v "_end|_len"
>> ...
>>
>> Tested on aarch64-linux.
>> ---
>> gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
>> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
>> gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
>> gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
>> gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
>> gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
>> 10 files changed, 16 insertions(+), 11 deletions(-)
>>
>> The issue in file dw2-lines.exp is the change
>>
>>
>> - DW_LNE_set_address bar_label_5
>> + DW_LNE_set_address "$main_start + $main_len"
>>
>> The label bar_label_5 is in function bar, not function main. The new
>> set address should have been $bar_start + $bar_len.
>> ---
>> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>> index 85d5e9c8afb..af5b6b71768 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>> @@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
>> line [line_for bar_label_4]
>> DW_LNS_copy
>> - DW_LNE_set_address "$main_start + $main_len"
>> + DW_LNE_set_address "$bar_start + $bar_len"
>> DW_LNE_end_sequence
>> }
>> }
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses
2024-04-25 17:05 ` Carl Love
@ 2024-04-25 20:46 ` Tom de Vries
0 siblings, 0 replies; 11+ messages in thread
From: Tom de Vries @ 2024-04-25 20:46 UTC (permalink / raw)
To: Carl Love, gdb-patches
On 4/25/24 19:05, Carl Love wrote:
> Tom:
>
> Thanks for verifying the patch on X86. I agree, including the entire commit message from your patch
> is a little overkill. I cut down your commit message and made the description of my fix a little better.
> Here is what I now have for the commit message:
>
> ------------------------------------------------------
> Fix end_sequence addresses for dw2-lines.exp
>
> The patch:
>
> From f0d556d14b1d1c3f8e2f9c13b08adca22e1b8c9c Mon Sep 17 00:00:00 2001
> From: Tom de Vries <tdevries@suse.de>
> Date: Wed, 17 Apr 2024 12:55:00 +0200
> Subject: [PATCH] [gdb/testsuite] Fix end_sequence addresses
>
> I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
> ...
> 00000000004102c4 <end_of_sequence>:
> 4102c4: 52800000 mov w0, #0x0 // #0
> 4102c8: 9100c3ff add sp, sp, #0x30
> 4102cc: d65f03c0 ret
> ...
> is not described by the line table:
> ...
>
> <snip>
>
>
> The regression failure on PowerPC is due to the change in file
> dw2-lines.exp,
>
> - DW_LNE_set_address bar_label_5
> + DW_LNE_set_address "$main_start + $main_len"
>
> The label bar_label_5 is in function bar, not function main. The new
> set address should have been $bar_start + $bar_len.
>
> --------------------------------------------------------
>
> Please let me know if that looks reasonable and I will then commit the fix. Thanks!
Hi Carl,
yes, this is fine, thanks.
- Tom
>
> Carl
>
>
> On 4/24/24 14:07, Tom de Vries wrote:
>> On 4/24/24 20:28, Carl Love wrote:
>>>
>>> Tom:
>>>
>>> The following patch fixes the issue for me on PowerPC. Please let me know if it looks ok and if the patch works on your systems as well. Thanks.
>>>
>>> Carl
>>
>> Hi Carl,
>>
>> I don't see the FAILs you mentioned, but your patch is correct, and doesn't regress the test-case for me on x86_64-linux.
>>
>> Thanks for finding, reporting and fixing this.
>>
>> So, approved, but consider making the commit message shorter. Including the entire commit message of the patch you're fixing is a bit of an overkill.
>>
>> Approved-By: Tom de Vries <tdevries@suse.de>
>>
>> Thanks,
>> - Tom
>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Fix end_sequence addresses for dw2-lines.exp
>>>
>>> The patch:
>>>
>>> From f0d556d14b1d1c3f8e2f9c13b08adca22e1b8c9c Mon Sep 17 00:00:00 2001
>>> From: Tom de Vries <tdevries@suse.de>
>>> Date: Wed, 17 Apr 2024 12:55:00 +0200
>>> Subject: [PATCH] [gdb/testsuite] Fix end_sequence addresses
>>>
>>> I noticed in test-case gdb.reverse/map-to-same-line.exp, that the end of main:
>>> ...
>>> 00000000004102c4 <end_of_sequence>:
>>> 4102c4: 52800000 mov w0, #0x0 // #0
>>> 4102c8: 9100c3ff add sp, sp, #0x30
>>> 4102cc: d65f03c0 ret
>>> ...
>>> is not described by the line table:
>>> ...
>>> File name Line number Starting address View Stmt
>>> ...
>>> map-to-same-line.c 54 0x4102ac x
>>> map-to-same-line.c - 0x4102c4
>>> ...
>>>
>>> Fix this by ending the line table at $main_end.
>>>
>>> Likewise in a few other test-cases, found using:
>>> ...
>>> $ find gdb/testsuite/ -type f \
>>> | xargs grep -B1 DW_LNE_end_sequence \
>>> | grep set_address \
>>> | egrep -v "_end|_len"
>>> ...
>>>
>>> Tested on aarch64-linux.
>>> ---
>>> gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp | 2 +-
>>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 2 +-
>>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 2 +-
>>> gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 2 +-
>>> gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp | 7 +++++--
>>> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
>>> gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 4 +++-
>>> gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl | 2 +-
>>> gdb/testsuite/gdb.reverse/map-to-same-line.c | 1 -
>>> gdb/testsuite/gdb.reverse/map-to-same-line.exp | 3 ++-
>>> 10 files changed, 16 insertions(+), 11 deletions(-)
>>>
>>> The issue in file dw2-lines.exp is the change
>>>
>>>
>>> - DW_LNE_set_address bar_label_5
>>> + DW_LNE_set_address "$main_start + $main_len"
>>>
>>> The label bar_label_5 is in function bar, not function main. The new
>>> set address should have been $bar_start + $bar_len.
>>> ---
>>> gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>>> index 85d5e9c8afb..af5b6b71768 100644
>>> --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
>>> @@ -104,7 +104,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
>>> line [line_for bar_label_4]
>>> DW_LNS_copy
>>> - DW_LNE_set_address "$main_start + $main_len"
>>> + DW_LNE_set_address "$bar_start + $bar_len"
>>> DW_LNE_end_sequence
>>> }
>>> }
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-04-25 20:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 12:04 [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
2024-04-08 12:04 ` [PATCH v2 2/4] [gdb/testsuite] Require address update for DW_LNS_copy Tom de Vries
2024-04-08 12:04 ` [PATCH v2 3/4] [gdb/testsuite] Fix end_sequence addresses Tom de Vries
2024-04-24 17:45 ` Carl Love
2024-04-24 18:07 ` Carl Love
2024-04-24 18:28 ` Carl Love
2024-04-24 21:07 ` Tom de Vries
2024-04-25 17:05 ` Carl Love
2024-04-25 20:46 ` Tom de Vries
2024-04-08 12:04 ` [PATCH v2 4/4] [gdb/testsuite] Require DW_LNE_end_sequence Tom de Vries
2024-04-17 10:58 ` [PATCH v2 1/4] [gdb/testsuite] Require address update for DW_LNE_end_sequence Tom de Vries
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).