[PATCH] Fix missing operator % on xmethod matcher output

Simon Marchi simon.marchi@polymtl.ca
Mon Nov 11 13:49:50 GMT 2024



On 2024-11-11 03:07, Pedro Silva wrote:
> Fixed missing operator % on xmethod matcher registration output and, as
> suggested on bug 32532, converted both uses of operator % to str.format.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32352

The patch is small enough to accept without a copyright assignment, so I
went ahead and pushed it, with the following changes:

> ---
>  gdb/python/lib/gdb/xmethod.py | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/python/lib/gdb/xmethod.py b/gdb/python/lib/gdb/xmethod.py
> index c98402d271f..da7c96aaef0 100644
> --- a/gdb/python/lib/gdb/xmethod.py
> +++ b/gdb/python/lib/gdb/xmethod.py
> @@ -267,8 +267,11 @@ def register_xmethod_matcher(locus, matcher, replace=False):
>          else:
>              raise RuntimeError(
>                  "Xmethod matcher already registered with "
> -                "%s: %s" % (locus_name, matcher.name)
> +                "{:s}: {:s}".format(locus_name, matcher.name)
>              )
>      if gdb.parameter("verbose"):
> -        gdb.write("Registering xmethod matcher '%s' with %s' ...\n")
> +        gdb.write(
> +            "Registering xmethod matcher "
> +            "'{:s}' with '{:s}' ...\n".format(locus_name, matcher.name)
> +        )
>      locus.xmethods.insert(0, matcher)

I changed the {:s} to just {}, and un-split the strings.

Thanks!

Simon


More information about the Gdb-patches mailing list