[2/3,gdb/testsuite] Require address update for DW_LNS_copy
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
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 such an update is not needed, by adding
"DW_LNS_advance_pc 0".
Tested on aarch64-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp | 1 +
gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp | 1 +
gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp | 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(+)
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
}