This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Get and set PC correctly on aarch64 in multi-arch


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8a7e4587c4e7d78ebbb9bcc0e65bc03f784fde6b

commit 8a7e4587c4e7d78ebbb9bcc0e65bc03f784fde6b
Author: Yao Qi <yao.qi@linaro.org>
Date:   Tue Aug 4 14:34:14 2015 +0100

    Get and set PC correctly on aarch64 in multi-arch
    
    gdb/gdbserver:
    
    2015-08-04  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.

Diff:
---
 gdb/gdbserver/ChangeLog           |  6 ++++++
 gdb/gdbserver/linux-aarch64-low.c | 34 +++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index d652bb3..be13f9b 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,11 @@
 2015-08-04  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.
+
+2015-08-04  Yao Qi  <yao.qi@linaro.org>
+
 	* configure.srv (case aarch64*-*-linux*): Append arm-with-neon.o
 	to srv_regobj and append arm-core.xml arm-vfpv3.xml and
 	arm-with-neon.xml to srv_xmlfiles.
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]