+2016-01-18 Yao Qi <yao.qi@linaro.org>
+
+ * linux-arm-low.c (debug_threads): Remove declaration.
+ (arm_get_pc, arm_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-bfin-low.c (bfin_get_pc, bfin_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-cris-low.c (debug_threads): Remove declaration.
+ (cris_get_pc, cris_set_pc,): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-crisv32-low.c (debug_threads): Remove declaration.
+ (cris_get_pc, cris_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-low.c: Include inttypes.h.
+ (linux_get_pc_32bit, linux_set_pc_32bit): New functions.
+ * linux-low.h (linux_get_pc_32bit, linux_set_pc_32bit): Declare.
+ * linux-m32r-low.c (m32r_get_pc, m32r_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-m68k-low.c (m68k_get_pc, m68k_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-nios2-low.c (nios2_get_pc, nios2_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-sh-low.c (sh_get_pc, sh_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+ * linux-xtensa-low.c (xtensa_get_pc, xtensa_set_pc): Remove.
+ (the_low_target): Use linux_get_pc_32bit and
+ linux_set_pc_32bit.
+
2016-01-18 Gary Benson <gbenson@redhat.com>
* configure.ac (AC_FUNC_FORK): New check.
arm_store_vfpregset_num (regcache, buf, num);
}
-extern int debug_threads;
-
-static CORE_ADDR
-arm_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 void
-arm_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
/* Wrapper of arm_is_thumb_mode for get_next_pcs. */
static int
get_next_pcs_is_thumb (struct arm_get_next_pcs *self)
arm_cannot_fetch_register,
arm_cannot_store_register,
NULL, /* fetch_register */
- arm_get_pc,
- arm_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
arm_breakpoint_kind_from_pc,
arm_sw_breakpoint_from_kind,
arm_gdbserver_get_next_pcs,
return (regno >= bfin_num_regs);
}
-static CORE_ADDR
-bfin_get_pc (struct regcache *regcache)
-{
- unsigned long pc;
-
- collect_register_by_name (regcache, "pc", &pc);
-
- return pc;
-}
-
-static void
-bfin_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
-
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
#define bfin_breakpoint_len 2
static const gdb_byte bfin_breakpoint[bfin_breakpoint_len] = {0xa1, 0x00};
bfin_cannot_fetch_register,
bfin_cannot_store_register,
NULL, /* fetch_register */
- bfin_get_pc,
- bfin_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
bfin_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
return (regno >= cris_num_regs);
}
-extern int debug_threads;
-
-static CORE_ADDR
-cris_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 void
-cris_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
static const unsigned short cris_breakpoint = 0xe938;
#define cris_breakpoint_len 2
cris_cannot_fetch_register,
cris_cannot_store_register,
NULL, /* fetch_register */
- cris_get_pc,
- cris_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
cris_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
};
-extern int debug_threads;
-
-static CORE_ADDR
-cris_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 void
-cris_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
static const unsigned short cris_breakpoint = 0xe938;
#define cris_breakpoint_len 2
NULL,
NULL,
NULL, /* fetch_register */
- cris_get_pc,
- cris_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
cris_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
#include "filestuff.h"
#include "tracepoint.h"
#include "hostio.h"
+#include <inttypes.h>
#ifndef ELFMAG0
/* Don't include <linux/elf.h> here. If it got included by gdb_proc_service.h
then ELFMAG0 will have been defined. If it didn't get included by
return linux_breakpoint_kind_from_pc (pcptr);
}
+/* Default implementation of linux_target_ops method "set_pc" for
+ 32-bit pc register which is literally named "pc". */
+
+void
+linux_set_pc_32bit (struct regcache *regcache, CORE_ADDR pc)
+{
+ uint32_t newpc = pc;
+
+ supply_register_by_name (regcache, "pc", &newpc);
+}
+
+/* Default implementation of linux_target_ops method "get_pc" for
+ 32-bit pc register which is literally named "pc". */
+
+CORE_ADDR
+linux_get_pc_32bit (struct regcache *regcache)
+{
+ uint32_t pc;
+
+ collect_register_by_name (regcache, "pc", &pc);
+ if (debug_threads)
+ debug_printf ("stop pc is 0x%" PRIx32 "\n", pc);
+ return pc;
+}
+
static struct target_ops linux_target_ops = {
linux_create_inferior,
linux_post_create_inferior,
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);
+
/* From thread-db.c */
int thread_db_init (void);
void thread_db_detach (struct process_info *);
return (regno >= m32r_num_regs);
}
-static CORE_ADDR
-m32r_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 void
-m32r_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
static const unsigned short m32r_breakpoint = 0x10f1;
#define m32r_breakpoint_len 2
m32r_cannot_fetch_register,
m32r_cannot_store_register,
NULL, /* fetch_register */
- m32r_get_pc,
- m32r_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_from_pc */
m32r_sw_breakpoint_from_kind,
NULL,
return m68k_breakpoint;
}
-static CORE_ADDR
-m68k_get_pc (struct regcache *regcache)
-{
- unsigned long pc;
-
- collect_register_by_name (regcache, "pc", &pc);
- return pc;
-}
-
-static void
-m68k_set_pc (struct regcache *regcache, CORE_ADDR value)
-{
- unsigned long newpc = value;
-
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
static int
m68k_breakpoint_at (CORE_ADDR pc)
{
m68k_cannot_fetch_register,
m68k_cannot_store_register,
NULL, /* fetch_register */
- m68k_get_pc,
- m68k_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
m68k_sw_breakpoint_from_kind,
NULL,
return 0;
}
-/* Implement the get_pc linux_target_ops method. */
-
-static CORE_ADDR
-nios2_get_pc (struct regcache *regcache)
-{
- union nios2_register pc;
-
- collect_register_by_name (regcache, "pc", pc.buf);
- return pc.reg32;
-}
-
-/* Implement the set_pc linux_target_ops method. */
-
-static void
-nios2_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- union nios2_register newpc;
-
- newpc.reg32 = pc;
- supply_register_by_name (regcache, "pc", newpc.buf);
-}
-
/* Breakpoint support. Also see comments on nios2_breakpoint_from_pc
in nios2-tdep.c. */
nios2_cannot_fetch_register,
nios2_cannot_store_register,
NULL,
- nios2_get_pc,
- nios2_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
nios2_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
return 0;
}
-static CORE_ADDR
-sh_get_pc (struct regcache *regcache)
-{
- unsigned long pc;
- collect_register_by_name (regcache, "pc", &pc);
- return pc;
-}
-
-static void
-sh_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
/* Correct in either endianness, obviously. */
static const unsigned short sh_breakpoint = 0xc3c3;
#define sh_breakpoint_len 2
sh_cannot_fetch_register,
sh_cannot_store_register,
NULL, /* fetch_register */
- sh_get_pc,
- sh_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
sh_sw_breakpoint_from_kind,
NULL,
return xtensa_breakpoint;
}
-static CORE_ADDR
-xtensa_get_pc (struct regcache *regcache)
-{
- unsigned long pc;
-
- collect_register_by_name (regcache, "pc", &pc);
- return pc;
-}
-
-static void
-xtensa_set_pc (struct regcache *regcache, CORE_ADDR pc)
-{
- unsigned long newpc = pc;
- supply_register_by_name (regcache, "pc", &newpc);
-}
-
static int
xtensa_breakpoint_at (CORE_ADDR where)
{
0,
0,
NULL, /* fetch_register */
- xtensa_get_pc,
- xtensa_set_pc,
+ linux_get_pc_32bit,
+ linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
xtensa_sw_breakpoint_from_kind,
NULL,