Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Debugging MultiThread application via GDB: (8 Items)
   
Debugging MultiThread application via GDB  
Hello,
I use GNU gdb 6.8 qnx-nto (rev. 347) from 6.4.1 Windows Host.
GDB was configured as "--host=i386-mingw32msvc --target=arm-unknown-nto-qnx6.4.0".
I need to debug at least 2 threads independently. It means I want to stop thread 1 and step thread 2, then stop thread 2
, switch to thread 1 and step it. From gdb manual (http://sourceware.org/gdb/current/onlinedocs/gdb_6.html#SEC45) I've 
read that it could be posible by non-stop mode. It seems above mentioned gdb does not support that mode.
Could you tell me please, how to debug multithreaded application?
Re: Debugging MultiThread application via GDB  
Michael Kolesov wrote:
> Hello,
> I use GNU gdb 6.8 qnx-nto (rev. 347) from 6.4.1 Windows Host.
> GDB was configured as "--host=i386-mingw32msvc --target=arm-unknown-nto-qnx6.4.0".
> I need to debug at least 2 threads independently. It means I want to stop thread 1 and step thread 2, then stop thread
 2, switch to thread 1 and step it. From gdb manual (http://sourceware.org/gdb/current/onlinedocs/gdb_6.html#SEC45) I've
 read that it could be posible by non-stop mode. It seems above mentioned gdb does not support that mode.

The documentation you are referring to is for the unreleased gdb 7.0. 
non-stop debugging is not supported in gdb 6.8. In 6.8 gdb still stop 
all threads, not just the current thread.

http://sourceware.org/gdb/download/onlinedocs/gdb_6.html#SEC45

Regards,

Ryan Mansfield
Re: Debugging MultiThread application via GDB  
Hmm..Top link gives me following:
This is the Ninth Edition, for GDB (GDB) Version 6.8.50.20090706

Ok, so what about scheduler-locking mode? As I understood I can switch to needed thread which will be always with the 
top priority and step it..after that I can switch to another and again..Am I right?

I can do 'show scheduler-locking' and see 'off'. But I cannot set scheduler-locking on for qnx target. Is this feature 
not supported?

And, when do you plan to port gdb 7.0 with non-stop debbuging mode :) ? May be you have any prerelease binaries or 
needed sources to build 7.0 by myself..?
Re: Debugging MultiThread application via GDB  
Michael Kolesov wrote:
> Hmm..Top link gives me following:
> This is the Ninth Edition, for GDB (GDB) Version 6.8.50.20090706

That is post-6.8 official release (or current HEAD sources). 
This is how it is marked in the sources; once official next 
release is created, the Version changes as well.

> 
> Ok, so what about scheduler-locking mode? As I understood I can switch to needed thread which will be always with the 
top priority and step it..after that I can switch to another and again..Am I right?
> 
> I can do 'show scheduler-locking' and see 'off'. But I cannot set scheduler-locking on for qnx target. Is this feature
 not supported?

No, it is not.

> 
> And, when do you plan to port gdb 7.0 with non-stop debbuging mode :) ? May be you have any prerelease binaries or 
needed sources to build 7.0 by myself..?

Next SDP release (6.4.2) hopefully. We will have gdb 7.0, 
but we might not support non-stop yet.

> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post33170
> 


Thanks,

Aleksandar

Re: Debugging MultiThread application via GDB  
Ryan, Aleksandar, thanks for explanation. I hope it will be..in respect to Neutrino which is a thread-based system ;)
Re: Debugging MultiThread application via GDB  
Hello!

I see gdb 7.0 into svn. Any news about supporting of non-stop mode in Neutrino? Or any other features to debug 
multithreaded applications?

Regards,
Mike
RE: Debugging MultiThread application via GDB  
Gdb 7.0 i still not official and hasn't been tested.

Non-stop mode is not currently supported and will not work with gdb 7.0, but we will eventually add it. There are no 
firm dates or releases set for that.

What exactly do you mean by "features to debug multithread applications"? We have supported debugging multithread 
applications for a long time. I would suggest gdb 6.8, the latest update from foundry.

---
Aleksandar


-----Original Message-----
From: Michael Kolesov [mailto:community-noreply@qnx.com]
Sent: Sat 1/16/2010 4:51 AM
To: general-toolchain
Subject: Re: Debugging MultiThread application via GDB
 
Hello!

I see gdb 7.0 into svn. Any news about supporting of non-stop mode in Neutrino? Or any other features to debug 
multithreaded applications?

Regards,
Mike



_______________________________________________

General
http://community.qnx.com/sf/go/post45355


Attachment: Text winmail.dat 2.9 KB
Re: RE: Debugging MultiThread application via GDB  
Hi Aleksandar.

Thanks for new info.

Under "features to debug multithread applications" I have meat avalability to control the state (ready | suspend) of 
application threads by myself (via debugger commands).

Of cause gdb 6.8 can debug multithead apps. But to debug a piece of code in desired thread you must have waiting 
functions in all other thread at the moment. If not, gdb could switch to another thread without your desire. It is 
normal and it calls reality :) but in some cases manual thread control is very handily.

Regards,
Mike