From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qTBNAFM7uWmhWS0AWB0awg (envelope-from ) for ; Tue, 17 Mar 2026 07:30:27 -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=Tgr8e1hp; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D89BC1E04F; Tue, 17 Mar 2026 07:30:26 -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_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 1DB7C1E04F for ; Tue, 17 Mar 2026 07:30:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id A4BB34BB3BEF for ; Tue, 17 Mar 2026 11:30:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4BB34BB3BEF 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=Tgr8e1hp Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 8847E4BB3BBA for ; Tue, 17 Mar 2026 11:29:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8847E4BB3BBA 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 8847E4BB3BBA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773746996; cv=none; b=EwOXqhnF2/ECqT6af8mA0rLOzg3cK9iWfsonqAcL3ywmElJRFZcLMZvqdCFRaFqKXLW6XYFOQme1aGa0hbT1dCZFE2kGteA9Hsvd5KUABrepj3FQ5gT/gCzPoLGyVpZnFW6PLAm/BsAmvEjklPm0KprRKjzaO29VVRDgeI8Xaik= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773746996; c=relaxed/simple; bh=eR8FJNh1xrlrRj6GaKc564gaXReh/SLuyQ8lTpLoggc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JAW1RsNLOTdmfhRa7DUPSHhTjqCxxy7b8X7rV8kXk6FozhQ2DLnI//WaYO5UqP/IkZP29BTNagOANReSRuVthF5g36mJ6ZB0REhdJi970qJKBl+UC2Ln4E/0qBc0M5z1cteorpW/Tiik8wKnA6szHH9os+sQ6JubBw8l7uCNQOQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8847E4BB3BBA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773746996; 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: in-reply-to:in-reply-to:references:references; bh=qetzjuZ/AvVl1J2GpSHfWPc/Y6JCMZHdXvrKlAAIBbQ=; b=Tgr8e1hpZCxoiISrFoa0EnqTtZLuTGJn+fPQ180Zeu0qChf07g5WnjZMyVgOxVhaPdU+0k aM9F/zhXUOI1pItx0cAwDjpFdA5DaXiRczse627NkfCuxXxRh/18Qix2vm6x0WpeRO9hYh sxvQwmRDWqEWBdVjSuvA4mnH82nT3Po= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-570-hvkrTqlDPzqxj5oIQyknkg-1; Tue, 17 Mar 2026 07:29:55 -0400 X-MC-Unique: hvkrTqlDPzqxj5oIQyknkg-1 X-Mimecast-MFC-AGG-ID: hvkrTqlDPzqxj5oIQyknkg_1773746994 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-43b46b2b161so1926331f8f.0 for ; Tue, 17 Mar 2026 04:29:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773746994; x=1774351794; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qetzjuZ/AvVl1J2GpSHfWPc/Y6JCMZHdXvrKlAAIBbQ=; b=e0doGu3MDDZ+4a0aA5FZ7XEUL0UlAha/LuzevktKkE66kwX4T+iS6dO49LREhTY8vL aot9KqWpLxQ0b9H97yqi3/mT/MJZoBUN+WIhBZU+FMXG6hkmbNTKX8KqqAwThGuDaZt3 JkNdOabq2VDFgk14IUOM1FZ/YaXS2xSLDY8k/TwibavpizsdfSr4/A7iBwMsPGKHi1CE DcCDQa1JmbnZDr02QDF3P3XypLkX7Ocwd1/rY3jvdhp1zj/OeXLw8e450E00G5aQuLpg WAiqYGJfLNtAQ+yuZfwH+LW2VfXgndTVl0v5MRq1Mos68QBaqeZGnDjmmV3H8Is32qbd BMrQ== X-Forwarded-Encrypted: i=1; AJvYcCVXteKR78a333oS3x0N36AZ2cjntX7jA/cFEG4xv4emp6iy31bESWL1labTUXuKuw6EPwqvSzl2Ta5Vzw==@sourceware.org X-Gm-Message-State: AOJu0Yx69iBcFY5/gaAQATtpcHRGt7xOtlGkec0vErg/FtqB0KVCfc1v 2Y/ozHP4BssicD0Oy2HAK+dK/dFD/UpOB+qEyxAwwgOCVzbVBsag0D2wEtm8dvOUtwM6ih+8NXD Iswj1F03Jlj80ObAck6I+18xkbWoynIdhzA+UMl3BOleWnWMNQhq2bpNdbE4cglGJ/VHbwM4= X-Gm-Gg: ATEYQzxFSyIWF5rrho0u4CYqQP8fhJHqNnx5fPw8xiNl+58tYUBgCRn0tykbFgGc8xQ w3V8phXKINoMQogzheyo2ZWkW8FN2R66ui7yj8qHRkgIP0+uqKYwUn1PJ4W0j+M63tIhgtreFya HbKxXfkP+y3b65q+2MmJrnEpvWl35FciUMYJfmJ0/N2pzOLqSYGcnBS6tx4rNZJm32fPXfI1THi xvMkayKWzL0R9Mw6AYOW0kI3c8WE4sxVRnEFtRIRXdgGZVxHhzxw7NpC18iWqd+3Vm/rt1sKkrU ArO0/Kvy1wpAydbrLlMFqfy/kDuWkwIgz86e3zhaiheRuTyQ5oogqYCi4RZfCS6b/qt1O0eeZuB wnXnGLbP/psEpVwDk X-Received: by 2002:a05:600c:4f8f:b0:485:40c6:f507 with SMTP id 5b1f17b1804b1-48556711c6cmr301281305e9.30.1773746993522; Tue, 17 Mar 2026 04:29:53 -0700 (PDT) X-Received: by 2002:a05:600c:4f8f:b0:485:40c6:f507 with SMTP id 5b1f17b1804b1-48556711c6cmr301280765e9.30.1773746992950; Tue, 17 Mar 2026 04:29:52 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48557c6e2b1sm111491535e9.28.2026.03.17.04.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 04:29:52 -0700 (PDT) From: Andrew Burgess To: Guinevere Larsen , gdb-patches@sourceware.org Cc: Guinevere Larsen , Ciaran Woodward , Tom Tromey Subject: Re: [PATCH v5 2/2] gdb: Improve warning when no native target is available In-Reply-To: <20260310142323.2619350-4-guinevere@redhat.com> References: <20260310142323.2619350-2-guinevere@redhat.com> <20260310142323.2619350-4-guinevere@redhat.com> Date: Tue, 17 Mar 2026 11:29:51 +0000 Message-ID: <87ecli7ky8.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4JPWJCae1308s4b15BnJmnttXVm-9_mmGILpRnSpnPs_1773746994 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 I see you already go an approval for this patch, so take all of the below with a huge pinch of salt. I really don't want to spend forever painting the bike shed. Given the niche that this patch is addressing I don't really care if it goes in or not. That said... Guinevere Larsen writes: > 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" I think you must have written this by hand, it would actually 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. Disagree with this assessment. I don't see what internal knowledge is required to grok this error message. I'd rewrite the second sentence so we had: Don't know how to . Use "help target" for more details. Or some such. But this is clear, and gives guidance on what to do next to resolve the issue (run the help command). > 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. When making a change like this I usually include my improved output in the commit message. > > Reviewed-By: Ciaran Woodward > Approved-By: Tom Tromey > --- > 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.") The second sentence isn't totally correct here. At least, if I understand things correctly. The native target is automatically selected when the user tries to start an inferior that has no other target selected. Using 'target remote ...' is going to prevent 'run' or 'start' from working as that target doesn't support these commands. Or 'target extended-remote' or 'target sim' that do support 'run' and 'start' are going to service these commands themselves. Maybe this is all being too picky, but this text isn't part of an error message that needs to be kept short. This is the "help target native" text, so I'm inclined to think that we should favour correctness over simplicity. Also, by reducing the first line of the help from "Native process (started by the \"run\" command)." to just "Native process." this reduces what is show for 'help target'. I agree with the idea of dropping the mention of 'run' here, but what about something like "Control native processes of this computer."? I worried about the work "computer" here, my first instinct was to write "host", but I worried that might not be super clear. > }; > > 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); If you rebuild GDB without a native target then 'help target native' will print: (gdb) help target native Undefined target command: "native". Try "help target". Which I guess does redirect the user, but isn't ideal. You probably need to stick to suggesting 'help target' here. I feel like I might have said this on an earlier revision of the patch, but I guess it wasn't the direction you wanted to go. I'll say it again anyway, because every time I look at this patch I have the exact same though: I think the original error message is fine, it's short and to the point. I think that improving the help text for _both_ 'help target' and 'help target native' would be a better solution to the problem you have. If a user sees this error and _doesn't_ immediately try 'help target' then I have very limited sympathy for their confusion, assuming of course, that 'help target' actually explains what they need to know. Which is probably doesn't right now. Another thought that this change inspires, but definitely not something for you to do here is this: I've long thought we should make our error objects better, allowing for two strings to be carried around. A single line ( < 80 characters ) short summary of the error. Then an optional, multi-line help text style description of the error and how it could be resolved. Obviously not every (or many) errors will actually need the second string, but errors like this, that are triggered directly, or almost directly, from user input, often benefit from an extended, "this is what you did wrong, and this is how you should fix it" text. The problem this solves (I think) is that multi-line error messages just don't format that well. But this is a future problem I think. Thanks, Andrew > 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