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: [pushed 1/8] [gdb/testsuite] Fix untested message in gdb.tui/corefile-run.exp
Date: Mon, 13 Mar 2023 17:20:44 +0100	[thread overview]
Message-ID: <20230313162051.488-2-tdevries@suse.de> (raw)
In-Reply-To: <20230313162051.488-1-tdevries@suse.de>

In test-case gdb.tui/corefile-run.exp, we have this bit:
...
require !use_gdb_stub
if { [target_info gdb_protocol] == "extended-remote" } {
    untested "not supported"
    return
}
...

So with target board native-gdbserver we get:
...
UNSUPPORTED: gdb.tui/corefile-run.exp: require failed: !use_gdb_stub
...
and with target board native-extended-gdbserver instead:
...
UNTESTED: gdb.tui/corefile-run.exp: not supported
...

Fix this by:
- adding an optional argument target_description to proc
  target_can_use_run_cmd
- handling the target_description == core &&
  [target_info gdb_protocol] == "extended-remote" case in the proc
- using require {target_can_use_run_cmd core}
such that now in both cases we have:
...
UNSUPPORTED: gdb.tui/corefile-run.exp: require failed: \
  target_can_use_run_cmd core
...

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.tui/corefile-run.exp |  6 +-----
 gdb/testsuite/lib/gdb.exp              | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp
index 02606ee286d..2109a0ae3eb 100644
--- a/gdb/testsuite/gdb.tui/corefile-run.exp
+++ b/gdb/testsuite/gdb.tui/corefile-run.exp
@@ -29,11 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
 }
 
 # Only run on native boards.
-require !use_gdb_stub
-if { [target_info gdb_protocol] == "extended-remote" } {
-    untested "not supported"
-    return
-}
+require {target_can_use_run_cmd core}
 
 if { ![runto_main] } {
     return -1
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index e2b08c64eae..23277c4ab79 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -385,13 +385,33 @@ proc delete_breakpoints {} {
 
 # Returns true iff the target supports using the "run" command.
 
-proc target_can_use_run_cmd {} {
+proc target_can_use_run_cmd { {target_description ""} } {
+    if { $target_description == "" } {
+	set have_core 0
+    } elseif { $target_description == "core" } {
+	# We could try to figure this out by issuing an "info target" and
+	# checking for "Local core dump file:", but it would mean the proc
+	# would start requiring a current target. Also, uses while gdb
+	# produces non-standard output due to, say annotations would
+	# have to be moved around or eliminated, which would further limit
+	# usability.
+	set have_core 1
+    } else {
+	error "invalid argument: $target_description"
+    }
+
     if [target_info exists use_gdb_stub] {
 	# In this case, when we connect, the inferior is already
 	# running.
 	return 0
     }
 
+    if { $have_core && [target_info gdb_protocol] == "extended-remote" } {
+	# In this case, when we connect, the inferior is not running but
+	# cannot be made to run.
+	return 0
+    }
+
     # Assume yes.
     return 1
 }
-- 
2.35.3


  reply	other threads:[~2023-03-13 16:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 16:20 [pushed 0/8] [gdb/testsuite] Fix remote host issues in TUI tests Tom de Vries
2023-03-13 16:20 ` Tom de Vries [this message]
2023-03-13 16:20 ` [pushed 2/8] [gdb/testsuite] Handle USE_TUI in gdb.tui/corefile-run.exp Tom de Vries
2023-03-13 16:20 ` [pushed 3/8] [gdb/testsuite] Require ![is_remote host] for TUI Tom de Vries
2023-03-13 16:20 ` [pushed 4/8] [gdb/testsuite] Fix gdb.tui/tui-nl-filtered-output.exp for remote host Tom de Vries
2023-03-13 16:20 ` [pushed 5/8] [gdb/testsuite] Fix gdb.tui/tui-layout.exp " Tom de Vries
2023-03-13 16:20 ` [pushed 6/8] [gdb/testsuite] Fix gdb.tui/completion.exp for local-remote-host-notty Tom de Vries
2023-03-13 16:20 ` [pushed 7/8] [gdb/testsuite] Fix gdb.python/tui-window.exp for remote host Tom de Vries
2023-03-13 16:20 ` [pushed 8/8] [gdb/testsuite] Fix gdb.python/tui-window-factory.exp " Tom de Vries

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=20230313162051.488-2-tdevries@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).