Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Handle internal-error in gdb_unload
Date: Tue, 7 Sep 2021 10:21:17 +0200	[thread overview]
Message-ID: <b28ed132-8a19-b6c3-17f6-3ab1564ac079@suse.de> (raw)
In-Reply-To: <20210905063948.GA22464@delia>

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

[ was: Re: [PATCH][gdb/testsuite] Simplify
gdb.dwarf2/locexpr-data-member-location.exp ]

On 9/5/21 8:39 AM, Tom de Vries wrote:
> +# Avoid questions from the file command about:
> +# - Are you sure you want to change the file (y or n) ?
> +# - Discard symbol table from <file> (y or n) ?
> +gdb_test_no_output "set confirm off"
> +
> +# Tell internal-error how to behave, otherwise "set confirm off" will trigger
> +# generation of core file.
> +gdb_test_no_output "maint set internal-error quit no"
> +gdb_test_no_output "maint set internal-error corefile no"
> +
> +setup_kfail gdb/28030 *-*-*
> +gdb_test "file" "No executable file now\\." "Discard file"

I realized that we have gdb_unload for this, which handles the file
command questions.  But it's missing the internal-error handling.

I've fixed this in a separate patch.

Thanks,
- Tom

[-- Attachment #2: 0001-gdb-testsuite-Handle-internal-error-in-gdb_unload.patch --]
[-- Type: text/x-patch, Size: 1147 bytes --]

[gdb/testsuite] Handle internal-error in gdb_unload

When reverting commit 5a20fadc841 and using gdb_unload instead of runto "bar"
to trigger the internal-error in test-case
gdb.dwarf2/locexpr-data-member-location.exp, we run into:
...
ERROR: couldn't unload file in $gdb (timeout).
...
and the test-case takes about 1 minute.

Fix this by handling internal-error in gdb_unload, such that we have:
...
ERROR: Couldn't unload file in $gdb (GDB internal error).
ERROR: Could not resync from internal error (eof)
...
within 2 seconds.

Tested on x86_64-linux.

---
 gdb/testsuite/lib/gdb.exp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d99e8360808..ff19760bac4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -235,6 +235,11 @@ proc gdb_unload {} {
 	    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
+	}
 	timeout {
 	    perror "couldn't unload file in $GDB (timeout)."
 	    return -1

  parent reply	other threads:[~2021-09-07  8:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05  6:39 [PATCH][gdb/testsuite] Simplify gdb.dwarf2/locexpr-data-member-location.exp Tom de Vries via Gdb-patches
2021-09-06 15:48 ` [committed][gdb/testsuite] Handle eof in gdb_internal_error_resync Tom de Vries via Gdb-patches
2021-09-06 23:28 ` [committed][gdb/testsuite] Handle internal-error in gdb_run_cmd Tom de Vries via Gdb-patches
2021-09-07  8:21 ` Tom de Vries via Gdb-patches [this message]
2021-09-07  8:52 ` [PATCH][gdb/testsuite] Simplify gdb.dwarf2/locexpr-data-member-location.exp Tom de Vries via Gdb-patches
2021-09-08  0:34   ` Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b28ed132-8a19-b6c3-17f6-3ab1564ac079@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox