[RFA,3/3] NEWS and documentation for $_gdb_setting and $_gdb_int_setting.

Message ID 20190428151816.31598-4-philippe.waroquiers@skynet.be
State New, archived
Headers

Commit Message

Philippe Waroquiers April 28, 2019, 3:18 p.m. UTC
  ---
 gdb/ChangeLog       |  3 +++
 gdb/NEWS            |  5 +++++
 gdb/doc/ChangeLog   |  5 +++++
 gdb/doc/gdb.texinfo | 32 ++++++++++++++++++++++++++++++++
 4 files changed, 45 insertions(+)
  

Comments

Eli Zaretskii April 28, 2019, 4:17 p.m. UTC | #1
> From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Date: Sun, 28 Apr 2019 17:18:16 +0200
> 
> +* New built-in convenience functions $_gdb_setting and $_gdb_int_setting
> +  provide access to the value of the GDB settings.  They are handy
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"provide access to values of ..."

> +@findex $_gdb_setting@r{, convenience function}
> +Return the value of the @value{GDBN} @var{setting} as a string value.
                                                      ^^^^^^^^^^^^^^^^^
"as a string", the "value" part is redundant.

> +@var{setting} argument is the suffix to use in the @code{show} command

I'd drop the "argument" part.

I also think that "suffix to use in the 'show' command" is a
potentially confusing description.  How about

  @var{setting} is any setting that can be used in a @code{set} or
  @code{show} command (@pxref{Controlling GDB}).

> +@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 value.
                                                         ^^^^^^^^^^^^^^^^
Again, I'd drop the "value" part.

> +This only works for boolean, auto boolean and integer settings.
> +The boolean values @code{false} and @code{true} are converted to
> +the integer values @code{0} and @code{1}. The value @code{auto} is
                                           ^^
Two spaces.

> +converted to the value  @code{2}.

What about the value "infinite" or "unlimited"?

Thanks.
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4835c6fae5..4f37db24fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -6022,6 +6022,9 @@  fill-column: 74
 version-control: never
 coding: utf-8
 End:
+2019-04-28  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+	* NEWS: Mention $_gdb_setting and $_gdb_int_setting.
 
 2019-04-28  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
diff --git a/gdb/NEWS b/gdb/NEWS
index 42b04e952a..a84509d1c5 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -9,6 +9,11 @@ 
   scripts that should work error-free with many different versions,
   such as in system-wide init files.
 
+* New built-in convenience functions $_gdb_setting and $_gdb_int_setting
+  provide access to the value of the GDB 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/ChangeLog b/gdb/doc/ChangeLog
index 3efed670fa..a5a559e2b8 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -12811,3 +12811,8 @@  fill-column: 74
 version-control: never
 coding: utf-8
 End:
+2019-04-27  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+	* gdb.texinfo (Convenience Funs): Document the new
+	$_gdb_setting and $_gdb_int_setting convenience functions.
+
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index cf8333d86b..688613ce07 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -11307,6 +11307,38 @@  $3 = void
 $4 = 1
 @end smallexample
 
+@item $_gdb_setting (@var{setting})
+@findex $_gdb_setting@r{, convenience function}
+Return the value of the @value{GDBN} @var{setting} as a string value.
+@var{setting} argument is the suffix to use in the @code{show} command
+to examine this setting in the @value{GDBN} command line interface.
+
+@smallexample
+(@value{GDBP}) show print frame-arguments
+Printing of non-scalar frame arguments is "scalars".
+(@value{GDBP}) p $_gdb_setting("print frame-arguments")
+$2 = "scalars"
+(@value{GDBP}) p $_gdb_setting("height")
+$3 = "30"
+((@value{GDBP})
+@end smallexample
+
+@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 value.
+This only works for boolean, auto boolean and integer settings.
+The boolean values @code{false} and @code{true} are converted to
+the integer values @code{0} and @code{1}. The value @code{auto} is
+converted to the value  @code{2}.
+
+@smallexample
+(@value{GDBP}) p $_gdb_setting("height")
+$3 = "30"
+(@value{GDBP}) p $_gdb_int_setting("height")
+$4 = 30
+((@value{GDBP})
+@end smallexample
+
 @end table
 
 These functions require @value{GDBN} to be configured with