Re: [RFAv2] Show locno for 'multi location' breakpoint hit msg+conv var $bkptno $locno.

Eli Zaretskii via Gdb-patches
2022-06-05T17:11:40Z

> Date: Sun, 5 Jun 2022 18:57:59 +0200
> From: Philippe Waroquiers via Gdb-patches <gdb-patches@sourceware.org>
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 960f90b4387..88671a1c86d 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -34,6 +34,20 @@
> whitespace from each line before using the string as the help
> output.
>
> +* When a breakpoint with multiple locations is hit, GDB now also prints the location

Please make the lines here shorter, so that they fit on a 80-column
screen.

Also, can we please use the terminology defined by a recent Pedro's
patch, i.e. use "code locations", not just "locations"?

> +* When a breakpoint is hit, GDB now sets the convenience variables $bkpno and
> + $locno to the hit breakpoint number and location number. ^^^^^^

That's a typo, right?

> + This allows to disable the last hit breakpoint using for example
> + (gdb) disable $bkptno
> + or
> + (gdb) disable $bkptno.$locno

The two alternatives above are not equivalent, right? The text could
be interpreted to mean they do the same.

> + ** The 'breakpoint-hit' stopped reason async record now contains an optional field

Suggest to reword:

The async record stating the stopped reason 'breakpoint-hit' now
contains ...

> +@vindex $bkptno@r{, convenience variable}
> +@vindex $locno@r{, convenience variable}
> +When your program stops on a breakpoint, the convenience variables
> +@samp{$bkptno} and @samp{$locno} are respectively set to the number of
> +the encountered breakpoint and the number of the breakpoint location:
^^^^^^^^^^^^^^^^^^^
"breakpoint's code location"

> +If the encountered breakpoint has only one location, @samp{$locno} is set to 1:
^^^^^^^^
"code location"

> +These variables can typically be used in a breakpoint command list.
> +(@pxref{Break Commands, ,Breakpoint Command Lists}). For example, as
> +part of the breakpoint command list, you can disable completely the
> +encountered breakpoint using @samp{disable $bkptno} or disable the
> +specific encountered breakpoint location using @samp{disable
> +$bkptno.$locno}.

So how does $bkptno differ from $bpnum?

> +Inside a command list, you can use the command
> +@smallexample
> +disable $bkptno
> +@end smallexample
> +to disable the encountered breakpoint.

I'd say use @kbd{..} here instead of @smallexample, and include the
command inline in the text.

> +If your breakpoint has several locations, the command
> +@smallexample
> +disable $bkptno.$locno
> +@end smallexample
> +will disable the specific breakpoint location encountered.

Likewise here.

> +For a @samp{breakpoint-hit} stopped reason, when the breakpoint
> +encountered has multiple locations, the field @samp{bkptno} is
> +followed by the field @samp{locno}.

This is a backward-incompatible change, no? Does it require bumping
the version of the MI protocol?

Thanks.