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]

Re: [RFA] lin-lwp.c: more printf debugging


Michael Snyder wrote:
> 
> If this arrives twice, this version supercedes.
> 
> Anyone object to the following?
> 
>   -------------------------------------------------------------------------------

Committed, with a few polish-ups, as below:
2003-01-06  Michael Snyder  <msnyder@redhat.com>

	* lin-lwp.c: Added or elaborated on "debug lin-lwp" info.

Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.39
diff -p -r1.39 lin-lwp.c
*** lin-lwp.c	9 Dec 2002 18:41:42 -0000	1.39
--- lin-lwp.c	6 Jan 2003 23:08:51 -0000
*************** lin_lwp_attach_lwp (ptid_t ptid, int ver
*** 379,384 ****
--- 379,389 ----
  	error ("Can't attach %s: %s", target_pid_to_str (ptid),
  	       safe_strerror (errno));
  
+       if (debug_lin_lwp)
+ 	fprintf_unfiltered (gdb_stdlog, 
+ 			    "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n", 
+ 			    target_pid_to_str (ptid));
+ 
        pid = waitpid (GET_LWP (ptid), &status, 0);
        if (pid == -1 && errno == ECHILD)
  	{
*************** lin_lwp_attach_lwp (ptid_t ptid, int ver
*** 391,396 ****
--- 396,409 ----
  		  && WIFSTOPPED (status) && WSTOPSIG (status));
  
        lp->stopped = 1;
+ 
+       if (debug_lin_lwp)
+ 	{
+ 	  fprintf_unfiltered (gdb_stdlog,
+ 			      "LLAL: waitpid %s received %s\n",
+ 			      target_pid_to_str (ptid), 
+ 			      status_to_str (status));
+ 	}
      }
    else
      {
*************** lin_lwp_attach (char *args, int from_tty
*** 439,444 ****
--- 452,463 ----
    /* Fake the SIGSTOP that core GDB expects.  */
    lp->status = W_STOPCODE (SIGSTOP);
    lp->resumed = 1;
+   if (debug_lin_lwp)
+     {
+       fprintf_unfiltered (gdb_stdlog,
+ 			  "LLA: waitpid %ld, faking SIGSTOP\n", 
+ 			  (long) pid);
+     }
  }
  
  static int
*************** detach_callback (struct lwp_info *lp, vo
*** 447,462 ****
    gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
  
    if (debug_lin_lwp && lp->status)
!     fprintf_unfiltered (gdb_stdlog, "Pending %s for LWP %ld on detach.\n",
! 			strsignal (WSTOPSIG (lp->status)), GET_LWP (lp->ptid));
  
    while (lp->signalled && lp->stopped)
      {
        if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
  		  WSTOPSIG (lp->status)) < 0)
  	error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
  	       safe_strerror (errno));
  
        lp->stopped = 0;
        lp->signalled = 0;
        lp->status = 0;
--- 466,489 ----
    gdb_assert (lp->status == 0 || WIFSTOPPED (lp->status));
  
    if (debug_lin_lwp && lp->status)
!     fprintf_unfiltered (gdb_stdlog, "DC:  Pending %s for %s on detach.\n",
! 			strsignal (WSTOPSIG (lp->status)), 
! 			target_pid_to_str (lp->ptid));
  
    while (lp->signalled && lp->stopped)
      {
+       errno = 0;
        if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
  		  WSTOPSIG (lp->status)) < 0)
  	error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
  	       safe_strerror (errno));
  
+       if (debug_lin_lwp)
+ 	fprintf_unfiltered (gdb_stdlog, 
+ 			    "DC:  PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
+ 			    target_pid_to_str (lp->ptid),
+ 			    status_to_str (lp->status)); 
+ 
        lp->stopped = 0;
        lp->signalled = 0;
        lp->status = 0;
*************** detach_callback (struct lwp_info *lp, vo
*** 469,479 ****
--- 496,513 ----
       overall process id just yet.  */
    if (GET_LWP (lp->ptid) != GET_PID (lp->ptid))
      {
+       errno = 0;
        if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
  		  WSTOPSIG (lp->status)) < 0)
  	error ("Can't detach %s: %s", target_pid_to_str (lp->ptid),
  	       safe_strerror (errno));
  
+       if (debug_lin_lwp)
+ 	fprintf_unfiltered (gdb_stdlog,
+ 			    "PTRACE_DETACH (%s, %s, 0) (OK)\n",
+ 			    target_pid_to_str (lp->ptid), 
+ 			    strsignal (WSTOPSIG (lp->status)));
+ 
        delete_lwp (lp->ptid);
      }
  
*************** resume_callback (struct lwp_info *lp, vo
*** 552,557 ****
--- 586,595 ----
  #endif
  
        child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
+       if (debug_lin_lwp)
+ 	fprintf_unfiltered (gdb_stdlog, 
+ 			    "RC:  PTRACE_CONT %s, 0, 0 (resume sibling)\n",
+ 			    target_pid_to_str (lp->ptid));
        lp->stopped = 0;
        lp->step = 0;
      }
*************** lin_lwp_resume (ptid_t ptid, int step, e
*** 622,627 ****
--- 660,671 ----
      iterate_over_lwps (resume_callback, NULL);
  
    child_resume (ptid, step, signo);
+   if (debug_lin_lwp)
+     fprintf_unfiltered (gdb_stdlog,
+ 			"LLR: %s %s, %s (resume event thread)\n",
+ 			step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ 			target_pid_to_str (ptid),
+ 			signo ? strsignal (signo) : "0");
  }
  
  
*************** stop_callback (struct lwp_info *lp, void
*** 634,639 ****
--- 678,689 ----
      {
        int ret;
  
+       if (debug_lin_lwp)
+ 	{
+ 	  fprintf_unfiltered (gdb_stdlog,
+ 			      "SC:  kill %s **<SIGSTOP>**\n",
+ 			      target_pid_to_str (lp->ptid));
+ 	}
        ret = kill (GET_LWP (lp->ptid), SIGSTOP);
        gdb_assert (ret == 0);
  
*************** stop_wait_callback (struct lwp_info *lp,
*** 667,672 ****
--- 717,730 ----
  
        gdb_assert (pid == GET_LWP (lp->ptid));
  
+       if (debug_lin_lwp)
+ 	{
+ 	  fprintf_unfiltered (gdb_stdlog,
+ 			      "SWC: waitpid %s received %s\n",
+ 			      target_pid_to_str (lp->ptid), 
+ 			      status_to_str (status));
+ 	}
+ 
        if (WIFEXITED (status) || WIFSIGNALED (status))
  	{
  	  gdb_assert (num_lwps > 1);
*************** stop_wait_callback (struct lwp_info *lp,
*** 681,688 ****
  				 target_pid_to_str (lp->ptid));
  	    }
  	  if (debug_lin_lwp)
! 	    fprintf_unfiltered (gdb_stdlog, 
! 				"%s exited.\n", target_pid_to_str (lp->ptid));
  
  	  delete_lwp (lp->ptid);
  	  return 0;
--- 739,746 ----
  				 target_pid_to_str (lp->ptid));
  	    }
  	  if (debug_lin_lwp)
! 	    fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n", 
! 				target_pid_to_str (lp->ptid));
  
  	  delete_lwp (lp->ptid);
  	  return 0;
*************** stop_wait_callback (struct lwp_info *lp,
*** 693,699 ****
--- 751,764 ----
        /* Ignore any signals in FLUSH_MASK.  */
        if (flush_mask && sigismember (flush_mask, WSTOPSIG (status)))
  	{
+ 	  errno = 0;
  	  ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+ 	  if (debug_lin_lwp)
+ 	    fprintf_unfiltered (gdb_stdlog,
+ 				"PTRACE_CONT %s, 0, 0 (%s)\n",
+ 				target_pid_to_str (lp->ptid),
+ 				errno ? safe_strerror (errno) : "OK");
+ 
  	  return stop_wait_callback (lp, flush_mask);
  	}
  
*************** stop_wait_callback (struct lwp_info *lp,
*** 715,732 ****
  		 thread will have already tripped on it.  */
  
  	      /* Now resume this LWP and get the SIGSTOP event. */
  	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
  	      if (debug_lin_lwp)
  		{
! 		  fprintf_unfiltered (gdb_stderr, 
! 				      "SWC: Candidate SIGTRAP event in %ld\n",
! 				      GET_LWP (lp->ptid));
  		}
  	      /* Hold the SIGTRAP for handling by lin_lwp_wait. */
  	      stop_wait_callback (lp, data);
  	      /* If there's another event, throw it back into the queue. */
  	      if (lp->status)
! 		kill (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
  	      /* Save the sigtrap event. */
  	      lp->status = status;
  	      return 0;
--- 780,805 ----
  		 thread will have already tripped on it.  */
  
  	      /* Now resume this LWP and get the SIGSTOP event. */
+ 	      errno = 0;
  	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
  	      if (debug_lin_lwp)
  		{
! 		  fprintf_unfiltered (gdb_stdlog, 
! 				      "PTRACE_CONT %s, 0, 0 (%s)\n",
! 				      target_pid_to_str (lp->ptid),
! 				      errno ? safe_strerror (errno) : "OK");
! 
! 		  fprintf_unfiltered (gdb_stdlog, 
! 				      "SWC: Candidate SIGTRAP event in %s\n",
! 				      target_pid_to_str (lp->ptid));
  		}
  	      /* Hold the SIGTRAP for handling by lin_lwp_wait. */
  	      stop_wait_callback (lp, data);
  	      /* If there's another event, throw it back into the queue. */
  	      if (lp->status)
! 		{
! 		  kill (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
! 		}
  	      /* Save the sigtrap event. */
  	      lp->status = status;
  	      return 0;
*************** stop_wait_callback (struct lwp_info *lp,
*** 738,749 ****
  
  	      if (debug_lin_lwp)
  		{
! 		  fprintf_unfiltered (gdb_stderr, 
! 				      "SWC: Pending event %d in %ld\n",
! 				      WSTOPSIG (status), GET_LWP (lp->ptid));
  		}
  	      /* Now resume this LWP and get the SIGSTOP event. */
  	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
  
  	      /* Hold this event/waitstatus while we check to see if
  		 there are any more (we still want to get that SIGSTOP). */
--- 811,829 ----
  
  	      if (debug_lin_lwp)
  		{
! 		  fprintf_unfiltered (gdb_stdlog, 
! 				      "SWC: Pending event %s in %s\n",
! 				      status_to_str ((int) status), 
! 				      target_pid_to_str (lp->ptid));
  		}
  	      /* Now resume this LWP and get the SIGSTOP event. */
+ 	      errno = 0;
  	      ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
+ 	      if (debug_lin_lwp)
+ 		fprintf_unfiltered (gdb_stdlog, 
+ 				    "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
+ 				    target_pid_to_str (lp->ptid),
+ 				    errno ? safe_strerror (errno) : "OK");
  
  	      /* Hold this event/waitstatus while we check to see if
  		 there are any more (we still want to get that SIGSTOP). */
*************** stop_wait_callback (struct lwp_info *lp,
*** 754,760 ****
  	      if (lp->status == 0)
  		lp->status = status;
  	      else
! 		kill (GET_LWP (lp->ptid), WSTOPSIG (status));
  	      return 0;
  	    }
  	}
--- 834,849 ----
  	      if (lp->status == 0)
  		lp->status = status;
  	      else
! 		{
! 		  if (debug_lin_lwp)
! 		    {
! 		      fprintf_unfiltered (gdb_stdlog, 
! 					  "SWC: kill %s, %s\n",
! 					  target_pid_to_str (lp->ptid), 
! 					  status_to_str ((int) status));
! 		    }
! 		  kill (GET_LWP (lp->ptid), WSTOPSIG (status));
! 		}
  	      return 0;
  	    }
  	}
*************** cancel_breakpoints_callback (struct lwp_
*** 861,868 ****
      {
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog,
! 			    "Push back breakpoint for LWP %ld\n",
! 			    GET_LWP (lp->ptid));
  
        /* Back up the PC if necessary.  */
        if (DECR_PC_AFTER_BREAK)
--- 950,957 ----
      {
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog,
! 			    "CBC: Push back breakpoint for %s\n",
! 			    target_pid_to_str (lp->ptid));
  
        /* Back up the PC if necessary.  */
        if (DECR_PC_AFTER_BREAK)
*************** select_event_lwp (struct lwp_info **orig
*** 893,900 ****
      {
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog,
! 			    "Select single-step LWP %ld\n",
! 			    GET_LWP (event_lp->ptid));
      }
    else
      {
--- 982,989 ----
      {
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog,
! 			    "SEL: Select single-step %s\n",
! 			    target_pid_to_str (event_lp->ptid));
      }
    else
      {
*************** select_event_lwp (struct lwp_info **orig
*** 910,916 ****
  
        if (debug_lin_lwp && num_events > 1)
  	fprintf_unfiltered (gdb_stdlog, 
! 			    "Found %d SIGTRAP events, selecting #%d\n", 
  			    num_events, random_selector);
  
        event_lp = iterate_over_lwps (select_event_lwp_callback,
--- 999,1005 ----
  
        if (debug_lin_lwp && num_events > 1)
  	fprintf_unfiltered (gdb_stdlog, 
! 			    "SEL: Found %d SIGTRAP events, selecting #%d\n", 
  			    num_events, random_selector);
  
        event_lp = iterate_over_lwps (select_event_lwp_callback,
*************** child_wait (ptid_t ptid, struct target_w
*** 962,967 ****
--- 1051,1065 ----
        if (pid == -1 && errno == ECHILD)
  	/* Try again with __WCLONE to check cloned processes.  */
  	pid = waitpid (GET_PID (ptid), &status, __WCLONE);
+ 
+       if (debug_lin_lwp)
+ 	{
+ 	  fprintf_unfiltered (gdb_stdlog, 
+ 			      "CW:  waitpid %ld received %s\n",
+ 			      (long) pid, 
+ 			      status_to_str (status));
+ 	}
+ 
        save_errno = errno;
  
        clear_sigio_trap ();
*************** child_wait (ptid_t ptid, struct target_w
*** 971,977 ****
  
    if (pid == -1)
      {
!       warning ("Child process unexpectedly missing: %s", safe_strerror (errno));
  
        /* Claim it exited with unknown signal.  */
        ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
--- 1069,1076 ----
  
    if (pid == -1)
      {
!       warning ("Child process unexpectedly missing: %s", 
! 	       safe_strerror (errno));
  
        /* Claim it exited with unknown signal.  */
        ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1021,1028 ****
  
  	  if (debug_lin_lwp && status)
  	    fprintf_unfiltered (gdb_stdlog,
! 				"Using pending wait status %s for LWP %ld.\n",
! 				status_to_str (status), GET_LWP (lp->ptid));
  	}
  
        /* But if we don't fine one, we'll have to wait, and check both
--- 1120,1128 ----
  
  	  if (debug_lin_lwp && status)
  	    fprintf_unfiltered (gdb_stdlog,
! 				"LLW: Using pending wait status %s for %s.\n",
! 				status_to_str (status), 
! 				target_pid_to_str (lp->ptid));
  	}
  
        /* But if we don't fine one, we'll have to wait, and check both
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1034,1041 ****
      {
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog, 
! 			    "Waiting for specific LWP %ld.\n",
! 			    GET_LWP (ptid));
  
        /* We have a specific LWP to check.  */
        lp = find_lwp_pid (ptid);
--- 1134,1141 ----
      {
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog, 
! 			    "LLW: Waiting for specific LWP %s.\n",
! 			    target_pid_to_str (ptid));
  
        /* We have a specific LWP to check.  */
        lp = find_lwp_pid (ptid);
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1045,1052 ****
  
        if (debug_lin_lwp && status)
  	fprintf_unfiltered (gdb_stdlog,
! 			    "Using pending wait status %s for LWP %ld.\n",
! 			    status_to_str (status), GET_LWP (lp->ptid));
  
        /* If we have to wait, take into account whether PID is a cloned
           process or not.  And we have to convert it to something that
--- 1145,1153 ----
  
        if (debug_lin_lwp && status)
  	fprintf_unfiltered (gdb_stdlog,
! 			    "LLW: Using pending wait status %s for %s.\n",
! 			    status_to_str (status), 
! 			    target_pid_to_str (lp->ptid));
  
        /* If we have to wait, take into account whether PID is a cloned
           process or not.  And we have to convert it to something that
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1068,1075 ****
--- 1169,1182 ----
  
        /* Resume the thread.  It should halt immediately returning the
  	 pending SIGSTOP.  */
+       registers_changed ();
        child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
                      TARGET_SIGNAL_0);
+       if (debug_lin_lwp)
+ 	fprintf_unfiltered (gdb_stdlog,
+ 			    "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
+ 			    lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ 			    target_pid_to_str (lp->ptid));
        lp->stopped = 0;
        gdb_assert (lp->resumed);
  
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1090,1095 ****
--- 1197,1210 ----
  	{
  	  gdb_assert (pid == -1 || lwpid == pid);
  
+ 	  if (debug_lin_lwp)
+ 	    {
+ 	      fprintf_unfiltered (gdb_stdlog,
+ 				  "LLW: waitpid %ld received %s\n",
+ 				  (long) lwpid, 
+ 				  status_to_str (status));
+ 	    }
+ 
  	  lp = find_lwp_pid (pid_to_ptid (lwpid));
  	  if (! lp)
  	    {
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1132,1138 ****
  		}
  	      if (debug_lin_lwp)
  		fprintf_unfiltered (gdb_stdlog, 
! 				    "%s exited.\n", 
  				    target_pid_to_str (lp->ptid));
  
  	      delete_lwp (lp->ptid);
--- 1247,1253 ----
  		}
  	      if (debug_lin_lwp)
  		fprintf_unfiltered (gdb_stdlog, 
! 				    "LLW: %s exited.\n", 
  				    target_pid_to_str (lp->ptid));
  
  	      delete_lwp (lp->ptid);
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1147,1165 ****
  
  	  /* Make sure we don't report a SIGSTOP that we sent
               ourselves in an attempt to stop an LWP.  */
! 	  if (lp->signalled && WIFSTOPPED (status)
  	      && WSTOPSIG (status) == SIGSTOP)
  	    {
  	      if (debug_lin_lwp)
  		fprintf_unfiltered (gdb_stdlog, 
! 				    "Delayed SIGSTOP caught for %s.\n",
  				    target_pid_to_str (lp->ptid));
  
  	      /* This is a delayed SIGSTOP.  */
  	      lp->signalled = 0;
  
  	      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
  	                    TARGET_SIGNAL_0);
  	      lp->stopped = 0;
  	      gdb_assert (lp->resumed);
  
--- 1262,1289 ----
  
  	  /* Make sure we don't report a SIGSTOP that we sent
               ourselves in an attempt to stop an LWP.  */
! 	  if (lp->signalled
!               && WIFSTOPPED (status)
  	      && WSTOPSIG (status) == SIGSTOP)
  	    {
  	      if (debug_lin_lwp)
  		fprintf_unfiltered (gdb_stdlog, 
! 				    "LLW: Delayed SIGSTOP caught for %s.\n",
  				    target_pid_to_str (lp->ptid));
  
  	      /* This is a delayed SIGSTOP.  */
  	      lp->signalled = 0;
  
+ 	      registers_changed ();
  	      child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
  	                    TARGET_SIGNAL_0);
+ 	      if (debug_lin_lwp)
+ 		fprintf_unfiltered (gdb_stdlog,
+ 				    "LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
+ 				    lp->step ? 
+ 				    "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ 				    target_pid_to_str (lp->ptid));
+ 
  	      lp->stopped = 0;
  	      gdb_assert (lp->resumed);
  
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1210,1216 ****
--- 1334,1347 ----
               other threads to run.  On the other hand, not resuming
               newly attached threads may cause an unwanted delay in
               getting them running.  */
+ 	  registers_changed ();
  	  child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
+ 	  if (debug_lin_lwp)
+ 	    fprintf_unfiltered (gdb_stdlog,
+ 				"LLW: %s %s, %s (preempt 'handle')\n",
+ 				lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ 				target_pid_to_str (lp->ptid),
+ 				signo ? strsignal (signo) : "0");
  	  lp->stopped = 0;
  	  status = 0;
  	  goto retry;
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1231,1238 ****
    lp->stopped = 1;
  
    if (debug_lin_lwp)
!     fprintf_unfiltered (gdb_stdlog, "Candidate event %s in LWP %ld.\n",
! 			status_to_str (status), GET_LWP (lp->ptid));
  
    /* Now stop all other LWP's ...  */
    iterate_over_lwps (stop_callback, NULL);
--- 1362,1370 ----
    lp->stopped = 1;
  
    if (debug_lin_lwp)
!     fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
! 			status_to_str (status), 
! 			target_pid_to_str (lp->ptid));
  
    /* Now stop all other LWP's ...  */
    iterate_over_lwps (stop_callback, NULL);
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1260,1267 ****
        trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog, 
! 			    "LLW: trap_ptid is %ld\n",
! 			    GET_LWP (trap_ptid));
      }
    else
      trap_ptid = null_ptid;
--- 1392,1399 ----
        trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
        if (debug_lin_lwp)
  	fprintf_unfiltered (gdb_stdlog, 
! 			    "LLW: trap_ptid is %s.\n",
! 			    target_pid_to_str (trap_ptid));
      }
    else
      trap_ptid = null_ptid;
*************** lin_lwp_wait (ptid_t ptid, struct target
*** 1273,1279 ****
--- 1405,1418 ----
  static int
  kill_callback (struct lwp_info *lp, void *data)
  {
+   errno = 0;
    ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
+   if (debug_lin_lwp)
+     fprintf_unfiltered (gdb_stdlog, 
+ 			"KC:  PTRACE_KILL %s, 0, 0 (%s)\n",
+ 			target_pid_to_str (lp->ptid),
+ 			errno ? safe_strerror (errno) : "OK");
+ 
    return 0;
  }
  
*************** kill_wait_callback (struct lwp_info *lp,
*** 1294,1299 ****
--- 1433,1444 ----
        do
  	{
  	  pid = waitpid (GET_LWP (lp->ptid), NULL, __WCLONE);
+ 	  if (pid != (pid_t) -1 && debug_lin_lwp)
+ 	    {
+ 	      fprintf_unfiltered (gdb_stdlog,
+ 				  "KWC: wait %s received unknown.\n",
+ 				  target_pid_to_str (lp->ptid));
+ 	    }
  	}
        while (pid == GET_LWP (lp->ptid));
  
*************** kill_wait_callback (struct lwp_info *lp,
*** 1303,1308 ****
--- 1448,1459 ----
    do
      {
        pid = waitpid (GET_LWP (lp->ptid), NULL, 0);
+       if (pid != (pid_t) -1 && debug_lin_lwp)
+ 	{
+ 	  fprintf_unfiltered (gdb_stdlog,
+ 			      "KWC: wait %s received unk.\n", 
+ 			      target_pid_to_str (lp->ptid));
+ 	}
      }
    while (pid == GET_LWP (lp->ptid));
  
*************** lin_lwp_thread_alive (ptid_t ptid)
*** 1369,1374 ****
--- 1520,1530 ----
  
    errno = 0;
    ptrace (PTRACE_PEEKUSER, GET_LWP (ptid), 0, 0);
+   if (debug_lin_lwp)
+     fprintf_unfiltered (gdb_stdlog,
+ 			"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
+ 			target_pid_to_str (ptid), 
+ 			errno ? safe_strerror (errno) : "OK");
    if (errno)
      return 0;
  

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