]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Replace some $ARCH_{get,set}_pc with linux_{get,set}_pc_64bit
authorYao Qi <yao.qi@linaro.org>
Mon, 18 Jan 2016 15:03:18 +0000 (15:03 +0000)
committerYao Qi <yao.qi@linaro.org>
Mon, 18 Jan 2016 15:03:18 +0000 (15:03 +0000)
This patch is the follow-up of
https://sourceware.org/ml/gdb-patches/2016-01/msg00164.html to provide
linux_{get,set}_pc_64bit functions.

Rebuild GDBserver with tilegx-linux-gcc.  Not tested.

I think about pc in Tile-GX a little bit.  Looks current Tile-GX
supports debugging 32-bit program (multi-arch), but PC is always
64-bit.  See this thread
https://sourceware.org/ml/gdb-patches/2013-02/msg00113.html
and GDBserver reads PC as 64-bit through ptrace.  However, if
the inferior is 32-bit, the PC in the target description and
regcache is 32-bit, so only 32-bit contents are sent back GDB.
Anyway, Tile-GX GDBserver may have some problems here, but this
patch doesn't change anything.

gdb/gdbserver:

2016-01-18  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_set_pc_64bit): New function.
(linux_get_pc_64bit): New function.
* linux-low.h (linux_set_pc_64bit, linux_get_pc_64bit):
Declare.
* linux-sparc-low.c (debug_threads): Remove declaration.
(sparc_get_pc): Remove.
(the_low_target): Use linux_get_pc_64bit instead of
sparc_get_pc.
* linux-tile-low.c (tile_get_pc, tile_set_pc): Remove.
(the_low_target): Use linux_get_pc_64bit and
linux_set_pc_64bit.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/gdbserver/linux-low.h
gdb/gdbserver/linux-sparc-low.c
gdb/gdbserver/linux-tile-low.c

index 9dc7c2f9131b2123db24cc0cdeac04927de83c69..4eb92dbf9d695db275853ba1f0d0ce8b0d0dff33 100644 (file)
@@ -1,3 +1,17 @@
+2016-01-18  Yao Qi  <yao.qi@linaro.org>
+
+       * linux-low.c (linux_set_pc_64bit): New function.
+       (linux_get_pc_64bit): New function.
+       * linux-low.h (linux_set_pc_64bit, linux_get_pc_64bit):
+       Declare.
+       * linux-sparc-low.c (debug_threads): Remove declaration.
+       (sparc_get_pc): Remove.
+       (the_low_target): Use linux_get_pc_64bit instead of
+       sparc_get_pc.
+       * linux-tile-low.c (tile_get_pc, tile_set_pc): Remove.
+       (the_low_target): Use linux_get_pc_64bit and
+       linux_set_pc_64bit.
+
 2016-01-18  Yao Qi  <yao.qi@linaro.org>
 
        * linux-arm-low.c (debug_threads): Remove declaration.
index 8f5ab0bb28c5eb0c262eff21c6be97957ff3a8a6..1f3fc0825f6de8b7f95d7233a5f3658baf2db633 100644 (file)
@@ -7283,6 +7283,32 @@ linux_get_pc_32bit (struct regcache *regcache)
   return pc;
 }
 
+/* Default implementation of linux_target_ops method "set_pc" for
+   64-bit pc register which is literally named "pc".  */
+
+void
+linux_set_pc_64bit (struct regcache *regcache, CORE_ADDR pc)
+{
+  uint64_t newpc = pc;
+
+  supply_register_by_name (regcache, "pc", &newpc);
+}
+
+/* Default implementation of linux_target_ops method "get_pc" for
+   64-bit pc register which is literally named "pc".  */
+
+CORE_ADDR
+linux_get_pc_64bit (struct regcache *regcache)
+{
+  uint64_t pc;
+
+  collect_register_by_name (regcache, "pc", &pc);
+  if (debug_threads)
+    debug_printf ("stop pc is 0x%" PRIx64 "\n", pc);
+  return pc;
+}
+
+
 static struct target_ops linux_target_ops = {
   linux_create_inferior,
   linux_post_create_inferior,
index 98a331d462109fd7897dac61ca35dfe73fe90de6..4845862df7ffb746e187c0662799ada62b4899e4 100644 (file)
@@ -395,6 +395,9 @@ void initialize_low_arch (void);
 void linux_set_pc_32bit (struct regcache *regcache, CORE_ADDR pc);
 CORE_ADDR linux_get_pc_32bit (struct regcache *regcache);
 
+void linux_set_pc_64bit (struct regcache *regcache, CORE_ADDR pc);
+CORE_ADDR linux_get_pc_64bit (struct regcache *regcache);
+
 /* From thread-db.c  */
 int thread_db_init (void);
 void thread_db_detach (struct process_info *);
index 1e82ec57348cd61f3e73767cc3e6b7ac6cc9a71f..70c5c9311f3e72b27c207a605230ee10c6371299 100644 (file)
@@ -223,18 +223,6 @@ sparc_store_fpregset (struct regcache *regcache, const void *buf)
       supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
 }
 
-extern int debug_threads;
-
-static CORE_ADDR
-sparc_get_pc (struct regcache *regcache)
-{
-  unsigned long pc;
-  collect_register_by_name (regcache, "pc", &pc);
-  if (debug_threads)
-    debug_printf ("stop pc is %08lx\n", pc);
-  return pc;
-}
-
 static const gdb_byte sparc_breakpoint[INSN_SIZE] = {
   0x91, 0xd0, 0x20, 0x01
 };
@@ -315,7 +303,7 @@ struct linux_target_ops the_low_target = {
   sparc_cannot_fetch_register,
   sparc_cannot_store_register,
   NULL, /* fetch_register */
-  sparc_get_pc,
+  linux_get_pc_64bit,
   /* No sparc_set_pc is needed.  */
   NULL,
   NULL, /* breakpoint_kind_from_pc */
index aaaa5c7ef77f733114915ab36106cca23ce55347..45d63d63f16fa419cdd69d5896aab7178d1610be 100644 (file)
@@ -68,23 +68,6 @@ tile_cannot_store_register (int regno)
     return 1;
 }
 
-static CORE_ADDR
-tile_get_pc (struct regcache *regcache)
-{
-  unsigned long pc;
-
-  collect_register_by_name (regcache, "pc", &pc);
-  return pc;
-}
-
-static void
-tile_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
-  unsigned long newpc = pc;
-
-  supply_register_by_name (regcache, "pc", &newpc);
-}
-
 static uint64_t tile_breakpoint = 0x400b3cae70166000ULL;
 #define tile_breakpoint_len 8
 
@@ -197,8 +180,8 @@ struct linux_target_ops the_low_target =
   tile_cannot_fetch_register,
   tile_cannot_store_register,
   NULL,
-  tile_get_pc,
-  tile_set_pc,
+  linux_get_pc_64bit,
+  linux_set_pc_64bit,
   NULL, /* breakpoint_kind_from_pc */
   tile_sw_breakpoint_from_kind,
   NULL,