]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Require address update for DW_LNS_copy
authorTom de Vries <tdevries@suse.de>
Wed, 17 Apr 2024 10:55:00 +0000 (12:55 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 17 Apr 2024 10:55:00 +0000 (12:55 +0200)
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.

gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
gdb/testsuite/lib/dwarf.exp

index 5268e7815ad85264296c011f76224cacb5be76d9..6d12e968f41c6d56fa6774ed288439f5cf1b7a63 100644 (file)
@@ -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
index d3a1fd38ed27b2b726b34c2e45384d9c012c4ba5..6a5f7d6dd76ccab305bb4967e0f039b86dfaf55f 100644 (file)
@@ -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
index 66d9f645cf30b9f7454cd04dfd30ac3c557bfe46..b3db154db257394fb18415188d15d3605be24330 100644 (file)
@@ -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
index b117c8910f050cb7088fd370f3e4d42b864022d1..ed7166983d5e8265f7579db3a6ba115ebfbcc84c 100644 (file)
@@ -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
 
index 4f59c9b2639f69b20646171e8f8d086cb095c738..968378620a04a17827f1e57568e4b8324dc5bebc 100644 (file)
@@ -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
index a1c0e7705b301fac18d84ae6607bf5044f527a60..2001b28989f865821678ea3810c5527cd27c46c2 100644 (file)
@@ -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
 
index 816440f975f229c672b6c9c019a546058892e42f..254f88f1055733cf86998dfae64f0aff4f1d8a9e 100644 (file)
@@ -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
            }