aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-12-11 21:53:58 +0000
committerMark Kettenis <kettenis@gnu.org>2004-12-11 21:53:58 +0000
commit7ba0e0c29a39ce88ce070629f605039cbbfba045 (patch)
treef2480bb5f53e6ccd0fc2294baf136e4fbdb4b4f0 /gdb
parentd3322e8a421bb0f85b975954538b40b6b65e9bb8 (diff)
downloadgdb-7ba0e0c29a39ce88ce070629f605039cbbfba045.zip
gdb-7ba0e0c29a39ce88ce070629f605039cbbfba045.tar.gz
gdb-7ba0e0c29a39ce88ce070629f605039cbbfba045.tar.bz2
* inf-ttrace.c (inf_ttrace_him): Set TTEVT_BPT_SSTEP if available.
(inf_ttrace_attach): Likewise. (inf_ttrace_resume_callback): New function. (inf_ttrace_resume): Don't use TT_PROC_CONTINUE. Iterate over all lwps and call inf_ttrace_resume_callback instead. (inf_ttrace_wait): Handle TTEVT_BPT_SSTEP.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/inf-ttrace.c34
2 files changed, 38 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dc25333..471704c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2004-12-11 Mark Kettenis <kettenis@gnu.org>
+ * inf-ttrace.c (inf_ttrace_him): Set TTEVT_BPT_SSTEP if available.
+ (inf_ttrace_attach): Likewise.
+ (inf_ttrace_resume_callback): New function.
+ (inf_ttrace_resume): Don't use TT_PROC_CONTINUE. Iterate over all
+ lwps and call inf_ttrace_resume_callback instead.
+ (inf_ttrace_wait): Handle TTEVT_BPT_SSTEP.
+
* inf-ttrace.c (_initialize_inf_ttrace): Unconditionially compile.
2004-12-10 Michael Snyder <msnyder@redhat.com>
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index ea0bacd..e560e58 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -465,6 +465,9 @@ inf_ttrace_him (int pid)
memset (&tte, 0, sizeof (tte));
tte.tte_events |= TTEVT_EXEC | TTEVT_EXIT;
tte.tte_events |= TTEVT_LWP_CREATE | TTEVT_LWP_EXIT | TTEVT_LWP_TERMINATE;
+#ifdef TTEVT_BPT_SSTEP
+ tte.tte_events |= TTEVT_BPT_SSTEP;
+#endif
tte.tte_opts = TTEO_NOSTRCCHLD;
if (ttrace (TT_PROC_SET_EVENT_MASK, pid, 0,
(uintptr_t)&tte, sizeof tte, 0) == -1)
@@ -600,6 +603,9 @@ inf_ttrace_attach (char *args, int from_tty)
memset (&tte, 0, sizeof (tte));
tte.tte_events |= TTEVT_EXEC | TTEVT_EXIT;
tte.tte_events |= TTEVT_LWP_CREATE | TTEVT_LWP_EXIT | TTEVT_LWP_TERMINATE;
+#ifdef TTEVT_BPT_SSTEP
+ tte.tte_events |= TTEVT_BPT_SSTEP;
+#endif
tte.tte_opts = TTEO_NOSTRCCHLD;
if (ttrace (TT_PROC_SET_EVENT_MASK, pid, 0,
(uintptr_t)&tte, sizeof tte, 0) == -1)
@@ -643,6 +649,21 @@ inf_ttrace_detach (char *args, int from_tty)
inferior_ptid = null_ptid;
}
+static int
+inf_ttrace_resume_callback (struct thread_info *info, void *arg)
+{
+ if (!ptid_equal (info->ptid, inferior_ptid))
+ {
+ pid_t pid = ptid_get_pid (info->ptid);
+ lwpid_t lwpid = ptid_get_lwp (info->ptid);
+
+ if (ttrace (TT_LWP_CONTINUE, pid, lwpid, TT_NOPC, 0, 0) == -1)
+ perror_with_name ("ttrace");
+ }
+
+ return 0;
+}
+
static void
inf_ttrace_resume (ptid_t ptid, int step, enum target_signal signal)
{
@@ -660,11 +681,10 @@ inf_ttrace_resume (ptid_t ptid, int step, enum target_signal signal)
if (ttrace (request, pid, lwpid, TT_NOPC, sig, 0) == -1)
perror_with_name ("ttrace");
- if (ptid_equal (ptid, minus_one_ptid))
+ if (ptid_equal (ptid, minus_one_ptid) && inf_ttrace_num_lwps > 0)
{
/* Let all the other threads run too. */
- if (ttrace (TT_PROC_CONTINUE, pid, 0, 0, 0, 0) == -1)
- perror_with_name ("ttrace");
+ iterate_over_threads (inf_ttrace_resume_callback, NULL);
}
}
@@ -708,6 +728,14 @@ inf_ttrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
switch (tts.tts_event)
{
+#ifdef TTEVT_BPT_SSTEP
+ case TTEVT_BPT_SSTEP:
+ /* Make it look like a breakpoint. */
+ ourstatus->kind = TARGET_WAITKIND_STOPPED;
+ ourstatus->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+#endif
+
case TTEVT_EXEC:
/* Make it look like a breakpoint. */
ourstatus->kind = TARGET_WAITKIND_STOPPED;