[PATCH] gdb: Fix finding the right global variable for the current namespace

Tom Tromey tom@tromey.com
Wed Aug 21 18:58:19 GMT 2024


>>>>> Guinevere Larsen <blarsen@redhat.com> writes:

Thanks for the patch.

> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
> index fde8eee6276..e5a38ca70e6 100644
> --- a/gdb/dwarf2/read.c
> +++ b/gdb/dwarf2/read.c
> @@ -19018,6 +19018,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
>  			   (sym->linkage_name (), objfile));
>  		      if (found.minsym != nullptr)
>                        sym->maybe_copied = 1;
> +
> +		      sym->set_aclass_index (LOC_UNRESOLVED);
>  		    }
 
I don't really remember the details here, but I wonder if the
LOC_UNRESOLVED should be in the 'if' here.  Like, does the comment apply
in your scenario?

Also how does this work with symbol::get_maybe_copied_address which
does:

  gdb_assert (this->aclass () == LOC_STATIC);

Tom


More information about the Gdb-patches mailing list