[gdb/testsuite] Fix gdb.base/maint.exp FAILs with -readnow

When running test-case gdb.base/maint.exp with target board readnow, we run
into:
...
FAIL: gdb.base/maint.exp: mt expand-symtabs
FAIL: gdb.base/maint.exp: maint print objfiles: psymtabs
FAIL: gdb.base/maint.exp: maint print psymbols -source
FAIL: gdb.base/maint.exp: maint print psymbols -pc
FAIL: gdb.base/maint.exp: maint info line-table with filename of symtab that \
  is not currently expanded
...

When using -readnow:
- there are no partial symtabs
- all symtabs are expanded at symbol load time
and these differences from normal behaviour cause the FAILs.

Update the tests for -readnow.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-27  Tom de Vries  <tdevries@suse.de>

	* gdb.base/maint.exp: Update for -readnow.
This commit is contained in:
Tom de Vries
2020-10-27 23:17:09 +01:00
parent 06db6ec3d9
commit 5868da034f
2 changed files with 24 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2020-10-27 Tom de Vries <tdevries@suse.de>
* gdb.base/maint.exp: Update for -readnow.
2020-10-27 Tom de Vries <tdevries@suse.de> 2020-10-27 Tom de Vries <tdevries@suse.de>
* gdb.cp/psymtab-parameter.exp: Don't expect unexpanded CU for * gdb.cp/psymtab-parameter.exp: Don't expect unexpanded CU for

View File

@ -53,6 +53,8 @@ if {[prepare_for_testing "failed to prepare" $testfile \
return -1 return -1
} }
set readnow_p [readnow]
# The commands we test here produce many lines of output; disable "press # The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts. # <return> to continue" prompts.
gdb_test_no_output "set height 0" gdb_test_no_output "set height 0"
@ -96,7 +98,14 @@ gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
# holding "main" will already have been expanded, but if the # holding "main" will already have been expanded, but if the
# file is compiled with -fdebug-types-section then a second primary # file is compiled with -fdebug-types-section then a second primary
# symtab for break.c will be created for any types. # symtab for break.c will be created for any types.
pass "mt expand-symtabs" pass "$gdb_test_name"
}
-re "#compunits: ($decimal) \\(\[+\]0\\),.*$gdb_prompt $" {
if { $readnow_p } {
pass "$gdb_test_name"
} else {
fail "$gdb_test_name"
}
} }
} }
gdb_test "mt set per off" ".*" "mt set per off for expand-symtabs" gdb_test "mt set per off" ".*" "mt set per off for expand-symtabs"
@ -153,6 +162,8 @@ if { $index_cache_misses == 0 && $using_index_cache } {
set have_gdb_index 1 set have_gdb_index 1
} }
set have_psyms [expr ! ( $have_gdb_index || $readnow_p )]
# #
# this command does not produce any output # this command does not produce any output
# unless there is some problem with the symtabs and psymtabs # unless there is some problem with the symtabs and psymtabs
@ -250,12 +261,12 @@ proc maint_pass_if {val name} {
} }
maint_pass_if $header "maint print objfiles: header" maint_pass_if $header "maint print objfiles: header"
if { ! $have_gdb_index } { if { $have_psyms } {
maint_pass_if $psymtabs "maint print objfiles: psymtabs" maint_pass_if $psymtabs "maint print objfiles: psymtabs"
} }
maint_pass_if $symtabs "maint print objfiles: symtabs" maint_pass_if $symtabs "maint print objfiles: symtabs"
if { ! $have_gdb_index } { if { $have_psyms } {
set psymbols_output [standard_output_file psymbols_output] set psymbols_output [standard_output_file psymbols_output]
set psymbols_output_re [string_to_regexp $psymbols_output] set psymbols_output_re [string_to_regexp $psymbols_output]
set test_list [list \ set test_list [list \
@ -546,8 +557,12 @@ gdb_test "maint info line-table ${srcfile}" \
"symtab: \[^\n\r\]+${srcfile}.*INDEX.*LINE.*ADDRESS.*" \ "symtab: \[^\n\r\]+${srcfile}.*INDEX.*LINE.*ADDRESS.*" \
"maint info line-table with filename of current symtab" "maint info line-table with filename of current symtab"
if { ! $readnow_p } {
gdb_test_no_output "maint info line-table ${srcfile2}" \ gdb_test_no_output "maint info line-table ${srcfile2}" \
"maint info line-table with filename of symtab that is not currently expanded" [join \
"maint info line-table with filename of symtab that is not" \
" currently expanded"]
}
gdb_test_no_output "maint expand-symtabs" gdb_test_no_output "maint expand-symtabs"