This is the mail archive of the gdb@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: Multithreaded remote debug question


On Tue, Jun 17, 2003 at 05:36:43PM -0600, imburton@micron.com wrote:
> Daniel,
> 
> 	My case that crashes is too complex to send, but I 
> built a much smaller case the exhibits some of the same 
> problems.
> 
> 	Here is the source:
> 
> 	#include <pthread.h>
> 	#include <unistd.h>
> 
> 	void* TH(void*);
> 
> 	int main()
> 	{
> 		pthread_t tid;
> 		int ret;
> 		ret = pthread_create(&tid, NULL, TH, NULL);
> 
> 		for (int i=0; i < 1000;  i++)
> 		{
> 			usleep(10000);
> 		}
> 	}
> 
> 	void *TH(void* nothing)
> 	{
> 		int i=100;
> 		while( i)
> 		{
> 			i--;
> 		}
> 		return 0;
> 	}  
> 
> 
> 	
> 
> 	When I run, I set a breakpoint on line 21, the 
> while(i) loop in TH().  I step past it and I get a 
> SIGTRAP in the main thread.  I switch back to the second 
> thread and step again, and I get another SIGTRAP.  I go 
> back to the second thread, and step once more and the 
> application doesn't come back.  In my real application  
> I get a SIGSEGV at this point instead of hanging.

OK, with this use of the "thread" command to switch threads this is
almost certainly the issue that required a protocol change.

I'm working through my laundry list of GDB 6.0 issues right now; I'll
try to get to that one.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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