[RFAv5 0/3] Convenience functions $_gdb_setting/$_gdb_setting_str
Pedro Alves
palves@redhat.com
Wed Oct 30 19:39:00 GMT 2019
On 9/15/19 7:53 PM, Philippe Waroquiers wrote:
> Some notes:
> In settings.exp show_setting, I have not added a check that RESET_VALUE
> differs from the expected value: this means to add a specific reset_value
> to a lot of show_setting calls. As enough different values are verified,
> this seems not necessary.
>
> For what concerns ptype $_gdb_setting("something") always giving type int:
> This is "normal". For example, "ptype $_as_string(123)" similarly gives int.
>
> The reason: ptype evalues the given expression, but in a way that avoids
> side effects. This then leads to eval_call in eval.c, that does:
> ...
> if (noside == EVAL_AVOID_SIDE_EFFECTS)
> {
> ...
>
> if (TYPE_CODE (ftype) == TYPE_CODE_INTERNAL_FUNCTION)
> {
> /* We don't know anything about what the internal
> function might return, but we have to return
> something. */
> return value_zero (builtin_type (exp->gdbarch)->builtin_int,
> not_lval);
>
I see. Thanks for checking this.
> and so any internal GDB function will always have the "type int".
> Wondering if it would not be better to report an error such as
> ("No type information for GDB functions") rather than lie.
Yeah, sounds like it. Sounds similar to the whole thing with
calling functions with no debug info, which was fixed a few
releases ago to require a cast:
https://sourceware.org/ml/gdb-patches/2017-07/msg00137.html
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list