Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH v2 2/2] gdb: add warning when no native target is available
Date: Fri,  9 Jan 2026 08:56:21 -0300	[thread overview]
Message-ID: <20260109115621.26003-3-guinevere@redhat.com> (raw)
In-Reply-To: <20260109115621.26003-1-guinevere@redhat.com>

When a user starts GDB, they have no way of knowing if native debugging
will be supported or not.  This is most relevant for Mac users, since
GDB hasn't been ported to Apple's CPUs yet.

This patch adds a warning if, after initializing all files, GDB was
unable to find an appropriate native target for the session, informing
the user that they will only be able to debug remotely.
---
 gdb/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/main.c b/gdb/main.c
index 296f59b0b57..132a2eb2048 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1210,6 +1210,11 @@ captured_main_1 (struct captured_main_args *context)
   tmp_warn_preprint.reset ();
   warning_pre_print = "\n";
 
+  if (get_native_target () == nullptr)
+    warning (_("No native target, only remote debugging is supported.\n"
+	       "Use \"%ps\" to check which architectures are supported."),
+	    styled_string (command_style.style (), "help set architecture"));
+
   /* Read and execute the system-wide gdbinit file, if it exists.
      This is done *before* all the command line arguments are
      processed; it sets global parameters, which are independent of
-- 
2.52.0


  parent reply	other threads:[~2026-01-09 11:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 11:56 [PATCH v2 0/2] Add warning if the native target is not supported Guinevere Larsen
2026-01-09 11:56 ` [PATCH v2 1/2] gdb: improve help text for set commands with limited options Guinevere Larsen
2026-01-12 15:35   ` Andrew Burgess
2026-01-09 11:56 ` Guinevere Larsen [this message]
2026-01-09 12:36   ` [PATCH v2 2/2] gdb: add warning when no native target is available Ciaran Woodward
2026-01-09 13:40     ` Guinevere Larsen
2026-01-09 14:16       ` Ciaran Woodward
2026-01-09 14:26         ` Guinevere Larsen
2026-01-09 16:53           ` Ciaran Woodward
2026-01-12 15:33           ` Andrew Burgess
2026-01-13 18:23             ` Guinevere Larsen

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=20260109115621.26003-3-guinevere@redhat.com \
    --to=guinevere@redhat.com \
    --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