[gdb/testsuite] Generate .debug_aranges in gdb.dwarf2/locexpr-data-member-location.exp
authorTom de Vries <tdevries@suse.de>
Tue, 14 Sep 2021 10:57:58 +0000 (12:57 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 14 Sep 2021 10:57:58 +0000 (12:57 +0200)
When running test-case gdb.dwarf2/locexpr-data-member-location.exp with target
board cc-with-debug-names, all tests pass but we run into PR28261:
...
(gdb) run ^M
Starting program: locexpr-data-member-location ^M
warning: Section .debug_names in locexpr-data-member-location-lib.so has \
  abbreviation_table of size 1 vs. written as 37, ignoring .debug_names.^M
...

Using a patch that fixes PR28261, the warning is gone, but we run into:
...
FAIL: gdb.dwarf2/locexpr-data-member-location.exp: step into foo
...

This is due a missing .debug_aranges contribution for the CU declared in
gdb.dwarf2/locexpr-data-member-location.exp.

Fix this by adding the missing .debug_aranges contribution.

Tested on x86_64-linux.

gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp

index 1f70e6a34bd00433e766d26732e97638d3348f52..1c3665218082d115f11a006d76f0abc5e6d83192 100644 (file)
@@ -144,7 +144,7 @@ Dwarf::assemble ${asm_file} {
     get_func_info foo $flags
     get_func_info bar $flags
 
-    cu {} {
+    cu { label cu_label } {
        DW_TAG_compile_unit {
            {DW_AT_language @DW_LANG_C_plus_plus}
            {name ${::srcfile}}
@@ -294,6 +294,11 @@ Dwarf::assemble ${asm_file} {
            {DW_LNE_end_sequence}
        }
     }
+
+    aranges {} cu_label {
+       arange {} $foo_start $foo_end
+       arange {} $bar_start $bar_end
+    }
 }
 
 # Compile the shared object again, but this time include / use the