This is the mail archive of the gdb-patches@sourceware.org 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]

Re: ttrace: Protocal error


On Sat, 09 Aug 2008, Pedro Alves wrote:

> If you were really in a TARGET_WAITKIND_SYSCALL_ENTRY, this would be
> at least the second resume after the lwp exit.
> Maybe I am reading the backtrace wrong though.  If you have the patience,
> showing what GDB outputs when you do a "run" after setting
> "set debug infrun 1" would help.

Attached.

Ignoring protocol errors seems to work.  Used the following.  Note
there is a conflict with your change.

Index: inf-ttrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ttrace.c,v
retrieving revision 1.30
diff -u -3 -p -r1.30 inf-ttrace.c
--- inf-ttrace.c	9 Jul 2008 22:23:05 -0000	1.30
+++ inf-ttrace.c	9 Aug 2008 18:35:51 -0000
@@ -787,12 +804,16 @@ inf_ttrace_kill (void)
 static int
 inf_ttrace_resume_callback (struct thread_info *info, void *arg)
 {
-  if (!ptid_equal (info->ptid, inferior_ptid))
+  /* There is a race condition in detecting when a thread is stopped.
+     So, we need to resume "dying" threads and ignore protocol errors
+     that occur from resuming threads that aren't stopped.  */
+  if (!ptid_equal (info->ptid, inferior_ptid) && !is_exited (info->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)
+      if (ttrace (TT_LWP_CONTINUE, pid, lwpid, TT_NOPC, 0, 0) == -1
+	  && errno != EPROTO)
 	perror_with_name (("ttrace"));
     }
 
Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Attachment: vla6.dbg.2
Description: Text document


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