Re: [PATCH 2/2] gdb: add warning when no native target is available

Guinevere Larsen
2025-11-27T20:17:17Z

On 11/7/25 11:21 AM, Eli Zaretskii wrote:
>> Date: Fri, 7 Nov 2025 10:24:15 -0300
>> Cc: gdb-patches@sourceware.org
>> From: Guinevere Larsen <guinevere@redhat.com>
>>
>> On 11/7/25 4:48 AM, Eli Zaretskii wrote:
>>>> From: Guinevere Larsen <guinevere@redhat.com>
>>>> Cc: Guinevere Larsen <guinevere@redhat.com>
>>>> Date: Thu, 6 Nov 2025 16:45:14 -0300
>>>>
>>>> + 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 (), "info architecture"));
>>> Would we also say "Native debugging is supported" in the opposite
>>> case?
>>>
>>> Thanks.
>>>
>> When you debug an inferior without connecting to a gdbserver, you are
>> doing native debugging, but I don't think it makes sense to warn the
>> user that native debugging is supported since that is the default
>> behavior of GDB, if that is what  you mean with this email.
> Then perhaps I don't understand the purpose of the patch. I thought
> it was part of showing the information about GDB at the start of a
> session. In that case, I think it's good to let user know that this
> GDB supports native debugging, and also tell them if it doesn't.
> Apologies if I misunderstood.
>
The purpose of this patch is to make the user aware that GDB will not
work as they likely expect.

Most of the GDB usage and explanations that I've seen so far barely
mention gdbserver, and basically never mention debugging a different
architecture, so if a user just fires up GDB and it isn't able to debug
anything natively, that will be highly unexpected, hence emitting a warning.

--
Cheers,
Guinevere Larsen
It/she