]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix end_sequence addresses
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)
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
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-line-number-zero.exp
gdb/testsuite/gdb.dwarf2/dw2-lines.exp
gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
gdb/testsuite/gdb.reverse/map-to-same-line.c
gdb/testsuite/gdb.reverse/map-to-same-line.exp

index 1880f4cb7fbd5d6f4eb01af62e3dbe77ce8c11bf..5d6e13a9ae0465a1d0266e581528a740b81b9429 100644 (file)
@@ -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
        }
     }
index 6d12e968f41c6d56fa6774ed288439f5cf1b7a63..1f30c5c33165c3739ebf63b3f3e20d6f456014a0 100644 (file)
@@ -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
            }
        }
index 6a5f7d6dd76ccab305bb4967e0f039b86dfaf55f..68f1fc8385919e1bebb5299a48d790ac29df4be5 100644 (file)
@@ -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
        }
     }
index b3db154db257394fb18415188d15d3605be24330..1b8d136e70eaabf725d810fe7239ffe16a527615 100644 (file)
@@ -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
        }
     }
index 603a616930a333ce490706ee67f6bece2b210c03..c510de4203789f0afecc0d2ea38d2553e098b338 100644 (file)
@@ -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
        }
     }
index 5fd6ae04d385191a53980cbf51fd08d05fbe9794..85d5e9c8afb01000f4de1933257afb1471b7ef47 100644 (file)
@@ -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
            }
        }
index 671e3e634ac9a5b1c0893e9eec2ba7551f8d5d68..5a0705fc613d160f386bc6b76dc6b31e6fc69b3a 100644 (file)
@@ -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
        }
     }
index 968378620a04a17827f1e57568e4b8324dc5bebc..5817b2b0f53dca2b9043989f8220b39c9ae66b0b 100644 (file)
@@ -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
        }
     }
index 45e7ffb0f0640d485d18f419bde129128c5432db..7185955f40af9d43f971793f5772d1d4a6a548ea 100644 (file)
@@ -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 */
 }
index b556e7cb676a99bed9d1d4b997db8bf88dc4b894..067fe0127029e76b5eb33ca9086722f69afbeb36 100644 (file)
@@ -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
        }
     }