+2020-10-28 Tom de Vries <tdevries@suse.de>
+
+ * lib/gdb.exp (gdb_file_cmd): Set gdb_file_cmd_msg.
+ * gdb.cp/nsalias.exp: Set complaints limit before file cmd. Expect
+ complaint during file command for -readnow.
+
2020-10-28 Tom de Vries <tdevries@suse.de>
* gdb.cp/nsalias.exp: Fix typo in test name.
return -1
}
-clean_restart ${testfile}-r
+clean_restart
+# Set complaints before loading the file. Otherwise the complaint won't
+# trigger for -readnow.
gdb_test_no_output "set complaints 1"
-gdb_test "print N100::x" \
- ".* has too many recursively imported declarations.*" \
- "complaint for too many recursively imported declarations"
+
+gdb_load [standard_output_file ${testfile}-r]
+
+set readnow_p [readnow]
+
+set test "complaint for too many recursively imported declarations"
+set re ".* has too many recursively imported declarations.*"
+if { $readnow_p } {
+ global gdb_file_cmd_msg
+ gdb_assert {[regexp $re $gdb_file_cmd_msg]} $test
+} else {
+ gdb_test "print N100::x" $re $test
+}
# compiled in
# fail file was not loaded
#
+# This procedure also set the global variable GDB_FILE_CMD_MSG to the
+# output of the file command in case of success.
+#
# I tried returning this information as part of the return value,
# but ran into a mess because of the many re-implementations of
# gdb_load in config/*.exp.
# Set whether debug info was found.
# Default to "fail".
- global gdb_file_cmd_debug_info
+ global gdb_file_cmd_debug_info gdb_file_cmd_msg
set gdb_file_cmd_debug_info "fail"
if [is_remote host] {
set new_symbol_table 0
set basename [file tail $arg]
gdb_expect 120 {
- -re "Reading symbols from.*LZMA support was disabled.*$gdb_prompt $" {
+ -re "(Reading symbols from.*LZMA support was disabled.*$gdb_prompt $)" {
verbose "\t\tLoaded $arg into $GDB; .gnu_debugdata found but no LZMA available"
+ set gdb_file_cmd_msg $expect_out(1,string)
set gdb_file_cmd_debug_info "lzma"
return 0
}
- -re "Reading symbols from.*no debugging symbols found.*$gdb_prompt $" {
+ -re "(Reading symbols from.*no debugging symbols found.*$gdb_prompt $)" {
verbose "\t\tLoaded $arg into $GDB with no debugging symbols"
+ set gdb_file_cmd_msg $expect_out(1,string)
set gdb_file_cmd_debug_info "nodebug"
return 0
}
- -re "Reading symbols from.*$gdb_prompt $" {
+ -re "(Reading symbols from.*$gdb_prompt $)" {
verbose "\t\tLoaded $arg into $GDB"
+ set gdb_file_cmd_msg $expect_out(1,string)
set gdb_file_cmd_debug_info "debug"
return 0
}