[PATCH] Extract symbol-writing function from parsers

Tom Tromey tom@tromey.com
Wed Jan 27 23:39:36 GMT 2021


[...]
Simon> The behavior seems to change a little bit here.  Imagine we go in
Simon> write_exp_msymbol (in the original code), we will then go into that
Simon> block that starts with "Check if the qualified name".  In the new code,
Simon> we won't.  I don't know if that's important.

I haven't looked into this yet, but I will.

>> -			      if (symbol_read_needs_frame (sym.symbol))
>> -				pstate->block_tracker->update (sym);

Simon> This if gets removed in the new code, is it important?  It's present in
Simon> m2 as well.

Thanks for noticing.
Parsers do need to update this, it's required for watchpoints.
So, I think you found a latent bug in c-exp.y.

>> -			      struct bound_minimal_symbol msymbol;
>> -			      std::string arg = copy_name ($1.stoken);

Simon> This copy is kept in the new code.  Do you know if/why it's important?

A 'struct stoken' doesn't guarantee that the name is \0-terminated, but
this property is needed by write_exp_symbol_reference.

Tom


More information about the Gdb-patches mailing list