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]

Re: lin-lwp.c: stop_wait_callback() question


   Date: Wed, 28 Mar 2001 14:40:59 -0700
   From: Kevin Buettner <kevinb@cygnus.com>

   Mark,

   In the following bit of code from lin-lwp.c...

   static int
   stop_wait_callback (struct lwp_info *lp, void *data)
   {
     if (! lp->stopped && lp->signalled)
       {
	 pid_t pid;
	 int status;

	 gdb_assert (lp->status == 0);

   ...can you explain the reasoning behind the above gdb_assert
   condition?

We shouldn't do another wait, if we haven't yet processed the status
from a previous one.  We shouldn't have signalled the LWP in the first
place though (there is a similar gdb_assert in stop_callback, so it's
not us explicitly sending SIGSTOP).

   I've been playing around with debugging xmms on one of my machines. 
   If I let it run for a while and then hit Ctrl-C in gdb, I sometimes
   see the above assert triggered when I step or continue.  My
   recollection from my debugging session of last night is that the
   lp->status value is 0x27f.  (Which I believe indicates that the thread
   has stopped due to a SIGINT.)

((0x27f && 0xffff) >> 8) = 2 which is indeed SIGINT, so I think you're
right.

   When I comment out the assert, gdb seems to work much better.  It
   occurs to me though that there is probably a very good reason for this
   assert and that perhaps we need to handle the non-zero lp->status
   condition elsewhere.


I think there is a bug in in_lwp_resume.  If you feel like it, you can
try the attached patch.  I don't know if it works, but I should really
get some sleep now, and I'm not sure if I can find some time to test
things in the next few days, but any feedback is welcome.

Mark


Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.6
diff -u -p -r1.6 lin-lwp.c
--- lin-lwp.c 2001/03/01 01:39:21 1.6
+++ lin-lwp.c 2001/03/28 22:07:23
@@ -453,6 +456,9 @@ lin_lwp_resume (int pid, int step, enum 
 	  /* FIXME: What should we do if we are supposed to continue
              this thread with a signal?  */
 	  gdb_assert (signo == TARGET_SIGNAL_0);
+
+	  /* We're still stopped.  */
+	  lp->stopped = 1;
 	  return;
 	}
     }


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