aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2003-07-24 19:59:33 +0000
committerStephane Carrez <stcarrez@nerim.fr>2003-07-24 19:59:33 +0000
commite286caf2829593ec235a15a81e7ec76d2ccd3b46 (patch)
treef102dcfa7dd4ad3c016b8a5126387d2afcf06520
parent3b2fc2ea683563693bf8f2c57e3b80322fceb332 (diff)
downloadgdb-e286caf2829593ec235a15a81e7ec76d2ccd3b46.zip
gdb-e286caf2829593ec235a15a81e7ec76d2ccd3b46.tar.gz
gdb-e286caf2829593ec235a15a81e7ec76d2ccd3b46.tar.bz2
* NEWS: Mention "regs" deprecated for m68hc11 too.
* m68hc11-tdep.c (_initialize_m68hc11_tdep): Deprecate "regs" command. (m68hc11_print_register): New function to print out one register. (m68hc11_print_registers_info): New function to print registers. (show_regs): Deprecate and use the above. (m68hc11_gdbarch_init): Install the print_registers_info.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/NEWS2
-rw-r--r--gdb/m68hc11-tdep.c200
3 files changed, 166 insertions, 46 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 680bd8e..6473f3e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2003-07-24 Stephane Carrez <stcarrez@nerim.fr>
+
+ * NEWS: Mention "regs" deprecated for m68hc11 too.
+
+ * m68hc11-tdep.c (_initialize_m68hc11_tdep): Deprecate "regs" command.
+ (m68hc11_print_register): New function to print out one register.
+ (m68hc11_print_registers_info): New function to print registers.
+ (show_regs): Deprecate and use the above.
+ (m68hc11_gdbarch_init): Install the print_registers_info.
+
2003-07-24 Jeff Johnston <jjohnstn@redhat.com>
* ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Verify
diff --git a/gdb/NEWS b/gdb/NEWS
index 563029b..a8e8a02 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -16,7 +16,7 @@ The "detach" command will now resume the application, as documented. To
disconnect from gdbserver and leave it stopped, use the new "disconnect"
command.
-* d10v `regs' command deprecated
+* d10v, m68hc11 `regs' command deprecated
The `info registers' command has been updated so that it displays the
registers using a format identical to the old `regs' command.
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 0b12de2..6c60abc 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -926,58 +926,165 @@ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi)
}
}
-/* Same as 'info reg' but prints the registers in a different way. */
+
+/* Get and print the register from the given frame. */
static void
-show_regs (char *args, int from_tty)
+m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file,
+ struct frame_info *frame, int regno)
{
- int ccr = read_register (HARD_CCR_REGNUM);
- int i;
- int nr;
-
- printf_filtered ("PC=%04x SP=%04x FP=%04x CCR=%02x %c%c%c%c%c%c%c%c\n",
- (int) read_register (HARD_PC_REGNUM),
- (int) read_register (HARD_SP_REGNUM),
- (int) read_register (SOFT_FP_REGNUM),
- ccr,
- ccr & M6811_S_BIT ? 'S' : '-',
- ccr & M6811_X_BIT ? 'X' : '-',
- ccr & M6811_H_BIT ? 'H' : '-',
- ccr & M6811_I_BIT ? 'I' : '-',
- ccr & M6811_N_BIT ? 'N' : '-',
- ccr & M6811_Z_BIT ? 'Z' : '-',
- ccr & M6811_V_BIT ? 'V' : '-',
- ccr & M6811_C_BIT ? 'C' : '-');
-
- printf_filtered ("D=%04x IX=%04x IY=%04x",
- (int) read_register (HARD_D_REGNUM),
- (int) read_register (HARD_X_REGNUM),
- (int) read_register (HARD_Y_REGNUM));
-
- if (USE_PAGE_REGISTER)
+ LONGEST rval;
+
+ if (regno == HARD_PC_REGNUM || regno == HARD_SP_REGNUM
+ || regno == SOFT_FP_REGNUM || regno == M68HC12_HARD_PC_REGNUM)
+ frame_read_unsigned_register (frame, regno, &rval);
+ else
+ frame_read_signed_register (frame, regno, &rval);
+
+ if (regno == HARD_A_REGNUM || regno == HARD_B_REGNUM
+ || regno == HARD_CCR_REGNUM || regno == HARD_PAGE_REGNUM)
{
- printf_filtered (" Page=%02x",
- (int) read_register (HARD_PAGE_REGNUM));
+ fprintf_filtered (file, "0x%02x ", (unsigned char) rval);
+ if (regno != HARD_CCR_REGNUM)
+ print_longest (file, 'd', 1, rval);
}
- printf_filtered ("\n");
+ else
+ {
+ if (regno == HARD_PC_REGNUM && gdbarch_tdep (gdbarch)->use_page_register)
+ {
+ ULONGEST page;
- nr = 0;
- for (i = SOFT_D1_REGNUM; i < M68HC11_ALL_REGS; i++)
+ frame_read_unsigned_register (frame, HARD_PAGE_REGNUM, &page);
+ fprintf_filtered (file, "0x%02x:%04x ", (unsigned) page,
+ (unsigned) rval);
+ }
+ else
+ {
+ fprintf_filtered (file, "0x%04x ", (unsigned) rval);
+ if (regno != HARD_PC_REGNUM && regno != HARD_SP_REGNUM
+ && regno != SOFT_FP_REGNUM && regno != M68HC12_HARD_PC_REGNUM)
+ print_longest (file, 'd', 1, rval);
+ }
+ }
+
+ if (regno == HARD_CCR_REGNUM)
{
- /* Skip registers which are not defined in the symbol table. */
- if (soft_regs[i].name == 0)
- continue;
-
- printf_filtered ("D%d=%04x",
- i - SOFT_D1_REGNUM + 1,
- (int) read_register (i));
- nr++;
- if ((nr % 8) == 7)
- printf_filtered ("\n");
+ /* CCR register */
+ int C, Z, N, V;
+ unsigned char l = rval & 0xff;
+
+ fprintf_filtered (file, "%c%c%c%c%c%c%c%c ",
+ l & M6811_S_BIT ? 'S' : '-',
+ l & M6811_X_BIT ? 'X' : '-',
+ l & M6811_H_BIT ? 'H' : '-',
+ l & M6811_I_BIT ? 'I' : '-',
+ l & M6811_N_BIT ? 'N' : '-',
+ l & M6811_Z_BIT ? 'Z' : '-',
+ l & M6811_V_BIT ? 'V' : '-',
+ l & M6811_C_BIT ? 'C' : '-');
+ N = (l & M6811_N_BIT) != 0;
+ Z = (l & M6811_Z_BIT) != 0;
+ V = (l & M6811_V_BIT) != 0;
+ C = (l & M6811_C_BIT) != 0;
+
+ /* Print flags following the h8300 */
+ if ((C | Z) == 0)
+ fprintf_filtered (file, "u> ");
+ else if ((C | Z) == 1)
+ fprintf_filtered (file, "u<= ");
+ else if (C == 0)
+ fprintf_filtered (file, "u< ");
+
+ if (Z == 0)
+ fprintf_filtered (file, "!= ");
+ else
+ fprintf_filtered (file, "== ");
+
+ if ((N ^ V) == 0)
+ fprintf_filtered (file, ">= ");
+ else
+ fprintf_filtered (file, "< ");
+
+ if ((Z | (N ^ V)) == 0)
+ fprintf_filtered (file, "> ");
else
- printf_filtered (" ");
+ fprintf_filtered (file, "<= ");
}
- if (nr && (nr % 8) != 7)
- printf_filtered ("\n");
+}
+
+/* Same as 'info reg' but prints the registers in a different way. */
+static void
+m68hc11_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+ struct frame_info *frame, int regno, int cpregs)
+{
+ if (regno >= 0)
+ {
+ const char *name = gdbarch_register_name (gdbarch, regno);
+
+ if (!name || !*name)
+ return;
+
+ fprintf_filtered (file, "%-10s ", name);
+ m68hc11_print_register (gdbarch, file, frame, regno);
+ fprintf_filtered (file, "\n");
+ }
+ else
+ {
+ int i, nr;
+
+ fprintf_filtered (file, "PC=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_PC_REGNUM);
+
+ fprintf_filtered (file, " SP=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_SP_REGNUM);
+
+ fprintf_filtered (file, " FP=");
+ m68hc11_print_register (gdbarch, file, frame, SOFT_FP_REGNUM);
+
+ fprintf_filtered (file, "\nCCR=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_CCR_REGNUM);
+
+ fprintf_filtered (file, "\nD=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_D_REGNUM);
+
+ fprintf_filtered (file, " X=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_X_REGNUM);
+
+ fprintf_filtered (file, " Y=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_Y_REGNUM);
+
+ if (gdbarch_tdep (gdbarch)->use_page_register)
+ {
+ fprintf_filtered (file, "\nPage=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_PAGE_REGNUM);
+ }
+ fprintf_filtered (file, "\n");
+
+ nr = 0;
+ for (i = SOFT_D1_REGNUM; i < M68HC11_ALL_REGS; i++)
+ {
+ /* Skip registers which are not defined in the symbol table. */
+ if (soft_regs[i].name == 0)
+ continue;
+
+ fprintf_filtered (file, "D%d=", i - SOFT_D1_REGNUM + 1);
+ m68hc11_print_register (gdbarch, file, frame, i);
+ nr++;
+ if ((nr % 8) == 7)
+ fprintf_filtered (file, "\n");
+ else
+ fprintf_filtered (file, " ");
+ }
+ if (nr && (nr % 8) != 7)
+ fprintf_filtered (file, "\n");
+ }
+}
+
+/* Same as 'info reg' but prints the registers in a different way. */
+static void
+show_regs (char *args, int from_tty)
+{
+ m68hc11_print_registers_info (current_gdbarch, gdb_stdout,
+ get_current_frame (), -1, 1);
}
static CORE_ADDR
@@ -1412,6 +1519,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
m68hc11_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, m68hc11_register_reggroup_p);
+ set_gdbarch_print_registers_info (gdbarch, m68hc11_print_registers_info);
/* Minsymbol frobbing. */
set_gdbarch_elf_make_msymbol_special (gdbarch,
@@ -1431,6 +1539,8 @@ _initialize_m68hc11_tdep (void)
register_gdbarch_init (bfd_arch_m68hc12, m68hc11_gdbarch_init);
m68hc11_init_reggroups ();
- add_com ("regs", class_vars, show_regs, "Print all registers");
+ deprecate_cmd (add_com ("regs", class_vars, show_regs,
+ "Print all registers"),
+ "info registers");
}