From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wdlsMAw2AmrSqzAAWB0awg (envelope-from ) for ; Mon, 11 May 2026 16:03:24 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i/op4psy; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C17F41E0C3; Mon, 11 May 2026 16:03:24 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 174AD1E067 for ; Mon, 11 May 2026 16:03:24 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A4CDE4BB58A0 for ; Mon, 11 May 2026 20:03:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4CDE4BB58A0 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i/op4psy Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 189764BB58A8 for ; Mon, 11 May 2026 20:02:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 189764BB58A8 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 189764BB58A8 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778529763; cv=none; b=q6hB/cnRA0H8jcSyHYJII9QxCCePMsQH6WYd3tfECBq0kmahzHKJcLGD7sGUMYOKJ97+daUZ2GF+PO71FaOcN5Z00lUd0EKNH0r7ElC3tL/UcwiXmkUzyZpZ9WbsMxOi8w5dmGn44Jenv3cEOn5imLSm1+OQjDYHB9zfuXa/Gb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778529763; c=relaxed/simple; bh=6ZFQh9jSxQ09woJZTN3V8CL5pT4UTX1QXwpBY0/BW8I=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ti8HFQ71h6zsf0pqZqn1PWFnaAQlg5vOLoo+NoNuUMIHqKAhidPhCADR8VTO1O/hQvFY1llD7dTuHQADqg/D+mAmVD0QGWqkr9ereda27iZulvo2U5P61NHT3L2Y44D4t6cwFaaJwgnKYrE7MWESX+Z+iTUV8fPXDC/ykXLMqw0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i/op4psy DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 189764BB58A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778529762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JrckbISh8/X2o2Nj1SrgGlEN4O3o7zsqsYBDVQ2VJ+0=; b=i/op4psyc4zoD/Am9cI37MDsyirTq+p9zsTnZrho30o1NLwJCVAi4eY8M7Ne1ajcMCSgJt 4XOuW/nwCfPtMu2ks/9hX5+++bWWdbDP9FzcTxfou1pyfdEWmbiqLnShgIhQ6H1ukiB4/p Jio9kgrhNJTF9RKc7udxe6M8TfFv5zI= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-Tin5zMX2Nq2wzC_PR9knWQ-1; Mon, 11 May 2026 16:02:35 -0400 X-MC-Unique: Tin5zMX2Nq2wzC_PR9knWQ-1 X-Mimecast-MFC-AGG-ID: Tin5zMX2Nq2wzC_PR9knWQ_1778529753 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48BDD1800344; Mon, 11 May 2026 20:02:33 +0000 (UTC) Received: from fedora.tailb97d54.ts.net (unknown [10.96.134.67]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0CD3B19560A6; Mon, 11 May 2026 20:02:30 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Ciaran Woodward , Tom Tromey Subject: [PATCH v6 2/2] gdb: Improve warning when no native target is available Date: Mon, 11 May 2026 17:01:26 -0300 Message-ID: <20260511200126.75554-3-guinevere@redhat.com> In-Reply-To: <20260511200126.75554-1-guinevere@redhat.com> References: <20260511200126.75554-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 9ZG5llr5CsxipXYLkO-PXq4Qh-nQ4VtlKMMZzo788SU_1778529753 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 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 . 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. The new error now reads: No native target available, unable to . Try "help target native". This may be because your CPU architecture is not supported, use "help set architecture" for a list of supported architectures. Reviewed-By: Ciaran Woodward Approved-By: Tom Tromey --- gdb/inf-child.c | 7 ++++++- gdb/target.c | 10 +++++++--- gdb/testsuite/gdb.base/auto-connect-native-target.exp | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gdb/inf-child.c b/gdb/inf-child.c index a87aa925133..cbe5fecb78f 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. Controls native processes in this computer.\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 and there is no other target capable of executing those commands.") }; const target_info & diff --git a/gdb/target.c b/gdb/target.c index 5d937f3ae85..e08de38e0ea 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2907,9 +2907,13 @@ find_default_run_target (const char *do_mesg) return the_native_target; if (do_mesg != NULL) - error (_("Don't know how to %s. Try \"%ps\"."), - do_mesg, - styled_string (command_style.style (), "help target")); + error (_("\ +No native target available, unable to %s. Try \"%ps\".\n\ +This may be because your CPU architecture is not supported, use\n\ +\"%ps\" for a list of supported architectures."), + do_mesg, + styled_string (command_style.style (), "help target native"), + styled_string (command_style.style (), "help set architecture")); 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.54.0