Message ID | 1412088186-26402-1-git-send-email-james.hogan@imgtec.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 2834 invoked by alias); 30 Sep 2014 14:43:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 2818 invoked by uid 89); 30 Sep 2014 14:43:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Sep 2014 14:43:22 +0000 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id D4AC3D2B12D26 for <gdb-patches@sourceware.org>; Tue, 30 Sep 2014 15:43:15 +0100 (IST) Received: from KLMAIL02.kl.imgtec.org (10.40.60.222) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 30 Sep 2014 15:43:18 +0100 Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by klmail02.kl.imgtec.org (10.40.60.222) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 30 Sep 2014 15:43:18 +0100 Received: from jhogan-linux.le.imgtec.org (192.168.154.101) by LEMAIL01.le.imgtec.org (192.168.152.62) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 30 Sep 2014 15:43:18 +0100 From: James Hogan <james.hogan@imgtec.com> To: <gdb-patches@sourceware.org> CC: James Hogan <james.hogan@imgtec.com> Subject: [PATCH] MIPS: Ignore invalid regs during info registers all Date: Tue, 30 Sep 2014 15:43:06 +0100 Message-ID: <1412088186-26402-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes |
Commit Message
James Hogan
Sept. 30, 2014, 2:43 p.m. UTC
The "info registers all" command causes mips_print_registers_info () to be called for all register numbers, including invalid ones such as unused DSP register numbers. This triggers an error () call which prevents further register values being printed. Just silently return without printing anything or erroring, so that all valid registers can be printed. For example, before this patch: (gdb) info registers all zero: 0x0 ... fir: 0x30f30320 Not a valid register for the current processor type (gdb) After this patch: (gdb) info registers all zero: 0x0 ... fir: 0x30f30320 restart: 0x0 (gdb) gdb/ChangeLog: * mips-tdep.c (mips_print_registers_info): Replace error for single invalid register with silent return. --- gdb/ChangeLog | 5 +++++ gdb/mips-tdep.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
Comments
On 09/30/2014 03:43 PM, James Hogan wrote: > The "info registers all" command causes mips_print_registers_info () to be > called for all register numbers, including invalid ones such as unused DSP > register numbers. This triggers an error () call which prevents further > register values being printed. Just silently return without printing > anything or erroring, so that all valid registers can be printed. What happens when the user does "info registers that-unused-register" ? Thanks, Pedro Alves > > For example, before this patch: > (gdb) info registers all > zero: 0x0 > ... > fir: 0x30f30320 > Not a valid register for the current processor type > (gdb) > > After this patch: > (gdb) info registers all > zero: 0x0 > ... > fir: 0x30f30320 > restart: 0x0 > (gdb) > > gdb/ChangeLog: > > * mips-tdep.c (mips_print_registers_info): Replace error for > single invalid register with silent return. > --- > gdb/ChangeLog | 5 +++++ > gdb/mips-tdep.c | 2 +- > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index f3282144c303..5da8415c3ca0 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,8 @@ > +2014-09-30 James Hogan <james.hogan@imgtec.com> > + > + * mips-tdep.c (mips_print_registers_info): Replace error for > + single invalid register with silent return. > + > 2014-09-30 Andreas Arnez <arnez@linux.vnet.ibm.com> > > * gdbarch.sh (regset_from_core_section): Remove gdbarch method. > diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c > index 188580f2ebdc..3c4665457552 100644 > --- a/gdb/mips-tdep.c > +++ b/gdb/mips-tdep.c > @@ -6332,7 +6332,7 @@ mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, > { > gdb_assert (regnum >= gdbarch_num_regs (gdbarch)); > if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') > - error (_("Not a valid register for the current processor type")); > + return; > > mips_print_register (file, frame, regnum); > fprintf_filtered (file, "\n"); >
On 30/09/14 16:00, Pedro Alves wrote: > On 09/30/2014 03:43 PM, James Hogan wrote: >> The "info registers all" command causes mips_print_registers_info () to be >> called for all register numbers, including invalid ones such as unused DSP >> register numbers. This triggers an error () call which prevents further >> register values being printed. Just silently return without printing >> anything or erroring, so that all valid registers can be printed. > > What happens when the user does "info registers that-unused-register" ? I don't think that's possible, because the check is: if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') So any such register already has no name by which to refer to it. Cheers James
On 09/30/2014 04:05 PM, James Hogan wrote: > On 30/09/14 16:00, Pedro Alves wrote: >> On 09/30/2014 03:43 PM, James Hogan wrote: >>> The "info registers all" command causes mips_print_registers_info () to be >>> called for all register numbers, including invalid ones such as unused DSP >>> register numbers. This triggers an error () call which prevents further >>> register values being printed. Just silently return without printing >>> anything or erroring, so that all valid registers can be printed. >> >> What happens when the user does "info registers that-unused-register" ? > > I don't think that's possible, because the check is: > if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') > > So any such register already has no name by which to refer to it. Indeed. :-) I'll leave it to Maciej to approve. I see that sh64-tdep.c:sh64_media_print_registers_info has the same problem. A bit silly that we force each arch backend to do this. I guess the loop in registers_info could/should already skip empty-named registers, like default_print_registers_info does. Thanks, Pedro Alves
On Tue, 30 Sep 2014, Pedro Alves wrote: > >>> The "info registers all" command causes mips_print_registers_info () to be > >>> called for all register numbers, including invalid ones such as unused DSP > >>> register numbers. This triggers an error () call which prevents further > >>> register values being printed. Just silently return without printing > >>> anything or erroring, so that all valid registers can be printed. > >> > >> What happens when the user does "info registers that-unused-register" ? > > > > I don't think that's possible, because the check is: > > if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') > > > > So any such register already has no name by which to refer to it. > > Indeed. :-) I'll leave it to Maciej to approve. I didn't know `info registers' (and `info all-registers' presumably as well) supported further arguments; I'll experiment with the patch a bit and see what comes out. James, did you push your change through regression testing? If so, then how? Please always state precisely how changes you submit have been validated. Maciej
Hi Maciej, On 03/10/14 17:32, Maciej W. Rozycki wrote: > On Tue, 30 Sep 2014, Pedro Alves wrote: > >>>>> The "info registers all" command causes mips_print_registers_info () to be >>>>> called for all register numbers, including invalid ones such as unused DSP >>>>> register numbers. This triggers an error () call which prevents further >>>>> register values being printed. Just silently return without printing >>>>> anything or erroring, so that all valid registers can be printed. >>>> >>>> What happens when the user does "info registers that-unused-register" ? >>> >>> I don't think that's possible, because the check is: >>> if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') >>> >>> So any such register already has no name by which to refer to it. >> >> Indeed. :-) I'll leave it to Maciej to approve. > > I didn't know `info registers' (and `info all-registers' presumably as > well) supported further arguments; I'll experiment with the patch a bit > and see what comes out. > > James, did you push your change through regression testing? If so, then > how? Please always state precisely how changes you submit have been > validated. No I didn't. I'll get myself set up for running the test suite. Cheers James
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f3282144c303..5da8415c3ca0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-09-30 James Hogan <james.hogan@imgtec.com> + + * mips-tdep.c (mips_print_registers_info): Replace error for + single invalid register with silent return. + 2014-09-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * gdbarch.sh (regset_from_core_section): Remove gdbarch method. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 188580f2ebdc..3c4665457552 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -6332,7 +6332,7 @@ mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { gdb_assert (regnum >= gdbarch_num_regs (gdbarch)); if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') - error (_("Not a valid register for the current processor type")); + return; mips_print_register (file, frame, regnum); fprintf_filtered (file, "\n");