This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 4/7] Get and set PC correctly on aarch64 in multi-arch
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 31 Jul 2015 16:16:38 +0100
- Subject: [PATCH 4/7] Get and set PC correctly on aarch64 in multi-arch
- Authentication-results: sourceware.org; auth=none
- References: <1438355801-25798-1-git-send-email-yao dot qi at linaro dot org>
gdb/gdbserver:
2015-07-31 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (aarch64_get_pc): Get PC register on
both aarch64 and aarch32.
(aarch64_set_pc): Likewise.
---
gdb/gdbserver/linux-aarch64-low.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index e4a41ce..3512ce9 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -155,12 +155,24 @@ extern int debug_threads;
static CORE_ADDR
aarch64_get_pc (struct regcache *regcache)
{
- unsigned long pc;
+ if (register_size (regcache->tdesc, 0) == 8)
+ {
+ unsigned long pc;
+
+ collect_register_by_name (regcache, "pc", &pc);
+ if (debug_threads)
+ debug_printf ("stop pc is %08lx\n", pc);
+ return pc;
+ }
+ else
+ {
+ unsigned int pc;
- collect_register_by_name (regcache, "pc", &pc);
- if (debug_threads)
- debug_printf ("stop pc is %08lx\n", pc);
- return pc;
+ collect_register_by_name (regcache, "pc", &pc);
+ if (debug_threads)
+ debug_printf ("stop pc is %04x\n", pc);
+ return pc;
+ }
}
/* Implementation of linux_target_ops method "set_pc". */
@@ -168,8 +180,16 @@ aarch64_get_pc (struct regcache *regcache)
static void
aarch64_set_pc (struct regcache *regcache, CORE_ADDR pc)
{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
+ if (register_size (regcache->tdesc, 0) == 8)
+ {
+ unsigned long newpc = pc;
+ supply_register_by_name (regcache, "pc", &newpc);
+ }
+ else
+ {
+ unsigned int newpc = pc;
+ supply_register_by_name (regcache, "pc", &newpc);
+ }
}
#define aarch64_breakpoint_len 4
--
1.9.1