From f955cf6a1a30d19f5e2e4859d32483e1940ac864 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 14 Oct 2025 11:34:51 +0200 Subject: [PATCH] [gdb/testsuite] Fix ERROR in gdb.tui/corefile-run.exp 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 rungdb/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 | 58 +++++++++++++++++++------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp index 657fc83ee92..03775be955a 100644 --- a/gdb/testsuite/gdb.tui/corefile-run.exp +++ b/gdb/testsuite/gdb.tui/corefile-run.exp @@ -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 +} -- 2.47.3