[PATCH][gdb/symtab] Handle .gdb_index in ada language mode

Tom de Vries tdevries@suse.de
Tue Jun 2 10:47:43 GMT 2020


On 22-05-2020 22:31, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> Using this patch, I managed to get it working.
> 
> Wow, cool.
> 
> Tom> The patch does the following:
> Tom> - enable ada .gdb_index by removing the ada check in write_psymbols
> Tom> - copy some ada-specific code from debug_names::insert to
> Tom>   write_psymbols
> Tom> - disable a workaround for gold/15646 in dw2_expand_marked_cus
> 
> Tom> As for the disabled workaround, I ran into trouble in
> Tom> gdb.ada/access_tagged_param.exp, where setting a breakpoint on foo failed.
> 
> Tom> The index shows that there are two entries for foo, one variable, one
> Tom> function:
> Tom> ...
> Tom> [3733] foo:
> Tom>         3 [global, variable]
> Tom>         5 [global, function]
> Tom> ...
> Tom> The workaround skips the function, so disabling the workaround allows
> Tom> the test to pass (my guess atm is that the workaround is not precise
> Tom> enough).
> 
> Looking at the gold bug, I suspect what's needed is to rule out
> duplicates that have the same kind.
> 

The workaround has been limited:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f030440daa989ae3dadc1fa4342cfa16d690db3c
.

> I tend to think you should push your previous patch, and maybe we can
> revisit this stuff later.
> 
> Tom> +	  std::string decoded = ada_decode (name);
> Tom> +	  if (decoded[0] == '<')
> Tom> +	    name = (char *) strndup (decoded.c_str () + 1, decoded.length () - 2);
> Tom> +	  else
> Tom> +	    name = strdup (ada_encode (decoded.c_str ()));
> Tom> +	}
> 
> This leaks the string.

Fixed in a new version of the patch, submitted as part of patch series:
- "[PATCH, 1/2][gdb/symtab] Fix name lookup in dw2_map_matching_symbols"
  https://sourceware.org/pipermail/gdb-patches/2020-June/169213.html
- "[PATCH][gdb/symtab] Enable ada .gdb_index"
  https://sourceware.org/pipermail/gdb-patches/2020-June/169214.html

[ Note the missing ", 2/2" in subject of second patch. ]

Thanks,
- Tom


More information about the Gdb-patches mailing list