This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFAv5 0/3] Convenience functions $_gdb_setting/$_gdb_setting_str
- From: Pedro Alves <palves at redhat dot com>
- To: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>, gdb-patches at sourceware dot org
- Date: Wed, 30 Oct 2019 19:38:51 +0000
- Subject: Re: [RFAv5 0/3] Convenience functions $_gdb_setting/$_gdb_setting_str
- References: <20190915185314.19875-1-philippe.waroquiers@skynet.be>
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