This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] m68k-tdep.c: Rename %mbb to %mbo.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 26 Sep 2007 11:46:01 -0700
- Subject: [patch] m68k-tdep.c: Rename %mbb to %mbo.
Hi,
Attached is a patch to accept %mbb as an alias for %mbo, which is a
CPU register in fido, a m68k variant.
I recently renamed %mbb to %mbo in binutils while accepting %mbb for
backward compatibility. This patch is the gdb version of the backward
compatibility. Namely, with this patch, gdb accetps %mbb as an alias
for %mbo.
Tested by running the gdb testsuite. OK to apply?
Kazu Hirata
2007-09-26 Kazu Hirata <kazu@codesourcery.com>
* m68k-tdep.c (value_of_m68k_user_reg, mbb_regname): New.
(m68k_gdbarch_init): Register a user register "mbb".
Index: gdb/m68k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68k-tdep.c,v
retrieving revision 1.123
diff -u -d -p -r1.123 m68k-tdep.c
--- gdb/m68k-tdep.c 23 Aug 2007 18:08:35 -0000 1.123
+++ gdb/m68k-tdep.c 26 Sep 2007 18:43:01 -0000
@@ -1054,6 +1054,20 @@ m68k_svr4_init_abi (struct gdbarch_info
tdep->struct_value_regnum = M68K_A0_REGNUM;
}
+/* Look up a register value for a register name BATON by converting
+ BATON to a standard name (either a built-in register name or one in
+ a target description. */
+
+static struct value *
+value_of_m68k_user_reg (struct frame_info *frame, const void *baton)
+{
+ const char *regname = baton;
+ int regnum = user_reg_map_name_to_regnum (get_frame_arch (frame),
+ regname, strlen (regname));
+ return value_of_register (regnum, frame);
+}
+
+static const char *mbb_regname = "mbo";
/* Function: m68k_gdbarch_init
Initializer function for the m68k gdbarch vector.
@@ -1069,6 +1083,7 @@ m68k_gdbarch_init (struct gdbarch_info i
int i;
enum m68k_flavour flavour = m68k_no_flavour;
int has_fp = 1;
+ int has_mbo = 0;
const struct floatformat **long_double_format = floatformats_m68881_ext;
/* Check any target description for validity. */
@@ -1096,7 +1111,11 @@ m68k_gdbarch_init (struct gdbarch_info i
feature = tdesc_find_feature (info.target_desc,
"org.gnu.gdb.fido.core");
if (feature != NULL)
- flavour = m68k_fido_flavour;
+ {
+ flavour = m68k_fido_flavour;
+ if (tdesc_unnumbered_register (feature, "mbo"))
+ has_mbo = 1;
+ }
}
if (feature == NULL)
@@ -1257,6 +1276,9 @@ m68k_gdbarch_init (struct gdbarch_info i
if (tdesc_data)
tdesc_use_registers (gdbarch, tdesc_data);
+ if (has_mbo)
+ user_reg_add (gdbarch, "mbb", value_of_m68k_user_reg, mbb_regname);
+
return gdbarch;
}