From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: palves@redhat.com (Pedro Alves)
Cc: palves@redhat.com (Pedro Alves),
sergiodj@redhat.com (Sergio Durigan Junior),
gdb-patches@sourceware.org (GDB Patches),
tromey@redhat.com (Tom Tromey),
jan.kratochvil@redhat.com (Jan Kratochvil)
Subject: Re: info registers output
Date: Tue, 28 Aug 2012 00:41:00 -0000 [thread overview]
Message-ID: <201208280041.q7S0fRb3026972@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <503BB123.50500@redhat.com> from "Pedro Alves" at Aug 27, 2012 06:40:51 PM
Pedro Alves wrote:
> On 08/01/2012 09:49 PM, Ulrich Weigand wrote:
> > Would make sense to me. (In fact, there probably ought to be a single
> > routine to print a register, called by both code paths, to avoid having
> > the code diverge again in the future ...)
>
> Here's a patch that does that. If some arch wants to print user regs
> differently, we'll either have to add a new gdbarch, or make
> gdbarch_print_registers_info handle user regs.
>
> We now get, for amd64:
>
> (gdb) info registers pc rip sp rsp fp rbp
> pc 0x45762b 0x45762b <main+15>
> rip 0x45762b 0x45762b <main+15>
> sp 0x7fffffffdbe0 0x7fffffffdbe0
> rsp 0x7fffffffdbe0 0x7fffffffdbe0
> fp 0x7fffffffdc10 0x7fffffffdc10
> rbp 0x7fffffffdc10 0x7fffffffdc10
>
> Before we'd get:
>
> (gdb) info registers pc rip sp rsp fp rbp
> pc: 0x45762b
> rip 0x45762b 0x45762b <main+15>
> sp: 0x7fffffffdbe0
> rsp 0x7fffffffdbe0 0x7fffffffdbe0
> fp: 0x7fffffffdc10
> rbp 0x7fffffffdc10 0x7fffffffdc10
>
> How does it look?
Looks good to me. The only minor nit would be:
> +/* Print out the register NAME, of GDBARCH, with value VAL, to FILE,
> + in the default fashion. */
> +
> +static void
> +default_print_one_register_info (struct gdbarch *gdbarch,
> + struct ui_file *file,
> + const char *name,
> + struct value *val)
Does this really need a GDBARCH argument? It's only used here:
> + for (j = 0; j < TYPE_LENGTH (regtype); j++)
> + {
> + int idx;
> +
> + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
> + idx = j;
> + else
> + idx = TYPE_LENGTH (regtype) - 1 - j;
> + fprintf_filtered (file, "%02x", (unsigned char) valaddr[idx]);
> + }
where we really want the type's byte order anyway ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2012-08-28 0:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 21:26 [PATCH] Adjust `pc-fp.exp' for ppc64/s390x (PR 12659) Sergio Durigan Junior
2012-07-31 23:29 ` Andreas Schwab
2012-08-01 3:06 ` Sergio Durigan Junior
2012-08-01 9:22 ` Andreas Schwab
2012-08-01 8:46 ` Pedro Alves
2012-08-01 19:41 ` Ulrich Weigand
2012-08-01 19:47 ` Sergio Durigan Junior
2012-08-01 20:20 ` info registers output Pedro Alves
2012-08-01 20:49 ` Ulrich Weigand
2012-08-01 20:55 ` Sergio Durigan Junior
2012-08-27 17:41 ` Pedro Alves
2012-08-28 0:41 ` Ulrich Weigand [this message]
2012-08-28 9:07 ` Pedro Alves
2012-08-01 19:52 ` [PATCH] Adjust `pc-fp.exp' for ppc64/s390x (PR 12659) Tom Tromey
2012-08-01 20:23 ` Pedro Alves
2012-08-01 20:49 ` Sergio Durigan Junior
2012-08-01 21:44 ` Pedro Alves
2012-08-01 22:03 ` Andreas Schwab
2012-08-01 23:40 ` Sergio Durigan Junior
2012-08-02 9:06 ` Pedro Alves
2012-08-02 20:38 ` Sergio Durigan Junior
2012-08-08 11:57 ` Mark Kettenis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201208280041.q7S0fRb3026972@d06av02.portsmouth.uk.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=palves@redhat.com \
--cc=sergiodj@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox