From patchwork Wed Jun 7 22:15:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 20836 Received: (qmail 6211 invoked by alias); 7 Jun 2017 22:15:54 -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 6166 invoked by uid 89); 7 Jun 2017 22:15:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-pg0-f67.google.com Received: from mail-pg0-f67.google.com (HELO mail-pg0-f67.google.com) (74.125.83.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Jun 2017 22:15:51 +0000 Received: by mail-pg0-f67.google.com with SMTP id v18so2556759pgb.3 for ; Wed, 07 Jun 2017 15:15:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=cjV6e9ov1BMtvPPGRRJZhJL4AWgWEZq/sT9+m3DaXYY=; b=tWRXfHihW6smRHm3rd93w5Y6RkqKrdgFhOA8mj7nLvfzA/juAN1eiLBOzbv7agrE1Q vMd8G9clNtdPjixwS1FDqV5Z+vn2sh8PzUFeH/7wNGqSvNhH3UiBL5Jg/9W2POC0RqQm PQ+GikH3ZRXKN3taW19eY8+fT3+KM3A7mauuZFo3bVw6rd05wWHaiTw2VHitrOGjXgPj 30nGRWdIni2bLD+52IgCMVAs6tFfX6z+lX5daFyy2R2hcgKRPdFPST3q4hcrQDBiR7pU YWkT0I6KXkIWcXe3mr2uNUcsYMqRWwrjupPc6CYB/G77mnpkl6IZS8HGPu5/Ce/NoISO EkmA== X-Gm-Message-State: AODbwcD1jWO6UnLf946cJNYICyI4K1B2qANm3fLXs/FqLl2P8Hn9SA6v CxmfkhnvPQuFMLllO50= X-Received: by 10.99.4.87 with SMTP id 84mr35266906pge.138.1496873753816; Wed, 07 Jun 2017 15:15:53 -0700 (PDT) Received: from localhost (g212.61-193-241.ppp.wakwak.ne.jp. [61.193.241.212]) by smtp.gmail.com with ESMTPSA id x30sm6155986pge.23.2017.06.07.15.15.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Jun 2017 15:15:53 -0700 (PDT) From: Stafford Horne To: GDB patches Cc: Stafford Horne Subject: [PATCH 1/3] reggroups: Add test and docs for `info reg $reggroup` feature Date: Thu, 8 Jun 2017 07:15:45 +0900 Message-Id: <83413241fe0897c873b1cc6e18ccbec78a7a2a25.1496871270.git.shorne@gmail.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Until now this feature has existed but was not documented. Adding docs and tests. gdb/ChangeLog: 2017-06-06 Stafford Horne * doc/gdb.texinfo: Document info reg $reggroup feature. gdb/testsuite/ChangeLog: 2017-06-06 Stafford Horne * gdb.base/reggroups.c: New file. * gdb.base/reggroups.exp: New file. --- gdb/doc/gdb.texinfo | 5 +++ gdb/testsuite/gdb.base/reggroups.c | 4 ++ gdb/testsuite/gdb.base/reggroups.exp | 71 ++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 gdb/testsuite/gdb.base/reggroups.c create mode 100644 gdb/testsuite/gdb.base/reggroups.exp diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9fb70f6..a11db0c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -10878,6 +10878,11 @@ and vector registers (in the selected stack frame). Print the names and values of all registers, including floating-point and vector registers (in the selected stack frame). +@item info registers @var{reggroup} @dots{} +Print the name and value of the restiers in each of the specified +@var{reggroup}. The @var{reggoup} can be any of those returned by +@code{maint print reggroups}. + @item info registers @var{regname} @dots{} Print the @dfn{relativized} value of each specified register @var{regname}. As discussed in detail below, register values are normally relative to diff --git a/gdb/testsuite/gdb.base/reggroups.c b/gdb/testsuite/gdb.base/reggroups.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/gdb/testsuite/gdb.base/reggroups.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/reggroups.exp b/gdb/testsuite/gdb.base/reggroups.exp new file mode 100644 index 0000000..fd51c50 --- /dev/null +++ b/gdb/testsuite/gdb.base/reggroups.exp @@ -0,0 +1,71 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2014-2017 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test listing reggroups and the registers in each group. + +standard_testfile + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { + return -1 +} + +if ![runto_main] then { + fail "can't run to main" + return 0 +} + +proc fetch_reggroups {test} { + global gdb_prompt + global expect_out + + set reggroups {} + set bad -1 + gdb_test_multiple "maint print reggroups" "get reggroups" { + -re "maint print reggroups\r\n" { + exp_continue + } + -re "^ Group\[ \t\]+Type\[ \t\]+\r\n" { + exp_continue + } + -re "^ (\[0-9a-zA-Z\-\]+)\[ \t\]+(user|internal)\[ \t\]+\r\n" { + lappend reggroups $expect_out(1,string) + exp_continue + } + -re ".*$gdb_prompt $" { + if { [llength $reggroups] != 0 } { + incr bad + } else { + set bad 1 + } + } + } + + if {$bad} { + fail $test + return {} + } + + pass $test + return $reggroups +} + +set reggroups [fetch_reggroups "fetch reggroups"] +set reggroup "" + +foreach reggroup [lrange $reggroups 0 end] { + gdb_test "info reg $reggroup" ".*" "info reg $reggroup" +}