aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-02-28 05:57:45 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-02-28 05:57:45 +0000
commit6fe305f7fb813317dced51a909bc3c8a7b164689 (patch)
treeb8880c4cc0cb937e7e4ee5e0f6dd2419e17d8adb /gdb
parent5b0a002e223d8104d0f93380f696fd5cb023014a (diff)
downloadgdb-6fe305f7fb813317dced51a909bc3c8a7b164689.zip
gdb-6fe305f7fb813317dced51a909bc3c8a7b164689.tar.gz
gdb-6fe305f7fb813317dced51a909bc3c8a7b164689.tar.bz2
ChangeLog:
* regformats/reg-ppc.dat: Rename "ps" to "msr". * regformats/reg-ppc64.dat: Likewise. gdbserver/ChangeLog: * configure.srv [powerpc64-*-linux*]: Add all files mentioned for powerpc-*-linux* to srv_regobj and reg_xmlfiles. * linux-ppc-low.c (ppc_get_pc): Support bi-arch operation. (ppc_set_pc): Likewise. (ppc_arch_setup): New function. (ppc_fill_gregset): Call ppc_collect_ptrace_register instead of collect_register. (the_low_target): Use ppc_arch_setup as arch_setup initializer.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbserver/ChangeLog11
-rw-r--r--gdb/gdbserver/configure.srv11
-rw-r--r--gdb/gdbserver/linux-ppc-low.c81
-rw-r--r--gdb/regformats/reg-ppc.dat2
-rw-r--r--gdb/regformats/reg-ppc64.dat2
6 files changed, 82 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 63ca325..39bda0b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2008-02-28 Ulrich Weigand <uweigand@de.ibm.com>
+ * regformats/reg-ppc.dat: Rename "ps" to "msr".
+ * regformats/reg-ppc64.dat: Likewise.
+
+2008-02-28 Ulrich Weigand <uweigand@de.ibm.com>
+
* features/Makefile (%.dat): Emit xmltarget statement.
* regformats/regdat.sh: Support xmltarget and xmlarch statments.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 84df67f..a59668c 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,16 @@
2008-02-28 Ulrich Weigand <uweigand@de.ibm.com>
+ * configure.srv [powerpc64-*-linux*]: Add all files mentioned for
+ powerpc-*-linux* to srv_regobj and reg_xmlfiles.
+ * linux-ppc-low.c (ppc_get_pc): Support bi-arch operation.
+ (ppc_set_pc): Likewise.
+ (ppc_arch_setup): New function.
+ (ppc_fill_gregset): Call ppc_collect_ptrace_register instead
+ of collect_register.
+ (the_low_target): Use ppc_arch_setup as arch_setup initializer.
+
+2008-02-28 Ulrich Weigand <uweigand@de.ibm.com>
+
* configure.srv [powerpc64-*-linux*]: Use linux-ppc-low.o
instead of linux-ppc64-low.o.
* linux-ppc64-low.c: Remove file.
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 5435333..c5e5552 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -106,12 +106,17 @@ case "${target}" in
srv_linux_usrregs=yes
srv_linux_thread_db=yes
;;
- powerpc64-*-linux*) srv_regobj="reg-ppc64.o powerpc-64.o"
+ powerpc64-*-linux*) srv_regobj="reg-ppc.o powerpc-32.o powerpc-e500.o"
+ srv_regobj="${srv_regobj} reg-ppc64.o powerpc-64.o"
srv_tgtobj="linux-low.o linux-ppc-low.o"
- srv_xmlfiles="rs6000/powerpc-64.xml"
+ srv_xmlfiles="rs6000/powerpc-32.xml"
srv_xmlfiles="${srv_xmlfiles} rs6000/power-altivec.xml"
- srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml"
+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml"
srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml"
+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-e500.xml"
+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml"
+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64.xml"
+ srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index a1ade34..8eb6b1f 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -138,18 +138,65 @@ ppc_supply_ptrace_register (int regno, const char *buf)
static CORE_ADDR
ppc_get_pc (void)
{
- unsigned long pc;
-
- collect_register_by_name ("pc", &pc);
- return (CORE_ADDR) pc;
+ if (register_size (0) == 4)
+ {
+ unsigned int pc;
+ collect_register_by_name ("pc", &pc);
+ return (CORE_ADDR) pc;
+ }
+ else
+ {
+ unsigned long pc;
+ collect_register_by_name ("pc", &pc);
+ return (CORE_ADDR) pc;
+ }
}
static void
ppc_set_pc (CORE_ADDR pc)
{
- unsigned long newpc = pc;
+ if (register_size (0) == 4)
+ {
+ unsigned int newpc = pc;
+ supply_register_by_name ("pc", &newpc);
+ }
+ else
+ {
+ unsigned long newpc = pc;
+ supply_register_by_name ("pc", &newpc);
+ }
+}
+
+static void
+ppc_arch_setup (void)
+{
+#ifdef __powerpc64__
+ long msr;
- supply_register_by_name ("pc", &newpc);
+ /* On a 64-bit host, assume 64-bit inferior process. */
+#ifdef __ALTIVEC__
+ init_registers_powerpc_64 ();
+#else
+ init_registers_ppc64 ();
+#endif
+
+ /* Only if the high bit of the MSR is set, we actually have
+ a 64-bit inferior. */
+ collect_register_by_name ("msr", &msr);
+ if (msr < 0)
+ return;
+#endif
+
+ /* OK, we have a 32-bit inferior. */
+#ifdef __ALTIVEC__
+ init_registers_powerpc_32 ();
+#else
+#ifdef __SPE__
+ init_registers_powerpc_e500 ();
+#else
+ init_registers_ppc ();
+#endif
+#endif
}
/* Correct in either endianness.
@@ -179,10 +226,10 @@ static void ppc_fill_gregset (void *buf)
int i;
for (i = 0; i < 32; i++)
- collect_register (i, (char *) buf + ppc_regmap[i]);
+ ppc_collect_ptrace_register (i, (char *) buf + ppc_regmap[i]);
for (i = 64; i < 70; i++)
- collect_register (i, (char *) buf + ppc_regmap[i]);
+ ppc_collect_ptrace_register (i, (char *) buf + ppc_regmap[i]);
}
#ifdef __ALTIVEC__
@@ -285,23 +332,7 @@ struct regset_info target_regsets[] = {
};
struct linux_target_ops the_low_target = {
-#ifdef __powerpc64__
-#ifdef __ALTIVEC__
- init_registers_powerpc_64,
-#else
- init_registers_ppc64,
-#endif
-#else
-#ifdef __ALTIVEC__
- init_registers_powerpc_32,
-#else
-#ifdef __SPE__
- init_registers_powerpc_e500,
-#else
- init_registers_ppc,
-#endif
-#endif
-#endif
+ ppc_arch_setup,
ppc_num_regs,
ppc_regmap,
ppc_cannot_fetch_register,
diff --git a/gdb/regformats/reg-ppc.dat b/gdb/regformats/reg-ppc.dat
index d7f9b88..2337d45 100644
--- a/gdb/regformats/reg-ppc.dat
+++ b/gdb/regformats/reg-ppc.dat
@@ -67,7 +67,7 @@ expedite:r1,pc
64:f31
32:pc
-32:ps
+32:msr
32:cr
32:lr
diff --git a/gdb/regformats/reg-ppc64.dat b/gdb/regformats/reg-ppc64.dat
index 281432a..16d7440 100644
--- a/gdb/regformats/reg-ppc64.dat
+++ b/gdb/regformats/reg-ppc64.dat
@@ -67,7 +67,7 @@ expedite:r1,pc
64:f31
64:pc
-64:ps
+64:msr
32:cr
64:lr