This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[COMMITTED PATCH] rl78: Create a flags type for the psw register
- From: Kevin Buettner <kevinb at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 1 Jul 2015 17:43:51 -0700
- Subject: [COMMITTED PATCH] rl78: Create a flags type for the psw register
- Authentication-results: sourceware.org; auth=none
For the Renesas rl78 architecture, associate a flags type with the PSW
register. This will cause symbolic flags to be printed when using
the "info registers" command.
gdb/ChangeLog:
* rl78-tdep.c (struct gdbarch_tdep): Add new field, rl78_psw_type.
(rl78_register_type): Add case for RL78_PSW_REGNUM.
(rl78_gdbarch_init): Initialize rl78_psw_type.
---
gdb/ChangeLog | 6 ++++++
gdb/rl78-tdep.c | 15 ++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7c3200a..d0fe97f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-01 Kevin Buettner <kevinb@redhat.com>
+
+ * rl78-tdep.c (struct gdbarch_tdep): Add new field, rl78_psw_type.
+ (rl78_register_type): Add case for RL78_PSW_REGNUM.
+ (rl78_gdbarch_init): Initialize rl78_psw_type.
+
2015-07-01 Patrick Palka <patrick@parcs.ath.cx>
* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 3be2579..a5861d8 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -222,7 +222,8 @@ struct gdbarch_tdep
*rl78_uint32,
*rl78_int32,
*rl78_data_pointer,
- *rl78_code_pointer;
+ *rl78_code_pointer,
+ *rl78_psw_type;
};
/* This structure holds the results of a prologue analysis. */
@@ -271,6 +272,8 @@ rl78_register_type (struct gdbarch *gdbarch, int reg_nr)
return tdep->rl78_code_pointer;
else if (reg_nr == RL78_RAW_PC_REGNUM)
return tdep->rl78_uint32;
+ else if (reg_nr == RL78_PSW_REGNUM)
+ return (tdep->rl78_psw_type);
else if (reg_nr <= RL78_MEM_REGNUM
|| (RL78_X_REGNUM <= reg_nr && reg_nr <= RL78_H_REGNUM)
|| (RL78_BANK0_R0_REGNUM <= reg_nr
@@ -1418,6 +1421,16 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
TYPE_TARGET_TYPE (tdep->rl78_code_pointer) = tdep->rl78_void;
TYPE_UNSIGNED (tdep->rl78_code_pointer) = 1;
+ tdep->rl78_psw_type = arch_flags_type (gdbarch, "builtin_type_rl78_psw", 1);
+ append_flags_type_flag (tdep->rl78_psw_type, 0, "CY");
+ append_flags_type_flag (tdep->rl78_psw_type, 1, "ISP0");
+ append_flags_type_flag (tdep->rl78_psw_type, 2, "ISP1");
+ append_flags_type_flag (tdep->rl78_psw_type, 3, "RBS0");
+ append_flags_type_flag (tdep->rl78_psw_type, 4, "AC");
+ append_flags_type_flag (tdep->rl78_psw_type, 5, "RBS1");
+ append_flags_type_flag (tdep->rl78_psw_type, 6, "Z");
+ append_flags_type_flag (tdep->rl78_psw_type, 7, "IE");
+
/* Registers. */
set_gdbarch_num_regs (gdbarch, RL78_NUM_REGS);
set_gdbarch_num_pseudo_regs (gdbarch, RL78_NUM_PSEUDO_REGS);