]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix ERROR in gdb.tui/corefile-run.exp
authorTom de Vries <tdevries@suse.de>
Tue, 14 Oct 2025 09:34:51 +0000 (11:34 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 14 Oct 2025 09:34:51 +0000 (11:34 +0200)
When running test-case gdb.tui/corefile-run.exp on x86_64-freebsd, we run into
PR tdep/33176:
...
PASS: gdb.tui/corefile-run.exp: load corefile
run<SNIP>gdb/fbsd-nat.c:1381: internal-error: wait_1: \
  Assertion `fbsd_inf != nullptr || pl.pl_flags & PL_FLAG_CHILD' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
ERROR: FIXME scroll
...

Skip the ERROR by:
- running the test-case twice, once with CLI and once with TUI, and
- only running the TUI variant if the CLI one succeeds.

While we're at it, add a KFAIL for the PR.

Tested on x86_64-freebsd and x86_64-linux.

gdb/testsuite/gdb.tui/corefile-run.exp

index 657fc83ee92156149c034b6b193ecc719bec2df8..03775be955af29e6d9408f5a50ab9b1a81782ed0 100644 (file)
@@ -48,26 +48,52 @@ set src_line_nr [gdb_get_line_number $src_line]
 set run_re \
     "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\]"
 
-if { [info exists USE_TUI] && $USE_TUI == 0 } {
+with_test_prefix cli {
+    set re_kfail \
+       "[string_to_regexp fbsd-nat.c]:$decimal: internal-error: wait_1: "
+    set re_quit [string_to_regexp "Quit this debugging session? (y or n) "]
+    set re_core_file [string_to_regexp "Create a core file of GDB? (y or n) "]
     clean_restart $testfile
     gdb_test "core-file $core" $src_line "load corefile"
-    gdb_test "run" $run_re "run until the end"
-    return
+    set ok 0
+    gdb_test_multiple "run" "run until the end" {
+       -early -re $re_kfail {
+           kfail tdep/33176 $gdb_test_name
+           # Get back gdb prompt.
+           gdb_expect {
+               -re ($re_quit|$re_core_file) {
+                   send_gdb "n\n"
+                   exp_continue
+               }
+               -re "$gdb_prompt " {
+               }
+           }
+       }
+       -re -wrap $run_re {
+           set ok 1
+           pass $gdb_test_name
+       }
+    }
+    if {!$ok} {
+       return
+    }
 }
 
-Term::clean_restart 24 80 $testfile
-if {![Term::enter_tui]} {
-    unsupported "TUI not supported"
-    return
-}
+with_test_prefix tui {
+    Term::clean_restart 24 80 $testfile
+    if {![Term::enter_tui]} {
+       unsupported "TUI not supported"
+       return
+    }
 
-set text [Term::get_all_lines]
-gdb_assert {![string match "No Source Available" $text]} \
-    "initial source listing"
+    set text [Term::get_all_lines]
+    gdb_assert {![string match "No Source Available" $text]} \
+       "initial source listing"
 
-send_gdb "core-file $core\n"
-Term::wait_for "Program terminated"
-Term::check_contents "load corefile" "$src_line_nr *$src_line.*$gdb_prompt .*"
+    send_gdb "core-file $core\n"
+    Term::wait_for "Program terminated"
+    Term::check_contents "load corefile" "$src_line_nr *$src_line.*$gdb_prompt .*"
 
-Term::command "run"
-Term::check_contents "run until the end" $run_re
+    Term::command "run"
+    Term::check_contents "run until the end" $run_re
+}