/* Target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
- 2011 Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
#include "linux-tdep.h"
#include "s390-tdep.h"
+#include "stap-probe.h"
+#include "ax.h"
+#include "ax-gdb.h"
+#include "user-regs.h"
+#include "cli/cli-utils.h"
+#include <ctype.h>
+
#include "features/s390-linux32.c"
#include "features/s390-linux32v1.c"
#include "features/s390-linux32v2.c"
#include "features/s390x-linux64v1.c"
#include "features/s390x-linux64v2.c"
-
/* The tdep structure. */
struct gdbarch_tdep
S390_R8_REGNUM, S390_R9_REGNUM, S390_R10_REGNUM, S390_R11_REGNUM,
S390_R12_REGNUM, S390_R13_REGNUM, S390_R14_REGNUM, S390_R15_REGNUM,
- /* Linux-specific registers (not mapped). */
+ /* GNU/Linux-specific registers (not mapped). */
-1, -1, -1,
};
/* GPR Uppper Halves. */
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
0x88, -1, -1,
};
0x30, 0x38, 0x40, 0x48,
0x50, 0x58, 0x60, 0x68,
0x70, 0x78, 0x80, 0x88,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
0xd0, -1, -1,
};
/* GPR Uppper Halves. */
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
-1, -1, -1,
};
0x10, 0x14, 0x18, 0x1c,
0x20, 0x24, 0x28, 0x2c,
0x30, 0x34, 0x38, 0x3c,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
-1, -1, -1,
};
/* GPR Uppper Halves. */
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
-1, 4, -1,
};
/* GPR Uppper Halves. */
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
-1, 0, -1,
};
/* GPR Uppper Halves. */
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
- /* Linux-specific optional "registers". */
+ /* GNU/Linux-specific optional "registers". */
-1, -1, 0,
};
}
}
- /* Store return address. */
+ /* Store return PSWA. In 31-bit mode, keep addressing mode bit. */
+ if (word_size == 4)
+ {
+ ULONGEST pswa;
+ regcache_cooked_read_unsigned (regcache, S390_PSWA_REGNUM, &pswa);
+ bp_addr = (bp_addr & 0x7fffffff) | (pswa & 0x80000000);
+ }
regcache_cooked_write_unsigned (regcache, S390_RETADDR_REGNUM, bp_addr);
-
+
/* Store updated stack pointer. */
regcache_cooked_write_unsigned (regcache, S390_SP_REGNUM, sp);
return 0;
}
+/* Implementation of `gdbarch_stap_is_single_operand', as defined in
+ gdbarch.h. */
+
+static int
+s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
+{
+ return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
+ or indirection. */
+ || *s == '%' /* Register access. */
+ || isdigit (*s)); /* Literal number. */
+}
+
/* Set up gdbarch struct. */
static struct gdbarch *
valid_p &= tdesc_numbered_register (feature, tdesc_data,
S390_A0_REGNUM + i, acrs[i]);
- /* Optional Linux-specific "registers". */
+ /* Optional GNU/Linux-specific "registers". */
feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.linux");
if (feature)
{
set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
+ /* SystemTap functions. */
+ set_gdbarch_stap_register_prefix (gdbarch, "%");
+ set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
+ set_gdbarch_stap_register_indirection_suffix (gdbarch, ")");
+ set_gdbarch_stap_is_single_operand (gdbarch, s390_stap_is_single_operand);
+
return gdbarch;
}
/* Hook us into the gdbarch mechanism. */
register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
- /* Initialize the Linux target descriptions. */
+ /* Initialize the GNU/Linux target descriptions. */
initialize_tdesc_s390_linux32 ();
initialize_tdesc_s390_linux32v1 ();
initialize_tdesc_s390_linux32v2 ();