aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMarcin Kościelnicki <koriakin@0x04.net>2015-11-14 21:18:18 +0100
committerMarcin Kościelnicki <koriakin@0x04.net>2016-03-11 11:02:49 +0100
commitc4b3e547d50b01dcf909498119ff6c0af482f2c8 (patch)
treeb6be04ffc60e3c65e7129aa140f9f32876e271bb /gdb
parent37b01f6a13f21f274bf9758ecbf5d9efd6153444 (diff)
downloadgdb-c4b3e547d50b01dcf909498119ff6c0af482f2c8.zip
gdb-c4b3e547d50b01dcf909498119ff6c0af482f2c8.tar.gz
gdb-c4b3e547d50b01dcf909498119ff6c0af482f2c8.tar.bz2
gdb/s390: Fill pseudo register agent expression hooks.
gdb/ChangeLog: * s390-linux-tdep.c (s390_ax_pseudo_register_collect): New function. (s390_ax_pseudo_register_push_stack): New function. (s390_gdbarch_init): Fill ax_pseudo_register_collect and ax_pseudo_register_push_stack hooks.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/s390-linux-tdep.c84
2 files changed, 91 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d0e44ca..febe960 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-11 Marcin Kościelnicki <koriakin@0x04.net>
+
+ * s390-linux-tdep.c (s390_ax_pseudo_register_collect): New function.
+ (s390_ax_pseudo_register_push_stack): New function.
+ (s390_gdbarch_init): Fill ax_pseudo_register_collect and
+ ax_pseudo_register_push_stack hooks.
+
2016-03-10 Simon Marchi <simon.marchi@polymtl.ca>
* data-directory/Makefile.in (PYTHON_FILE_LIST): Install
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 950696e..253d69c 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -559,6 +559,86 @@ s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return default_register_reggroup_p (gdbarch, regnum, group);
}
+/* The "ax_pseudo_register_collect" gdbarch method. */
+
+static int
+s390_ax_pseudo_register_collect (struct gdbarch *gdbarch,
+ struct agent_expr *ax, int regnum)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ if (regnum == tdep->pc_regnum)
+ {
+ ax_reg_mask (ax, S390_PSWA_REGNUM);
+ }
+ else if (regnum == tdep->cc_regnum)
+ {
+ ax_reg_mask (ax, S390_PSWM_REGNUM);
+ }
+ else if (regnum_is_gpr_full (tdep, regnum))
+ {
+ regnum -= tdep->gpr_full_regnum;
+ ax_reg_mask (ax, S390_R0_REGNUM + regnum);
+ ax_reg_mask (ax, S390_R0_UPPER_REGNUM + regnum);
+ }
+ else if (regnum_is_vxr_full (tdep, regnum))
+ {
+ regnum -= tdep->v0_full_regnum;
+ ax_reg_mask (ax, S390_F0_REGNUM + regnum);
+ ax_reg_mask (ax, S390_V0_LOWER_REGNUM + regnum);
+ }
+ else
+ {
+ internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ }
+ return 0;
+}
+
+/* The "ax_pseudo_register_push_stack" gdbarch method. */
+
+static int
+s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
+ struct agent_expr *ax, int regnum)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ if (regnum == tdep->pc_regnum)
+ {
+ ax_reg (ax, S390_PSWA_REGNUM);
+ if (register_size (gdbarch, S390_PSWA_REGNUM) == 4)
+ {
+ ax_zero_ext (ax, 31);
+ }
+ }
+ else if (regnum == tdep->cc_regnum)
+ {
+ ax_reg (ax, S390_PSWM_REGNUM);
+ if (register_size (gdbarch, S390_PSWA_REGNUM) == 4)
+ ax_const_l (ax, 12);
+ else
+ ax_const_l (ax, 44);
+ ax_simple (ax, aop_rsh_unsigned);
+ ax_zero_ext (ax, 2);
+ }
+ else if (regnum_is_gpr_full (tdep, regnum))
+ {
+ regnum -= tdep->gpr_full_regnum;
+ ax_reg (ax, S390_R0_REGNUM + regnum);
+ ax_reg (ax, S390_R0_UPPER_REGNUM + regnum);
+ ax_const_l (ax, 32);
+ ax_simple (ax, aop_lsh);
+ ax_simple (ax, aop_bit_or);
+ }
+ else if (regnum_is_vxr_full (tdep, regnum))
+ {
+ /* Too large to stuff on the stack. */
+ return 1;
+ }
+ else
+ {
+ internal_error (__FILE__, __LINE__, _("invalid regnum"));
+ }
+ return 0;
+}
+
/* A helper for s390_software_single_step, decides if an instruction
is a partial-execution instruction that needs to be executed until
@@ -7918,6 +7998,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_tdesc_pseudo_register_type (gdbarch, s390_pseudo_register_type);
set_tdesc_pseudo_register_reggroup_p (gdbarch,
s390_pseudo_register_reggroup_p);
+ set_gdbarch_ax_pseudo_register_collect (gdbarch,
+ s390_ax_pseudo_register_collect);
+ set_gdbarch_ax_pseudo_register_push_stack
+ (gdbarch, s390_ax_pseudo_register_push_stack);
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
set_gdbarch_register_name (gdbarch, s390_register_name);