From: Jiong Wang <jiwang@tilera.com>
To: <gdb-patches@sourceware.org>
Cc: Walter Lee <walt@tilera.com>
Subject: [RFC/TileGX 5/6]show registers in columns
Date: Fri, 18 Jan 2013 09:30:00 -0000 [thread overview]
Message-ID: <50F91633.6000704@tilera.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 676 bytes --]
tilegx has 64 registers, to show them in row will be not very convinent
to explore,
so we improve this by showing them in columns.
(gdb) info registers
r0 0x0000000000000001 r19 0x0000000000000000 r38 0x0000000000000040
r1 0x000001ffffc7f458 r20 0x000001ffffc7f278 r39
0x0000000000000000
r2 0x000001ffffc7f468 r21 0x000001ffffc7f298 r40
0x000000000015b3e8
r3 0x0000000000010720 r22 0x000001ffffc7f280 r41
0x000000000015882c
...
...
gdb/ChangeLog:
* tilegx-tdep.c (tilegx_print_registers_info): New function.
show registers in columns.
please review.
---
Regards,
Jiong
Tilera Corporation.
[-- Attachment #2: 0006-show-registers-in-columns.patch --]
[-- Type: text/x-patch, Size: 2490 bytes --]
---
gdb/tilegx-tdep.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+)
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 7f36bed..c19bdf9 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -940,6 +940,66 @@ tilegx_cannot_reference_register (struct gdbarch *gdbarch, int regno)
return 1;
}
+
+/* Tilera private register printer. */
+#define MAX_COLUMNS 3
+static void
+tilegx_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+ struct frame_info *frame,
+ int regnum, int print_all)
+{
+ int i;
+ int j;
+ int k;
+ gdb_byte buffer[MAX_REGISTER_SIZE];
+
+ if (regnum != -1)
+ {
+ default_print_registers_info (gdbarch, file, frame, regnum, print_all);
+ return;
+ }
+
+ for (i = 0; i < TILEGX_NUM_EASY_REGS / MAX_COLUMNS + 1; ++i)
+ {
+ for (j = i;
+ j < TILEGX_NUM_EASY_REGS + 1;
+ j += TILEGX_NUM_EASY_REGS / MAX_COLUMNS + 1)
+ {
+ /* Some registers are never available. Skip them and print PC. */
+ if (j > TILEGX_LR_REGNUM)
+ j = TILEGX_PC_REGNUM;
+
+ if (j > i)
+ fprintf_filtered (file, " ");
+
+ fputs_filtered (gdbarch_register_name (gdbarch, j), file);
+ print_spaces_filtered (5 - strlen (gdbarch_register_name
+ (gdbarch, j)), file);
+
+ /* Get the data in raw format. */
+ if (! deprecated_frame_register_read (frame, j, buffer))
+ {
+ fprintf_filtered (file, " *** no value *** ");
+ }
+ else
+ {
+ fprintf_filtered (file, "0x");
+ for (k = 0; k < tilegx_reg_size; k++)
+ {
+ int idx;
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ idx = k;
+ else
+ idx = tilegx_reg_size - 1 - k;
+ fprintf_filtered (file, "%02x", (unsigned char) buffer[idx]);
+ }
+ }
+ }
+
+ fprintf_filtered (file, "\n");
+ }
+}
+
static struct gdbarch *
tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -1000,6 +1060,9 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Stack grows down. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+ /* Tilera private register printer */
+ set_gdbarch_print_registers_info (gdbarch, tilegx_print_registers_info);
+
/* Frame Info. */
set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc);
--
1.7.10.3
next reply other threads:[~2013-01-18 9:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 9:30 Jiong Wang [this message]
2013-01-18 13:50 ` Joel Brobecker
2013-01-18 16:07 ` Jiong Wang
2013-02-08 19:09 ` Joel Brobecker
2013-02-08 21:09 ` Pedro Alves
2013-02-13 14:42 ` Jiong Wang
2013-02-11 19:20 ` Tom Tromey
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=50F91633.6000704@tilera.com \
--to=jiwang@tilera.com \
--cc=gdb-patches@sourceware.org \
--cc=walt@tilera.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