diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-11-21 09:30:55 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-11-29 11:43:54 -0500 |
commit | f432d5ef2b955b2f8f1f7c1de727b9e43b846976 (patch) | |
tree | 694613379ada9bf67374265fa6f741d2e92bc0b4 /gdb/testsuite/lib | |
parent | d56614a9925791b15d7052eb4c798ab24a724611 (diff) | |
download | gdb-f432d5ef2b955b2f8f1f7c1de727b9e43b846976.zip gdb-f432d5ef2b955b2f8f1f7c1de727b9e43b846976.tar.gz gdb-f432d5ef2b955b2f8f1f7c1de727b9e43b846976.tar.bz2 |
gdb/testsuite: make gdb_unload use gdb_test_multiple
In the failure seen by Philippe here:
https://inbox.sourceware.org/gdb-patches/20221120173024.3647464-1-philippe.waroquiers@skynet.be/
gdb_unload crashed GDB, leaving no trace in the test results. Change it
to use gdb_test_multiple, so that it leaves an UNRESOLVED result. I
think it is good practice anyway.
Make it return the result of gdb_test_multiple directly, change
gdb.python/py-objfile.exp accordingly.
Change gdb.base/endian.exp as well to avoid duplicate test names.
Change gdb.base/gnu-debugdata.exp to avoid recording a test result,
since gdb_unload does it already now.
Change-Id: I59a1e4947691330797e6ce23277942547c437a48
Approved-By: Tom de Vries <tdevries@suse.de>
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e193a20..23e3cc0 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -311,38 +311,32 @@ proc gdb_version { } { return [default_gdb_version] } -# # gdb_unload -- unload a file if one is loaded -# Return 0 on success, -1 on error. # +# Returns the same as gdb_test_multiple. -proc gdb_unload {} { +proc gdb_unload { {msg "file"} } { global GDB global gdb_prompt - send_gdb "file\n" - gdb_expect 60 { - -re "No executable file now\[^\r\n\]*\[\r\n\]" { exp_continue } - -re "No symbol file now\[^\r\n\]*\[\r\n\]" { exp_continue } - -re "A program is being debugged already.*Are you sure you want to change the file.*y or n. $" { + return [gdb_test_multiple "file" $msg { + -re "A program is being debugged already.\r\nAre you sure you want to change the file. .y or n. $" { send_gdb "y\n" answer exp_continue } - -re "Discard symbol table from .*y or n.*$" { - send_gdb "y\n" answer + + -re "No executable file now\\.\r\n" { exp_continue } - -re "$gdb_prompt $" {} - -re "A problem internal to GDB has been detected" { - perror "Couldn't unload file in $GDB (GDB internal error)." - gdb_internal_error_resync - return -1 + + -re "Discard symbol table from `.*'. .y or n. $" { + send_gdb "y\n" answer + exp_continue } - timeout { - perror "couldn't unload file in $GDB (timeout)." - return -1 + + -re -wrap "No symbol file now\\." { + pass $gdb_test_name } - } - return 0 + }] } # Many of the tests depend on setting breakpoints at various places and |