| Index: gdb/ppc-linux-nat.c
|
| diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
| index e42fa62de5e3cc012dd2ab47abcfb9be5827a312..14f4ecbdb48eb1d82aa766a0326b183537133f97 100644
|
| --- a/gdb/ppc-linux-nat.c
|
| +++ b/gdb/ppc-linux-nat.c
|
| @@ -593,9 +593,10 @@ fetch_register (struct regcache *regcache, int tid, int regno)
|
| bytes_transferred < register_size (gdbarch, regno);
|
| bytes_transferred += sizeof (long))
|
| {
|
| + long l;
|
| +
|
| errno = 0;
|
| - *(long *) &buf[bytes_transferred]
|
| - = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
|
| + l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
|
| regaddr += sizeof (long);
|
| if (errno != 0)
|
| {
|
| @@ -604,6 +605,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
|
| gdbarch_register_name (gdbarch, regno), regno);
|
| perror_with_name (message);
|
| }
|
| + memcpy (&buf[bytes_transferred], &l, sizeof (l));
|
| }
|
|
|
| /* Now supply the register. Keep in mind that the regcache's idea
|
| @@ -1073,9 +1075,11 @@ store_register (const struct regcache *regcache, int tid, int regno)
|
|
|
| for (i = 0; i < bytes_to_transfer; i += sizeof (long))
|
| {
|
| + long l;
|
| +
|
| + memcpy (&l, &buf[i], sizeof (l));
|
| errno = 0;
|
| - ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr,
|
| - *(long *) &buf[i]);
|
| + ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
|
| regaddr += sizeof (long);
|
|
|
| if (errno == EIO
|
| @@ -1347,7 +1351,8 @@ store_ppc_registers (const struct regcache *regcache, int tid)
|
| }
|
|
|
| /* Fetch the AT_HWCAP entry from the aux vector. */
|
| -unsigned long ppc_linux_get_hwcap (void)
|
| +static unsigned long
|
| +ppc_linux_get_hwcap (void)
|
| {
|
| CORE_ADDR field;
|
|
|
| @@ -1416,17 +1421,20 @@ have_ptrace_booke_interface (void)
|
| /* Check for kernel support for BOOKE debug registers. */
|
| if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &booke_debug_info) >= 0)
|
| {
|
| - have_ptrace_booke_interface = 1;
|
| - max_slots_number = booke_debug_info.num_instruction_bps
|
| - + booke_debug_info.num_data_bps
|
| - + booke_debug_info.num_condition_regs;
|
| - }
|
| - else
|
| - {
|
| - /* Old school interface and no BOOKE debug registers support. */
|
| - have_ptrace_booke_interface = 0;
|
| - memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
|
| + /* Check whether ptrace BOOKE interface is functional and
|
| + provides any supported feature. */
|
| + if (booke_debug_info.features != 0)
|
| + {
|
| + have_ptrace_booke_interface = 1;
|
| + max_slots_number = booke_debug_info.num_instruction_bps
|
| + + booke_debug_info.num_data_bps
|
| + + booke_debug_info.num_condition_regs;
|
| + return have_ptrace_booke_interface;
|
| + }
|
| }
|
| + /* Old school interface and no BOOKE debug registers support. */
|
| + have_ptrace_booke_interface = 0;
|
| + memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
|
| }
|
|
|
| return have_ptrace_booke_interface;
|
| @@ -1456,7 +1464,7 @@ ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
|
| if (type == bp_hardware_watchpoint || type == bp_read_watchpoint
|
| || type == bp_access_watchpoint || type == bp_watchpoint)
|
| {
|
| - if (cnt > total_hw_wp)
|
| + if (cnt + ot > total_hw_wp)
|
| return -1;
|
| }
|
| else if (type == bp_hardware_breakpoint)
|
| @@ -2151,9 +2159,9 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
|
| }
|
|
|
| static void
|
| -ppc_linux_new_thread (ptid_t ptid)
|
| +ppc_linux_new_thread (struct lwp_info *lp)
|
| {
|
| - int tid = TIDGET (ptid);
|
| + int tid = TIDGET (lp->ptid);
|
|
|
| if (have_ptrace_booke_interface ())
|
| {
|
| @@ -2213,12 +2221,13 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent)
|
| static int
|
| ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
|
| {
|
| - struct siginfo *siginfo_p;
|
| + siginfo_t siginfo;
|
|
|
| - siginfo_p = linux_nat_get_siginfo (inferior_ptid);
|
| + if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
|
| + return 0;
|
|
|
| - if (siginfo_p->si_signo != SIGTRAP
|
| - || (siginfo_p->si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */)
|
| + if (siginfo.si_signo != SIGTRAP
|
| + || (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */)
|
| return 0;
|
|
|
| if (have_ptrace_booke_interface ())
|
| @@ -2227,7 +2236,7 @@ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
|
| struct thread_points *t;
|
| struct hw_break_tuple *hw_breaks;
|
| /* The index (or slot) of the *point is passed in the si_errno field. */
|
| - int slot = siginfo_p->si_errno;
|
| + int slot = siginfo.si_errno;
|
|
|
| t = booke_find_thread_points_by_tid (TIDGET (inferior_ptid), 0);
|
|
|
| @@ -2244,7 +2253,7 @@ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
|
| }
|
| }
|
|
|
| - *addr_p = (CORE_ADDR) (uintptr_t) siginfo_p->si_addr;
|
| + *addr_p = (CORE_ADDR) (uintptr_t) siginfo.si_addr;
|
| return 1;
|
| }
|
|
|
|
|