This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMIT] Make inf-ttrace.c work on HP-UX 11.11


Turns out HP-UX 11.11 behaves slightly different than 11.00.  This
patch fixes most of the problems, although "hardware" watchpoints seem
to have some problems.

Mark


Index: ChangeLog
from  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.

Index: inf-ttrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ttrace.c,v
retrieving revision 1.4
diff -u -p -r1.4 inf-ttrace.c
--- inf-ttrace.c 11 Dec 2004 16:49:26 -0000 1.4
+++ inf-ttrace.c 11 Dec 2004 21:47:38 -0000
@@ -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_
   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_
   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
   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 tar
 
   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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]