aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-07-06 16:49:43 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-07-06 16:49:43 +0000
commitf865ee35b75718f7b0a1c75f7cf9167bb40c6f0c (patch)
tree70f71c836e49f8a7e359a63251fca352b335a54b
parent76b83c514f6b202659c8b600b20fe0e107f83f6f (diff)
downloadgdb-f865ee35b75718f7b0a1c75f7cf9167bb40c6f0c.zip
gdb-f865ee35b75718f7b0a1c75f7cf9167bb40c6f0c.tar.gz
gdb-f865ee35b75718f7b0a1c75f7cf9167bb40c6f0c.tar.bz2
gdb/
Code cleanup for the next patch. * arm-linux-nat.c (arm_linux_stopped_data_address): Change variable siginfo_p to siginfo, update its users incl. the linux_nat_get_siginfo call for it. * ia64-linux-nat.c (ia64_linux_stopped_data_address): Likewise. (ia64_linux_stopped_data_address): * linux-nat.c (linux_nat_get_siginfo): Add parameter siginfo, change the return value. * linux-nat.h (linux_nat_get_siginfo): Likewise. * ppc-linux-nat.c (ppc_linux_stopped_data_address): Change variable siginfo_p to siginfo, update its users incl. the linux_nat_get_siginfo call for it.
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/arm-linux-nat.c15
-rw-r--r--gdb/ia64-linux-nat.c11
-rw-r--r--gdb/linux-nat.c11
-rw-r--r--gdb/linux-nat.h6
-rw-r--r--gdb/ppc-linux-nat.c13
6 files changed, 49 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5c434a0..36877b8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
2012-07-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Code cleanup for the next patch.
+ * arm-linux-nat.c (arm_linux_stopped_data_address): Change variable
+ siginfo_p to siginfo, update its users incl. the linux_nat_get_siginfo
+ call for it.
+ * ia64-linux-nat.c (ia64_linux_stopped_data_address): Likewise.
+ (ia64_linux_stopped_data_address):
+ * linux-nat.c (linux_nat_get_siginfo): Add parameter siginfo, change
+ the return value.
+ * linux-nat.h (linux_nat_get_siginfo): Likewise.
+ * ppc-linux-nat.c (ppc_linux_stopped_data_address): Change variable
+ siginfo_p to siginfo, update its users incl. the linux_nat_get_siginfo
+ call for it.
+
+2012-07-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+
PR 14321
* findcmd.c (parse_find_args): New variable pattern_buf_size_need.
Increase buffer sizes to 2x we need, not just 2x of the previous size.
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index f9f6ba5..2485a84 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -1137,24 +1137,29 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
static int
arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
{
- siginfo_t *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
- int slot = siginfo_p->si_errno;
+ siginfo_t siginfo;
+ int slot;
+
+ if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
+ return 0;
/* This must be a hardware breakpoint. */
- 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;
/* We must be able to set hardware watchpoints. */
if (arm_linux_get_hw_watchpoint_count () == 0)
return 0;
+ slot = siginfo.si_errno;
+
/* If we are in a positive slot then we're looking at a breakpoint and not
a watchpoint. */
if (slot >= 0)
return 0;
- *addr_p = (CORE_ADDR) (uintptr_t) siginfo_p->si_addr;
+ *addr_p = (CORE_ADDR) (uintptr_t) siginfo.si_addr;
return 1;
}
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 237f2c7..9b5fbf3 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -649,13 +649,14 @@ static int
ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
{
CORE_ADDR psr;
- siginfo_t *siginfo_p;
+ siginfo_t siginfo;
struct regcache *regcache = get_current_regcache ();
- 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;
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
@@ -663,7 +664,7 @@ ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
for the next instruction. */
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
- *addr_p = (CORE_ADDR)siginfo_p->si_addr;
+ *addr_p = (CORE_ADDR) siginfo.si_addr;
return 1;
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index b82c248..09ab402 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -5187,15 +5187,18 @@ linux_nat_set_prepare_to_resume (struct target_ops *t,
linux_nat_prepare_to_resume = prepare_to_resume;
}
-/* Return the saved siginfo associated with PTID. */
-siginfo_t *
-linux_nat_get_siginfo (ptid_t ptid)
+/* See linux-nat.h. */
+
+int
+linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
{
struct lwp_info *lp = find_lwp_pid (ptid);
gdb_assert (lp != NULL);
- return &lp->siginfo;
+ *siginfo = lp->siginfo;
+
+ return 1;
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index d87f0cf..52549da 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -197,8 +197,10 @@ void linux_nat_set_prepare_to_resume (struct target_ops *,
to another. */
void linux_nat_switch_fork (ptid_t new_ptid);
-/* Return the saved siginfo associated with PTID. */
-siginfo_t *linux_nat_get_siginfo (ptid_t ptid);
+/* Store the saved siginfo associated with PTID in *SIGINFO.
+ Return 1 if it was retrieved successfully, 0 otherwise (*SIGINFO is
+ uninitialized in such case). */
+int linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo);
/* Set alternative SIGTRAP-like events recognizer. */
void linux_nat_set_status_is_event (struct target_ops *t,
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 45cdd73..14f4ecb 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -2221,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)
{
- siginfo_t *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 ())
@@ -2235,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);
@@ -2252,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;
}