Avoid FAILs in gdb.compile

Many gdb.compile C++ tests fail for me on Fedora 36.  I think these
are largely bugs in the plugin, though I didn't investigate too
deeply.  Once one failure is seen, this often cascades and sometimes
there are many timeouts.

For example, this can happen:

    (gdb) compile code var = a->get_var ()
    warning: Could not find symbol "_ZZ9_gdb_exprP10__gdb_regsE1a" for compiled module "/tmp/gdbobj-0xdI6U/out2.o".
    1 symbols were missing, cannot continue.

I think this is probably a plugin bug because, IIRC, in theory these
symbols should be exempt from a lookup via gdb.

This patch arranges to catch any catastrophic failure and then simply
exit the entire .exp file.
This commit is contained in:
Tom Tromey
2023-01-19 14:01:27 -07:00
parent 300fa060ab
commit cdeb7b7de2
2 changed files with 55 additions and 8 deletions

View File

@ -113,7 +113,7 @@ gdb_test "compile code *(volatile int *) 0 = 0;" \
"The program being debugged was signaled while in a function called from GDB\\.\r\nGDB remains in the frame where the signal was received\\.\r\n.*" \
"compile code segfault first"
gdb_test "bt" \
"\r\n#0 \[^\r\n\]* in _gdb_expr \[^\r\n\]*\r\n#1 <function called from gdb>\r\n.*"
"\r\n#0 \[^\r\n\]*_gdb_expr \[^\r\n\]*\r\n#1 <function called from gdb>.*"
set test "p/x \$pc"
set infcall_pc 0
@ -242,7 +242,9 @@ gdb_test "print globalvar" " = 20" "print unresolved value"
gdb_test_no_output "compile code globalshadow += 1;"
gdb_test "print globalshadow" " = 101"
setup_kfail {no bug filed} *-*-*
gdb_test_no_output "compile code extern int globalshadow; globalshadow += 5;"
setup_kfail {fails due to previous test} *-*-*
gdb_test "print 'compile-cplus.c'::globalshadow" " = 15"
gdb_test "print globalshadow" " = 101" "print globalshadow second time"
gdb_test_no_output "compile code staticshadow += 2;"