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

Qt-interest Archive, January 2008
no debug information for local variables?


Message 1 in thread

Dear All,
does anyone have an experience with this:

i have a rather complex program using qt, opengl, xml and other stuff. I've
reinstalled computer and recompiled it again, with full debugging
information (btw, new operating system is gentoo and I have compiled
_everything_ with CFLAGS="-O0 -ggdb" and FEATURES="installsources nostrip"
so it should be perfect for debugging and error tracing). However, when I
try to debug the program the gdb does not want to show any local variables.
When I try to force to show the local variable
it finishes with two errors:

mi_cmd_var_create: unable to create variable object

followed by

Variable object not found

(for development i use combination of kdevelop3.4.1 on kde3.5.7 with gdb6.6,
however changing gdb to newer version exhibits the same problems)



It happens only in my program. When debugging inside of QT libraries, when
creating new project, when using different type of projects it works
perfectly and all local variables are displayed correctly.


As a typical example of what i'm talking about is this:

-------------------------------------
Q_attributesDataProvider_vertices::Q_attributesDataProvider_vertices(D_objectBase*
object, const QString& name, const QString& property)
    : Q_attributesDataProvider(object, name, property)
{
    int i = 0;
    // we declare as well new Q_milsCoordinates attribute for each vertex
    QString propname;

    // get property:
    D_sharedVerticesWrapper debug = qp_objectAssociated->getAttribute (
q_propertyName ).value<D_sharedVerticesWrapper>();

      Q_sharedVertices vertices = debug.getVertices();

    i = 10;

    // go through each vertex
    foreach (Q_milsCoordinates *vertex, *vertices->lq_dataArray)
    {
        QVariant toset(Q_milsCoordinates(*vertex));

        // generic vertex name
        propname = QString ("Vertex %1").arg(i++);
        // vertex is dynamic, we pass pointer only. must be care
        // not to destroy origin. this would make a total mess
        setProperty (propname.toAscii(), toset);
    }
}
---------------------------------------

When tracing inside of this constructor debugger is aware only of 'this',
'object', 'name' and 'property' variables, however it shows errors when
trying to watch 'i', 'debug', 'vertices', 'vertex'. When I force watch of
those, I get error mentioned before.



-----------------------------------------
Relevant output of debugging session is here:


(gdb) whatis this
whatis this
type = class Q_attributesDataProvider_vertices * const
^done
(gdb) print /x &object
print /x &object
$151 = 0xbfc38e24
^done
(gdb) whatis object
whatis object
type = class D_objectBase *
^done
(gdb) print /x &name
print /x &name
$152 = 0xbfc38e4c
^done
(gdb) whatis name
whatis name
type = const QString &
^done
(gdb) print /x &property
print /x &property
$153 = 0xbfc38e50
^done
(gdb) whatis property
whatis property
type = const QString &
^done
(gdb) -var-delete "KDEV26"
Variable object not found
^error,msg="Variable object not found"
(gdb) print /x &debug
print /x &debug
No symbol "debug" in current context.
^error,msg="No symbol \"debug\" in current context."
(gdb) -var-create KDEV27 * "debug"
mi_cmd_var_create: unable to create variable object
^error,msg="mi_cmd_var_create: unable to create variable object"
(gdb) -var-update *
^done,changelist=[{name="KDEV25",in_scope="true",type_changed="false"},{name="KDEV24",in_scope="true",type_changed="false"}]

------------
i put erratic sections in bold. This happens when I try to display variable
'debug'.


Is there any problem I'm not aware of? Is this a gdb bug? When I was
comparing compilation process of a small QTApplication program and mine, I
didn't see any differences in compilation arguments......


thanks


d.