aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb.exp
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-01-25 16:32:31 +0100
committerTom de Vries <tdevries@suse.de>2021-01-25 16:32:31 +0100
commit9f6c202e573b796a9e7328cc5fdab7c0c63776bf (patch)
tree310272100983769de46bdd3f11b907e62700b69e /gdb/testsuite/lib/gdb.exp
parentf3bdc2dbb9673ee2d0d4d51c86a278dce199d360 (diff)
downloadgdb-9f6c202e573b796a9e7328cc5fdab7c0c63776bf.zip
gdb-9f6c202e573b796a9e7328cc5fdab7c0c63776bf.tar.gz
gdb-9f6c202e573b796a9e7328cc5fdab7c0c63776bf.tar.bz2
[gdb/symtab] Handle DW_AT_ranges with DW_FORM_sec_off in partial DIE
While looking into a failure in gdb.go/package.exp with gcc-11, I noticed that gdb shows some complaints when loading the executable (also with gcc-10, where the test-case passes): ... $ gdb -batch -iex "set complaints 100" package.10 -ex start During symbol reading: Attribute value is not a constant (DW_FORM_sec_offset) Temporary breakpoint 1 at 0x402ae6: file gdb.go/package1.go, line 8. During symbol reading: Attribute value is not a constant (DW_FORM_sec_offset) During symbol reading: Invalid .debug_rnglists data (no base address) ... Fix this by using as_unsigned () to read DW_AT_ranges in the partial DIE reader, similar to how that is done in dwarf2_get_pc_bounds. Tested on x86_64-linux. gdb/ChangeLog: 2021-01-25 Bernd Edlinger <bernd.edlinger@hotmail.de> Simon Marchi <simon.marchi@polymtl.ca> Tom de Vries <tdevries@suse.de> * dwarf2/read.c (partial_die_info::read): Use as_unsigned () for DW_AT_ranges. gdb/testsuite/ChangeLog: 2021-01-25 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-ranges-psym.exp (gdb_load_no_complaints): New proc. * lib/gdb.exp: Use gdb_load_no_complaints.
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r--gdb/testsuite/lib/gdb.exp36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 03653ab..2a952c6 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5095,6 +5095,42 @@ proc gdb_load { arg } {
return 0
}
+#
+# gdb_load_no_complaints -- As gdb_load, but in addition verifies that
+# loading caused no symbol reading complaints.
+#
+proc gdb_load_no_complaints { arg } {
+ global gdb_prompt gdb_file_cmd_msg decimal
+
+ # Save current setting of complaints.
+ set save ""
+ set show_complaints_re \
+ "Max number of complaints about incorrect symbols is ($decimal)\\."
+ gdb_test_multiple "show complaints" "" {
+ -re -wrap $show_complaints_re {
+ set save $expect_out(1,string)
+ }
+ }
+
+ # Fall back to regular gdb_load if we couldn't get the current setting
+ # of complaints.
+ if { $save == "" } {
+ return gdb_load $arg
+ }
+
+ # Temporarily set complaint to a small non-zero number.
+ gdb_test_no_output "set complaints 5" ""
+
+ gdb_load $arg
+
+ # Verify that there were no complaints.
+ set re "^Reading symbols from \[^\r\n\]*\r\n$gdb_prompt $"
+ gdb_assert {[regexp $re $gdb_file_cmd_msg]} "No complaints"
+
+ # Restore saved setting of complaints.
+ gdb_test_no_output "set complaints $save" ""
+}
+
# gdb_reload -- load a file into the target. Called before "running",
# either the first time or after already starting the program once,
# for remote targets. Most files that override gdb_load should now