This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFAv2 3/3] NEWS and documentation for $_gdb_setting and $_gdb_int_setting.
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Fri, 5 Jul 2019 21:58:23 +0200
>
> +@item $_gdb_setting (@var{setting})
> +@findex $_gdb_setting@r{, convenience function}
> +Return the value of the @value{GDBN} @var{setting} as a string.
> +@var{setting} is any setting that can be used in a @code{set} or
> +@code{show} command (@pxref{Controlling GDB}).
After reading the description of $_gdb_int_setting, a question I have
about this function is whether it works for settings whose values are
integers. The examples answer that question, but I think the text
should be explicit about that.
> +@item $_gdb_int_setting (@var{setting})
> +@findex $_gdb_int_setting@r{, convenience function}
> +Return the value of the @value{GDBN} @var{setting} as an integer.
> +This only works for boolean, auto boolean and integer settings.
> +The boolean values @code{on} and @code{off} are converted to
> +the integer values @code{0} and @code{1}.
The correspondence of ON and OFF to zero and 1 respectively surprised
me. Why not the other way around?
> The value @code{auto} is
> +converted to the value @code{2}.
> +Some integer settings accepts an @code{unlimited} value.
> +Depending on the setting, the unlimited value is converted to a @code{0}
> +or a @code{-1} value.
The last part begs a question how to know whether 'unlimited' will
yield zero or -1? Can't we always return -1?
Markup-wise, please use @code{@minus{}1}, it will look better in print.
Btw, do we have a way of determining whether a given convenience
function exists in the current GDB? For variables, one can use
$_isvoid, I think, but what about functions?
Thanks.