aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-07-27 20:51:40 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-07-27 20:51:40 +0000
commit26ab7092a2a92cb00adbad2f34bd104cedb41b87 (patch)
treefc0c5ed01744e0bc74775f5d9f464bec4fa51c1f /gdb/linux-nat.c
parent283e6a52fcfdaaaeae882884a5b848e44249f324 (diff)
downloadgdb-26ab7092a2a92cb00adbad2f34bd104cedb41b87.zip
gdb-26ab7092a2a92cb00adbad2f34bd104cedb41b87.tar.gz
gdb-26ab7092a2a92cb00adbad2f34bd104cedb41b87.tar.bz2
gdb/
* ia64-linux-nat.c (ia64_linux_status_is_event): New function. (_initialize_ia64_linux_nat): Install it. * linux-nat.c (sigtrap_is_event, linux_nat_status_is_event) (linux_nat_set_status_is_event): New. (stop_wait_callback, count_events_callback, select_event_lwp_callback) cancel_breakpoints_callback, linux_nat_filter_event) (linux_nat_wait_1): Use linux_nat_status_is_event. * linux-nat.h (linux_nat_set_status_is_event): New prototype. gdb/testsuite/ * gdb.threads/ia64-sigill.exp: New file. * gdb.threads/ia64-sigill.c: New file.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c37dab9..152c17f 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2605,6 +2605,29 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
return lp->stopped_data_address_p;
}
+/* Commonly any breakpoint / watchpoint generate only SIGTRAP. */
+
+static int
+sigtrap_is_event (int status)
+{
+ return WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP;
+}
+
+/* SIGTRAP-like events recognizer. */
+
+static int (*linux_nat_status_is_event) (int status) = sigtrap_is_event;
+
+/* Set alternative SIGTRAP-like events recognizer. If
+ breakpoint_inserted_here_p there then gdbarch_decr_pc_after_break will be
+ applied. */
+
+void
+linux_nat_set_status_is_event (struct target_ops *t,
+ int (*status_is_event) (int status))
+{
+ linux_nat_status_is_event = status_is_event;
+}
+
/* Wait until LP is stopped. */
static int
@@ -2645,7 +2668,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
if (WSTOPSIG (status) != SIGSTOP)
{
- if (WSTOPSIG (status) == SIGTRAP)
+ if (linux_nat_status_is_event (status))
{
/* If a LWP other than the LWP that we're reporting an
event for has hit a GDB breakpoint (as opposed to
@@ -2801,7 +2824,7 @@ count_events_callback (struct lwp_info *lp, void *data)
/* Count only resumed LWPs that have a SIGTRAP event pending. */
if (lp->status != 0 && lp->resumed
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
+ && linux_nat_status_is_event (lp->status))
(*count)++;
return 0;
@@ -2829,7 +2852,7 @@ select_event_lwp_callback (struct lwp_info *lp, void *data)
/* Select only resumed LWPs that have a SIGTRAP event pending. */
if (lp->status != 0 && lp->resumed
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
+ && linux_nat_status_is_event (lp->status))
if ((*selector)-- == 0)
return 1;
@@ -2891,7 +2914,7 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data)
if (lp->waitstatus.kind == TARGET_WAITKIND_IGNORE
&& lp->status != 0
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
+ && linux_nat_status_is_event (lp->status)
&& cancel_breakpoint (lp))
/* Throw away the SIGTRAP. */
lp->status = 0;
@@ -3064,7 +3087,7 @@ linux_nat_filter_event (int lwpid, int status, int options)
return NULL;
}
- if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
+ if (linux_nat_status_is_event (status))
{
/* Save the trap's siginfo in case we need it later. */
save_siginfo (lp);
@@ -3411,7 +3434,7 @@ retry:
threads. */
if (non_stop
&& lp->waitstatus.kind == TARGET_WAITKIND_IGNORE
- && WSTOPSIG (lp->status) == SIGTRAP
+ && linux_nat_status_is_event (lp->status)
&& cancel_breakpoint (lp))
{
/* Throw away the SIGTRAP. */
@@ -3627,7 +3650,7 @@ retry:
else
lp->resumed = 0;
- if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
+ if (linux_nat_status_is_event (status))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,