Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, November 2007
Qt Debugger


Message 1 in thread

Hi all,

since I'm running more and more complex apps with various pointer operations I need to debug my code in a convenient way. I prefer programming with vi under Linux. What debugger can you recommend ?

Thanks in advance

-- A l e x
-- 
 [ signature omitted ] 

Message 2 in thread

Well, the free options are fairly limited. For "core" debugging "gdb" is 
the only option.
(gdb is a command line tool.) There are a number of GUI wrappers for 
gdb. I'm using ddd
which is fairly good. I'm not really very happy with gdb, though. I have 
yet to figure out
how to call c++ functions from the debugger. Also, I've found it 
virtually impossible to find
out the string values in a QString. I ended up creating a simple extern 
"C" void debugQString(QString*)
{ std::cerr << qPrintable(*qstring) << std::endl; }
that I can call from gdb.

Alexander Carôt wrote:
> Hi all,
>
> since I'm running more and more complex apps with various pointer operations I need to debug my code in a convenient way. I prefer programming with vi under Linux. What debugger can you recommend ?
>
> Thanks in advance
>
> -- A l e x
>   

--
 [ signature omitted ] 

Message 3 in thread

Check this script:
http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/kde-devel-gdb?revision=629367

It has functions to show QString's values and a lot more.

On Nov 19, 2007 4:14 PM, Peter Hackett <peter@xxxxxxxxxxxx> wrote:
> Well, the free options are fairly limited. For "core" debugging "gdb" is
> the only option.
> (gdb is a command line tool.) There are a number of GUI wrappers for
> gdb. I'm using ddd
> which is fairly good. I'm not really very happy with gdb, though. I have
> yet to figure out
> how to call c++ functions from the debugger. Also, I've found it
> virtually impossible to find
> out the string values in a QString. I ended up creating a simple extern
> "C" void debugQString(QString*)
> { std::cerr << qPrintable(*qstring) << std::endl; }
> that I can call from gdb.
>
> Alexander CarÃt wrote:
> > Hi all,
> >
> > since I'm running more and more complex apps with various pointer operations I need to debug my code in a convenient way. I prefer programming with vi under Linux. What debugger can you recommend ?
> >
> > Thanks in advance
> >
> > -- A l e x
> >
>
> --
>
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>



-- 
 [ signature omitted ] 

Message 4 in thread

Thanks. This is great info!

LÃcio CorrÃa wrote:
> Check this script:
> http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/kde-devel-gdb?revision=629367
>
> It has functions to show QString's values and a lot more.
>   
>
>   

--
 [ signature omitted ] 

Message 5 in thread

Does anyone know an equivalent site for MS Visual Stduio?!
Cause i got a lot of problems displaying values of QString, ...

Thx,

RZ

> Thanks. This is great info!
> 
> LÃcio CorrÃa wrote:
>> Check this script:
>> http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/kde-devel-gdb?revision=629367 
>>
>>
>> It has functions to show QString's values and a lot more.
>>  
>>   
> 
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 6 in thread

On 19.11.07 11:14:46, Peter Hackett wrote:
> Well, the free options are fairly limited. For "core" debugging "gdb" is 
> the only option.
> (gdb is a command line tool.) There are a number of GUI wrappers for gdb. 
> I'm using ddd
> which is fairly good. I'm not really very happy with gdb, though. I have 
> yet to figure out
> how to call c++ functions from the debugger.

The same way as you call any other function. There's no difference
between C and C++ functions (if you're talking about global functions)
and calling member functions of a class obviously needs an object of
that class first.

> Also, I've found it virtually 
> impossible to find
> out the string values in a QString. I ended up creating a simple extern "C" 
> void debugQString(QString*)
> { std::cerr << qPrintable(*qstring) << std::endl; }
> that I can call from gdb.

There's a gdbinit scriptlet in KDE's kdesdk package that allows to print
Qt3 and Qt4 QStrings as well as QStringList, QByteArray, QFont, QColor,
QMap, QList and a few others. The file is called kde-devel-gdb and just
sourcing it in .gdbinit works really good.

Andreas

-- 
 [ signature omitted ] 

Message 7 in thread

>> I'm not really very happy with gdb, though. I have yet to figure out
>> how to call c++ functions from the debugger
>
> The same way as you call any other function. There's no difference
> between C and C++ functions (if you're talking about global functions)
> and calling member functions of a class obviously needs an object of
> that class first.

If I try to do (say) this:

(gdb) call app.postEvent(%mainWin,new IqtArgEvent(argc,argv));
I get:
No symbol "app" in current context.

But I just stopped at a line where "app" *is* in the current context.
(specifically:  QApplication app(argc,argv);


Andreas Pakulat wrote:
> On 19.11.07 11:14:46, Peter Hackett wrote:
>   
>

--
 [ signature omitted ] 

Message 8 in thread

On Monday 19 November 2007, Peter Hackett wrote:
> (gdb) call app.postEvent(%mainWin,new IqtArgEvent(argc,argv));
> I get:
> No symbol "app" in current context.
>
> But I just stopped at a line where "app" *is* in the current context.
> (specifically:  QApplication app(argc,argv);

You need to execute this line before app becomes visible to the debugger.

BTW: %mainWin is not a legal C++-Expression. Did you mean &mainWin ?



	Konrad

Attachment:

Attachment: pgpvg9fd4SxzQ.pgp
Description: PGP signature


Message 9 in thread

Yes. % was a typo, should be &

I don't know what I'm doing differently, but now it working for me.

Must have been UDB (user brain damage :-)

(I did upgrade to gdb 6.6 at some point.)

Thanks for the help. (It's amazing how many times the process of asking 
for help
is help in itself.)

Konrad Rosenbaum wrote:
> On Monday 19 November 2007, Peter Hackett wrote:
>   
>> (gdb) call app.postEvent(%mainWin,new IqtArgEvent(argc,argv));
>> I get:
>> No symbol "app" in current context.
>>
>> But I just stopped at a line where "app" *is* in the current context.
>> (specifically:  QApplication app(argc,argv);
>>     
>
> You need to execute this line before app becomes visible to the debugger.
>
> BTW: %mainWin is not a legal C++-Expression. Did you mean &mainWin ?
>
>
>
> 	Konrad
>   

--
 [ signature omitted ] 

Message 10 in thread

On 19.11.07 19:35:31, "Alexander Carôt" wrote:
> Hi all,
> 
> since I'm running more and more complex apps with various pointer operations I need to debug my code in a convenient way. I prefer programming with vi under Linux. What debugger can you recommend ?

cgdb, a frontend to gdb with a simple curses interface. Quite a bit more
convenient than plain gdb and not as resource-needing as a full-featured
IDE.

Andreas

-- 
 [ signature omitted ] 

Message 11 in thread

You can also run gdb with the -tui switch to enable the built in curses 
UI (in gdb 6.x).

HTH,
Susan

Andreas Pakulat wrote:
> On 19.11.07 19:35:31, "Alexander Carôt" wrote:
>> Hi all,
>>
>> since I'm running more and more complex apps with various pointer operations I need to debug my code in a convenient way. I prefer programming with vi under Linux. What debugger can you recommend ?
> 
> cgdb, a frontend to gdb with a simple curses interface. Quite a bit more
> convenient than plain gdb and not as resource-needing as a full-featured
> IDE.
> 
> Andreas
> 

--
 [ signature omitted ] 

Message 12 in thread

And FWIW, you can debug in a full IDE using Eclipse/CDT (which actually 
launches gdb when debugging).

Susan Macchia wrote:
> You can also run gdb with the -tui switch to enable the built in curses 
> UI (in gdb 6.x).
> 
> HTH,
> Susan
> 
> Andreas Pakulat wrote:
>> On 19.11.07 19:35:31, "Alexander Carôt" wrote:
>>> Hi all,
>>>
>>> since I'm running more and more complex apps with various pointer 
>>> operations I need to debug my code in a convenient way. I prefer 
>>> programming with vi under Linux. What debugger can you recommend ?
>>
>> cgdb, a frontend to gdb with a simple curses interface. Quite a bit more
>> convenient than plain gdb and not as resource-needing as a full-featured
>> IDE.
>>
>> Andreas
>>
> 

--
 [ signature omitted ]