[RFAv4,3/3] NEWS and documentation for $_gdb_setting and $_gdb_int_setting.
Commit Message
gdb/ChangeLog
2019-09-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention $_gdb_setting, $_gdb_setting_str, $_gdb_maint_setting
and $_gdb_maint_setting_str.
gdb/doc/ChangeLog
2019-09-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Convenience Funs): Document the new
$_gdb_setting_str, $_gdb_maint_setting and $_gdb_maint_setting_str
convenience functions.
---
gdb/NEWS | 6 ++++
gdb/doc/gdb.texinfo | 80 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 85 insertions(+), 1 deletion(-)
Comments
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Sat, 7 Sep 2019 13:38:23 +0200
>
> gdb/ChangeLog
> 2019-09-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> * NEWS: Mention $_gdb_setting, $_gdb_setting_str, $_gdb_maint_setting
> and $_gdb_maint_setting_str.
>
> gdb/doc/ChangeLog
> 2019-09-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> * gdb.texinfo (Convenience Funs): Document the new
> $_gdb_setting_str, $_gdb_maint_setting and $_gdb_maint_setting_str
> convenience functions.
Thanks, this part is OK.
Hi,
See some comments below.
On 9/7/19 12:38 PM, Philippe Waroquiers wrote:
> gdb/ChangeLog
> 2019-09-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> * NEWS: Mention $_gdb_setting, $_gdb_setting_str, $_gdb_maint_setting
> and $_gdb_maint_setting_str.
>
> gdb/doc/ChangeLog
> 2019-09-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
>
> * gdb.texinfo (Convenience Funs): Document the new
> $_gdb_setting_str, $_gdb_maint_setting and $_gdb_maint_setting_str
> convenience functions.
> ---
> gdb/NEWS | 6 ++++
> gdb/doc/gdb.texinfo | 80 ++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 85 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index f382e887c0..0277af0519 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -11,6 +11,12 @@
> scripts that should work error-free with many different versions,
> such as in system-wide init files.
>
> +* New built-in convenience functions $_gdb_setting, $_gdb_setting_str,
> + $_gdb_maint_setting and $_gdb_maint_setting_str provide access to values
> + of the GDB settings and the GDB maintenance settings. They are handy
> + for changing the logic of user defined commands depending on the
> + current GDB settings.
> +
> * GDB now supports Thread Local Storage (TLS) variables on several
> FreeBSD architectures (amd64, i386, powerpc, riscv). Other
> architectures require kernel changes. TLS is not yet supported for
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 53b7de91e4..baddfb9e02 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -11877,9 +11877,87 @@ $3 = void
> $4 = 1
> @end smallexample
>
> +@item $_gdb_setting_str (@var{setting})
> +@findex $_gdb_setting_str@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}).
> +
> +@smallexample
> +(@value{GDBP}) show print frame-arguments
> +Printing of non-scalar frame arguments is "scalars".
> +(@value{GDBP}) p $_gdb_setting_str("print frame-arguments")
> +$2 = "scalars"
> +(@value{GDBP}) p $_gdb_setting_str("height")
> +$3 = "30"
Nit, it looks neater to start at $1, $2, ...
> +(@value{GDBP})
> +@end smallexample
> +
> +@item $_gdb_setting (@var{setting})
> +@findex $_gdb_setting@r{, convenience function}
> +Return the value of the @value{GDBN} @var{setting}.
> +The type of the returned value depends on the setting.
> +
> +The value type for boolean and auto boolean settings is @code{int}.
> +The boolean values @code{off} and @code{on} are converted to
> +the integer values @code{0} and @code{1}. The value @code{auto} is
> +converted to the value @code{-1}.
> +
> +The value type for integer setting is either @code{unsigned int}
> +or @code{int}, depending on the setting.
"for integer setting" "for integer settings" (plural)
> +
> +Some integer settings accepts an @code{unlimited} value.
"Some integer settings accepts" -> "Some integer settings accept"
> +Depending on the setting, the @code{set} command also accepts
> +the value @code{0} or the value @code{@minus{}1} as a synonym for
> +@code{unlimited}.
> +For example, @code{set height unlimited} is equivalent to
> +@code{set height 0}.
> +
> +Some other settings accepting the @code{unlimited} value
> +are using the value @code{0} to literally mean zero.
Suggest:
Some other settings that accept the @code{unlimited} value
use the value @code{0} to literally mean zero.
> +For example, @code{set history size 0} indicates to not
> +record any @value{GDBN} commands in the command history.
> +For such settings, @code{@minus{}1} is the synonym
> +for @code{unlimited}.
> +
> +See the documentation of the corresponding @code{set} command for
> +the numerical value equivalent to @code{unlimited}.
> +
> +The function @code{$_gdb_setting} converts the unlimited value
The @code{$_gdb_setting} function
> +to a @code{0} or a @code{@minus{}1} value according to what the
> +@code{set} command uses.
> +
> +@smallexample
> +@group
> +(@value{GDBP}) p $_gdb_setting_str("height")
> +$3 = "30"
> +(@value{GDBP}) p $_gdb_setting("height")
> +$4 = 30
> +(@value{GDBP}) set height unlimited
> +(@value{GDBP}) p $_gdb_setting_str("height")
> +$5 = "unlimited"
> +(@value{GDBP}) p $_gdb_setting("height")
> +$6 = 0
> +@end group
> +@group
> +(@value{GDBP}) p $_gdb_setting_str("history size")
> +$7 = "unlimited"
> +(@value{GDBP}) p $_gdb_setting("history size")
> +$8 = -1
> +(@value{GDBP}) p $_gdb_setting_str("disassemble-next-line")
> +$9 = "auto"
> +(@value{GDBP}) p $_gdb_setting("disassemble-next-line")
> +$10 = -1
> +(@value{GDBP})
> +@end group
> +@end smallexample
> +
> +Other settings (enum, filename, optional filename, string, string noescape)
"Other settings" -> "Other setting types"
> +are returned as string values.
> +
> @end table
>
> -These functions require @value{GDBN} to be configured with
> +The following functions require @value{GDBN} to be configured with
> @code{Python} support.
>
> @table @code
>
Thanks,
Pedro Alves
@@ -11,6 +11,12 @@
scripts that should work error-free with many different versions,
such as in system-wide init files.
+* New built-in convenience functions $_gdb_setting, $_gdb_setting_str,
+ $_gdb_maint_setting and $_gdb_maint_setting_str provide access to values
+ of the GDB settings and the GDB maintenance settings. They are handy
+ for changing the logic of user defined commands depending on the
+ current GDB settings.
+
* GDB now supports Thread Local Storage (TLS) variables on several
FreeBSD architectures (amd64, i386, powerpc, riscv). Other
architectures require kernel changes. TLS is not yet supported for
@@ -11877,9 +11877,87 @@ $3 = void
$4 = 1
@end smallexample
+@item $_gdb_setting_str (@var{setting})
+@findex $_gdb_setting_str@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}).
+
+@smallexample
+(@value{GDBP}) show print frame-arguments
+Printing of non-scalar frame arguments is "scalars".
+(@value{GDBP}) p $_gdb_setting_str("print frame-arguments")
+$2 = "scalars"
+(@value{GDBP}) p $_gdb_setting_str("height")
+$3 = "30"
+(@value{GDBP})
+@end smallexample
+
+@item $_gdb_setting (@var{setting})
+@findex $_gdb_setting@r{, convenience function}
+Return the value of the @value{GDBN} @var{setting}.
+The type of the returned value depends on the setting.
+
+The value type for boolean and auto boolean settings is @code{int}.
+The boolean values @code{off} and @code{on} are converted to
+the integer values @code{0} and @code{1}. The value @code{auto} is
+converted to the value @code{-1}.
+
+The value type for integer setting is either @code{unsigned int}
+or @code{int}, depending on the setting.
+
+Some integer settings accepts an @code{unlimited} value.
+Depending on the setting, the @code{set} command also accepts
+the value @code{0} or the value @code{@minus{}1} as a synonym for
+@code{unlimited}.
+For example, @code{set height unlimited} is equivalent to
+@code{set height 0}.
+
+Some other settings accepting the @code{unlimited} value
+are using the value @code{0} to literally mean zero.
+For example, @code{set history size 0} indicates to not
+record any @value{GDBN} commands in the command history.
+For such settings, @code{@minus{}1} is the synonym
+for @code{unlimited}.
+
+See the documentation of the corresponding @code{set} command for
+the numerical value equivalent to @code{unlimited}.
+
+The function @code{$_gdb_setting} converts the unlimited value
+to a @code{0} or a @code{@minus{}1} value according to what the
+@code{set} command uses.
+
+@smallexample
+@group
+(@value{GDBP}) p $_gdb_setting_str("height")
+$3 = "30"
+(@value{GDBP}) p $_gdb_setting("height")
+$4 = 30
+(@value{GDBP}) set height unlimited
+(@value{GDBP}) p $_gdb_setting_str("height")
+$5 = "unlimited"
+(@value{GDBP}) p $_gdb_setting("height")
+$6 = 0
+@end group
+@group
+(@value{GDBP}) p $_gdb_setting_str("history size")
+$7 = "unlimited"
+(@value{GDBP}) p $_gdb_setting("history size")
+$8 = -1
+(@value{GDBP}) p $_gdb_setting_str("disassemble-next-line")
+$9 = "auto"
+(@value{GDBP}) p $_gdb_setting("disassemble-next-line")
+$10 = -1
+(@value{GDBP})
+@end group
+@end smallexample
+
+Other settings (enum, filename, optional filename, string, string noescape)
+are returned as string values.
+
@end table
-These functions require @value{GDBN} to be configured with
+The following functions require @value{GDBN} to be configured with
@code{Python} support.
@table @code