Re: [PATCH] Extra error message from update_watchpoint

Andrew Burgess
2013-10-30T11:49:32Z

On 29/10/2013 5:38 PM, Andrew Burgess wrote:
> On 29/10/2013 5:19 PM, Eli Zaretskii wrote:
>>> Date: Tue, 29 Oct 2013 16:44:25 +0000
>>> From: "Andrew Burgess" <aburgess@broadcom.com>
>>> cc: "Pedro Alves" <palves@redhat.com>
>>>
>>> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
>>> index 608463d..68b348d 100644
>>> --- a/gdb/breakpoint.c
>>> +++ b/gdb/breakpoint.c
>>> @@ -1805,7 +1805,8 @@ update_watchpoint (struct watchpoint *b, int reparse)
>>> if (b->base.ops->works_in_software_mode (&b->base))
>>> b->base.type = bp_watchpoint;
>>> else
>>> - error (_("Software read/access watchpoints not supported."));
>>> + error (_("Hardware watchpoint support disabled. "
>>> + "See set/show can-use-hw-watchpoints."));
>>
>> Sorry for chiming in late, but IMO this change is a step backwards:
>> the new warning is much more puzzling than the old one. The old one
>> at least told what was the problem, the new one looks like entirely
>> unrelated (unless you are privy to GDB internals).

OK, here are a few alternatives, feel free to pick your favourites:

(1) The original:
error (_("Software read/access watchpoints not supported."));

(2) Pedro's original replacement:
error (_("Hardware watchpoint support disabled. "
"See set/show can-use-hw-watchpoints."));

(3) The original + why we can't use H/W watchpoints (bit long):
error (_("Software read/access watchpoints not supported, "
"re-enable hardware watchpoints using "
"\"set can-use-hw-watchpoints 1\""));

(4) Same, but with a newline to keep it under 80 chars, not sure if
multi-line errors are acceptable though.
error (_("Software read/access watchpoints not supported.\n"
"Enable hardware watchpoints using "
"\"set can-use-hw-watchpoints 1\""));

(5) Mention that H/W watchpoints are disabled, but not how to re-enable
them, though given the user has done the disabling this might be enough
to prompt them. This is single line, and just under 80 chars.
error (_("Software read/access watchpoints not supported, "
"hardware watchpoints disabled."));

My favourite is (5) at the moment, but I'll take whatever makes everyone
else happy :)

Cheers,
Andrew