[PATCH] Fix regression in Ada do_full_match

Joel Brobecker brobecker@adacore.com
Thu Jan 7 01:57:27 GMT 2021


Hi Tom,

> gdb/ChangeLog
> 2021-01-06  Tom Tromey  <tromey@adacore.com>
> 
> 	* ada-lang.c (do_full_match): Conditionally skip "_ada_" prefix.

The patch looks good to me, so OK to push to master.

> ---
>  gdb/ChangeLog  |  4 ++++
>  gdb/ada-lang.c | 10 ++++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
> index 8b2086109b9..3a33ee24d39 100644
> --- a/gdb/ada-lang.c
> +++ b/gdb/ada-lang.c
> @@ -13552,10 +13552,16 @@ do_full_match (const char *symbol_search_name,
>  	       const lookup_name_info &lookup_name,
>  	       completion_match_result *comp_match_res)
>  {
> -  if (startswith (symbol_search_name, "_ada_"))
> +  const char *lname = lookup_name.ada ().lookup_name ().c_str ();
> +
> +  /* If both symbols start with "_ada_", just let the loop below
> +     handle the comparison.  However, if only the symbol name starts
> +     with "_ada_", skip the prefix and let the match proceed as
> +     usual.  */
> +  if (startswith (symbol_search_name, "_ada_")
> +      && !startswith (lname, "_ada"))
>      symbol_search_name += 5;
>  
> -  const char *lname = lookup_name.ada ().lookup_name ().c_str ();
>    int uscore_count = 0;
>    while (*lname != '\0')
>      {
> -- 
> 2.26.2

-- 
Joel


More information about the Gdb-patches mailing list