Debugging QT2.3.2 programs with gdb

Allen King <[email protected]>
Newsgroups gmane.comp.gdb.bugs.general
Message-ID <[email protected]>
    Recipient: <[email protected]>
    Reason:    unknown user - prep.ai.mit.edu is deprecated, try gnu.org

-------- Original Message --------
Subject: Debugging QT2.3.2 programs with gdb
   Date: Tue, 29 Oct 2002 15:08:58 -0500
   From: Allen King <[email protected]>
     To: [email protected], [email protected]

I am ATTEMPTING to debug a large QT program and am having a bear of a
time using gdb.  This incompatibility often takes over 2/3'rds of my
debug time.

The issue is viewing QString's. On a good day, I can get some
information out of str->latin1(), except most of my strings are not
purely latin1, and on those latin1 is useless.

If I do "p str", sometimes I get the not very helpful message:
$3 = (QString &) @0x41c9321c: {
  static null = Cannot access memory at address 0x0

Other times (one in 10) the whole of gdb crashes.  E.g. gdb runs are
limited to doing about 10 things.

When I attempt to use my own "p print_QString(str)" from the debugger,
gdb spends about 2 minutes examining my symbol table and then either
says: "couldn't resolve", 1 in 3 works properly, or crashes gdb.

Do you have any workarounds?  I've looked under your debugging and FAQ
sections and seen nothing.  It is starting to make me want to stear
clear of QT in the future.  And yes, I need to debug with a debugger.
I'd be happy to send you stuff to replicate it if I know you are going
to look at it.



I am using:

RedHat 8.0 (it's the same on 7.2 and 7.3, I've been there)

GNU gdb Red Hat Linux (5.2.1-4)
running gdb from xterm, emacs, or ddd gives equal (poor) results.

gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
also the same with gcc 3.0.2

a typical make output is:

     g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/lib/qt-2.3.2/include
     -I/usr/X11R6/include -D_REENTRANT -Wall -g -DDEBUG
     -DQT_THREAD_SUPPORT=1 -c -o kbd2eq.o kbd2eq.cpp

     I have optimizations off for debugging

     I have played around with the -ggdb switch, and it seems
     better not there

I
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.