This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Pretty printing for m68k status register
- From: Andreas Schwab <schwab at suse dot de>
- To: gdb-patches at sourceware dot org
- Date: Sat, 30 Jun 2007 19:15:23 +0200
- Subject: Pretty printing for m68k status register
This implements pretty printing of the bits in the m68k status register.
Andreas.
2007-06-30 Andreas Schwab <schwab@suse.de>
* m68k-tdep.c (m68k_ps_type): New.
(m68k_init_types): New.
(m68k_register_type): Use m68k_ps_type for PS register.
(_initialize_m68k_tdep): Call m68k_init_types.
Index: gdb/m68k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68k-tdep.c,v
retrieving revision 1.121
diff -u -a -p -a -u -p -r1.121 gdb/m68k-tdep.c
--- gdb/m68k-tdep.c 30 Jun 2007 15:35:19 -0000 1.121
+++ gdb/m68k-tdep.c 30 Jun 2007 17:11:32 -0000
@@ -69,6 +69,32 @@ m68k_local_breakpoint_from_pc (CORE_ADDR
*lenptr = sizeof (break_insn);
return break_insn;
}
+
+
+/* Type for %ps. */
+struct type *m68k_ps_type;
+
+/* Construct types for ISA-specific registers. */
+static void
+m68k_init_types (void)
+{
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_m68k_ps", 4);
+ append_flags_type_flag (type, 0, "C");
+ append_flags_type_flag (type, 1, "V");
+ append_flags_type_flag (type, 2, "Z");
+ append_flags_type_flag (type, 3, "N");
+ append_flags_type_flag (type, 4, "X");
+ append_flags_type_flag (type, 8, "I0");
+ append_flags_type_flag (type, 9, "I1");
+ append_flags_type_flag (type, 10, "I2");
+ append_flags_type_flag (type, 12, "M");
+ append_flags_type_flag (type, 13, "S");
+ append_flags_type_flag (type, 14, "T0");
+ append_flags_type_flag (type, 15, "T1");
+ m68k_ps_type = type;
+}
/* Return the GDB type object for the "standard" data type of data in
register N. This should be int for D0-D7, SR, FPCONTROL and
@@ -112,6 +138,9 @@ m68k_register_type (struct gdbarch *gdba
if (regnum >= M68K_A0_REGNUM && regnum <= M68K_A0_REGNUM + 7)
return builtin_type_void_data_ptr;
+ if (regnum == M68K_PS_REGNUM)
+ return m68k_ps_type;
+
return builtin_type_int32;
}
@@ -1249,4 +1278,7 @@ void
_initialize_m68k_tdep (void)
{
gdbarch_register (bfd_arch_m68k, m68k_gdbarch_init, m68k_dump_tdep);
+
+ /* Initialize the m68k-specific register types. */
+ m68k_init_types ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."