From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>,
Ciaran Woodward <ciaranwoodward@xmos.com>,
Tom Tromey <tom@tromey.com>
Subject: [PATCH v5 2/2] gdb: Improve warning when no native target is available
Date: Tue, 10 Mar 2026 11:23:24 -0300 [thread overview]
Message-ID: <20260310142323.2619350-4-guinevere@redhat.com> (raw)
In-Reply-To: <20260310142323.2619350-2-guinevere@redhat.com>
Currently, if a user attempts to debug a program without access to a
native debugger, the error message will just be:
Don't know how to <command>. try "help target"
This message is too generic, and doesn't help a user without internal
knowledge of GDB.
The present commit changes that message to be more informative for a
user who is unfamiliar with GDB and installed it in an unsupported
system, such as in a mac with M-series chips.
Reviewed-By: Ciaran Woodward <ciaranwoodward@xmos.com>
Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/inf-child.c | 7 ++++++-
gdb/target.c | 5 ++++-
gdb/testsuite/gdb.base/auto-connect-native-target.exp | 6 ++++--
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 7983ecb0d92..ae2cadc5e2b 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -42,7 +42,12 @@
static const target_info inf_child_target_info = {
"native",
N_("Native process"),
- N_("Native process (started by the \"run\" command).")
+ N_("Native process.\n\
+\n\
+This gives GDB the ability to control the execution of binaries in the\n\
+current CPU architecture. It is installed automatically when you attempt\n\
+to \"run\" or \"start\" a program, if the CPU architecure is supported by\n\
+GDB.")
};
const target_info &
diff --git a/gdb/target.c b/gdb/target.c
index 77a562aa919..6fc1872685f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2899,7 +2899,10 @@ find_default_run_target (const char *do_mesg)
return the_native_target;
if (do_mesg != NULL)
- error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
+ error (_("\
+No native target available, unable to %s. Try \"help target native\".\n\
+This may be because your CPU architecture is not supported, use\n\
+\"help set architecture\" for a list of supported architectures."), do_mesg);
return NULL;
}
diff --git a/gdb/testsuite/gdb.base/auto-connect-native-target.exp b/gdb/testsuite/gdb.base/auto-connect-native-target.exp
index 26434396cc6..65696f0167c 100644
--- a/gdb/testsuite/gdb.base/auto-connect-native-target.exp
+++ b/gdb/testsuite/gdb.base/auto-connect-native-target.exp
@@ -105,7 +105,8 @@ kill_program "kill"
gdb_test_no_output "set auto-connect-native-target off"
# Commands that rely on the native target auto-connecting should no longer work.
-gdb_test "start" "Don't know how to run.*" "start no longer works"
+gdb_test "start" "No native target available, unable to run.*" \
+ "start no longer works"
# Explicitly connect to the native target.
gdb_test "target native" \
@@ -181,7 +182,8 @@ with_test_prefix "disconnect" {
fail $test
}
- gdb_test "start" "Don't know how to run.*" "start no longer works"
+ gdb_test "start" "No native target available, unable to run.*" \
+ "start no longer works"
}
# Reenable auto-connecting to the native target. Plain "start" should
--
2.53.0
next prev parent reply other threads:[~2026-03-10 14:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 14:23 [PATCH v5 0/2] Add warning if the native target is not supported Guinevere Larsen
2026-03-10 14:23 ` [PATCH v5 1/2] gdb: improve help text for set commands with limited options Guinevere Larsen
2026-03-17 13:58 ` Andrew Burgess
2026-04-16 18:17 ` Guinevere Larsen
2026-03-10 14:23 ` Guinevere Larsen [this message]
2026-03-17 11:29 ` [PATCH v5 2/2] gdb: Improve warning when no native target is available Andrew Burgess
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=20260310142323.2619350-4-guinevere@redhat.com \
--to=guinevere@redhat.com \
--cc=ciaranwoodward@xmos.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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