+2020-02-19 Tom de Vries <tdevries@suse.de>
+
+ * gdb.base/corefile-buildid.exp (check_exec_file): Match info files
+ output line-by-line.
+
2020-02-19 Tom de Vries <tdevries@suse.de>
* gdb.cp/cpexprs.exp: Remove c++/14186 kfail.
# FILE.
proc check_exec_file {file} {
+ global gdb_prompt
send_log "expecting exec file \"$file\"\n"
- gdb_test "info files" "Local exec file:\[\r\n\t\ \]+`[string_to_regexp $file]'.*"
+
+ # Get line with "Local exec file:".
+ set ok 0
+ gdb_test_multiple "info files" "" {
+ -re "^Local exec file:\r\n" {
+ set test_name $gdb_test_name
+ set ok 1
+ }
+ -re "^$gdb_prompt $" {
+ fail $gdb_test_name
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
+
+ if { $ok == 0 } {
+ return
+ }
+
+ # Get subsequent line with $file.
+ set ok 0
+ gdb_test_multiple "" $test_name {
+ -re "^\[\t\ \]+`[string_to_regexp $file]'\[^\r\n\]*\r\n" {
+ set ok 1
+ }
+ -re "^$gdb_prompt $" {
+ fail $gdb_test_name
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
+
+ if { $ok == 0 } {
+ return
+ }
+
+ # Skip till prompt.
+ gdb_test_multiple "" $test_name {
+ -re "^$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+ -re "^\[^\r\n\]*\r\n" {
+ exp_continue
+ }
+ }
}
# Test whether gdb can find an exec file from a core file's build-id.