public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Handle internal-error in gdb_run_cmd
Date: Tue, 7 Sep 2021 01:28:16 +0200	[thread overview]
Message-ID: <1e8a9ce0-649e-3fd4-fe13-29596583fc9a@suse.de> (raw)
In-Reply-To: <20210905063948.GA22464@delia>

[-- Attachment #1: Type: text/plain, Size: 312 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:
> The test-case gdb.dwarf2/locexpr-data-member-location.exp currently fails like
> this:
> ...
> ...
> and takes 1 minute to run.

I've fixed this in a separate patch.

Thanks,
- Tom

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

[gdb/testsuite] Handle internal-error in gdb_run_cmd

When reverting commit 5a20fadc841 the test-case
gdb.dwarf2/locexpr-data-member-location.exp fails like this:
...
FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \
  (GDB internal error)
ERROR: Could not resync from internal error (eof)
...
and takes 1 minute to run.

The long running time is caused by running into a timeout in gdb_run_cmd, at
this point:
...
(gdb) run ^M
The program being debugged has been started already.^M
Start it from the beginning? (y or n) y^M
/home/vries/gdb_versions/devel/src/gdb/gdbtypes.c:5583: internal-error: \
  Unexpected type field location kind: 4^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n)
...

Fix this by detecting the internal-error in gdb_run_cmd.  We don't handle it
in gdb_run_cmd, but stash the gdb output back into the buffer using
-notransfer, and let the caller proc runto deal with it.

After the fix, the test-case just takes 2 seconds.

Tested on x86_64-linux.

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

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index cdda51529fb..d99e8360808 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -408,6 +408,9 @@ proc gdb_run_cmd { {inferior_args {}} } {
 	-notransfer -re "$gdb_prompt $" {
 	    # There is no more input expected.
 	}
+	-notransfer -re "A problem internal to GDB has been detected" {
+	    # Let caller handle this.
+	}
     }
 
     return 0

  parent reply	other threads:[~2021-09-06 23:28 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
2021-09-06 15:48 ` [committed][gdb/testsuite] Handle eof in gdb_internal_error_resync Tom de Vries
2021-09-06 23:28 ` Tom de Vries [this message]
2021-09-07  8:21 ` [committed][gdb/testsuite] Handle internal-error in gdb_unload Tom de Vries
2021-09-07  8:52 ` [PATCH][gdb/testsuite] Simplify gdb.dwarf2/locexpr-data-member-location.exp Tom de Vries
2021-09-08  0:34   ` Simon Marchi

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=1e8a9ce0-649e-3fd4-fe13-29596583fc9a@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).