From patchwork Fri Jul 5 19:58:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 33614 Received: (qmail 121292 invoked by alias); 5 Jul 2019 19:58:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 121245 invoked by uid 89); 5 Jul 2019 19:58:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=amd64 X-HELO: mailsec106.isp.belgacom.be Received: from mailsec106.isp.belgacom.be (HELO mailsec106.isp.belgacom.be) (195.238.20.102) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 Jul 2019 19:58:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1562356716; x=1593892716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LwjaFeOWQAMlGQS9dz2YJi2Qa0xCmKicYtqadG1OP/I=; b=NM3+w+gMZPytd9yM4AN3NgeUeCTE8bvXFuJHeonzX43qMYnZCe4WlsmG 7e9Q089XY239Aje6H5m1u5GRz7fLfg==; Received: from 96.218-128-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.128.218.96]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 05 Jul 2019 21:58:29 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv2 3/3] NEWS and documentation for $_gdb_setting and $_gdb_int_setting. Date: Fri, 5 Jul 2019 21:58:23 +0200 Message-Id: <20190705195823.3472-4-philippe.waroquiers@skynet.be> In-Reply-To: <20190705195823.3472-1-philippe.waroquiers@skynet.be> References: <20190705195823.3472-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes --- gdb/ChangeLog | 3 +++ gdb/NEWS | 5 +++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 48 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ab414dca9f..bfde05e363 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -9111,6 +9111,9 @@ fill-column: 74 version-control: never coding: utf-8 End: +2019-04-28 Philippe Waroquiers + + * NEWS: Mention $_gdb_setting and $_gdb_int_setting. 2019-04-28 Philippe Waroquiers diff --git a/gdb/NEWS b/gdb/NEWS index 34c544c3d5..d17d37ceff 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -11,6 +11,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 values 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 1025916003..536444f628 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -12944,3 +12944,8 @@ fill-column: 74 version-control: never coding: utf-8 End: +2019-04-27 Philippe Waroquiers + + * 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 299c4a12a1..e122fbb77b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -11820,6 +11820,54 @@ $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. +@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("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. +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 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. + +@smallexample +@group +(@value{GDBP}) p $_gdb_setting("height") +$3 = "30" +(@value{GDBP}) p $_gdb_int_setting("height") +$4 = 30 +(@value{GDBP}) set height unlimited +(@value{GDBP}) p $_gdb_setting("height") +$5 = "unlimited" +(@value{GDBP}) p $_gdb_int_setting("height") +$6 = 0 +@end group +@group +(@value{GDBP}) p $_gdb_setting("remote hardware-watchpoint-limit") +$7 = "unlimited" +(@value{GDBP}) p $_gdb_int_setting("remote hardware-watchpoint-limit") +$8 = -1 +(@value{GDBP}) +@end group +@end smallexample + @end table These functions require @value{GDBN} to be configured with