Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
fe03946d
Commit
fe03946d
authored
Mar 01, 2011
by
hjk
Browse files
debugger: Switch off address printing for generated items
parent
fa919345
Changes
3
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/gdbmacros/dumper.py
View file @
fe03946d
...
...
@@ -293,6 +293,18 @@ class OutputSafer:
return
False
class
NoAddress
:
def
__init__
(
self
,
d
):
self
.
d
=
d
def
__enter__
(
self
):
self
.
savedPrintsAddress
=
self
.
d
.
printsAddress
self
.
d
.
printsAddress
=
False
def
__exit__
(
self
,
exType
,
exValue
,
exTraceBack
):
self
.
d
.
printsAddress
=
self
.
savedPrintsAddress
class
SubItem
:
def
__init__
(
self
,
d
):
self
.
d
=
d
...
...
@@ -1114,6 +1126,7 @@ SalCommand()
class
Dumper
:
def
__init__
(
self
,
args
):
self
.
output
=
""
self
.
printsAddress
=
True
self
.
currentChildType
=
""
self
.
currentChildNumChild
=
-
1
self
.
currentMaxNumChilds
=
-
1
...
...
@@ -1402,7 +1415,8 @@ class Dumper:
self
.
currentTypePriority
=
priority
def
putAddress
(
self
,
addr
):
self
.
put
(
'addr="%s",'
%
cleanAddress
(
addr
))
if
self
.
printsAddress
:
self
.
put
(
'addr="%s",'
%
cleanAddress
(
addr
))
def
putNumChild
(
self
,
numchild
):
#warn("NUM CHILD: '%s' '%s'" % (numchild, self.currentChildNumChild))
...
...
@@ -1731,8 +1745,10 @@ class Dumper:
innerType
=
realtype
.
target
()
innerTypeName
=
str
(
innerType
.
unqualified
())
# Never dereference char types.
if
innerTypeName
!=
"char"
and
innerTypeName
!=
"signed char"
\
and
innerTypeName
!=
"unsigned char"
and
innerTypeName
!=
"wchar_t"
:
if
innerTypeName
!=
"char"
\
and
innerTypeName
!=
"signed char"
\
and
innerTypeName
!=
"unsigned char"
\
and
innerTypeName
!=
"wchar_t"
:
self
.
putType
(
innerType
)
savedCurrentChildType
=
self
.
currentChildType
self
.
currentChildType
=
stripClassTag
(
str
(
innerType
))
...
...
@@ -1806,7 +1822,7 @@ class Dumper:
with
Children
(
self
):
self
.
putFields
(
item
)
def
putFields
(
self
,
item
):
def
putFields
(
self
,
item
,
dumpBase
=
True
):
value
=
item
.
value
type
=
stripTypedefs
(
value
.
type
)
fields
=
extractFields
(
type
)
...
...
@@ -1844,12 +1860,13 @@ class Dumper:
# Field is base type. We cannot use field.name as part
# of the iname as it might contain spaces and other
# strange characters.
child
=
Item
(
value
.
cast
(
field
.
type
),
item
.
iname
,
"@%d"
%
baseNumber
,
field
.
name
)
baseNumber
+=
1
with
SubItem
(
self
):
self
.
put
(
'iname="%s",'
%
child
.
iname
)
self
.
putItem
(
child
)
if
dumpBase
:
child
=
Item
(
value
.
cast
(
field
.
type
),
item
.
iname
,
"@%d"
%
baseNumber
,
field
.
name
)
baseNumber
+=
1
with
SubItem
(
self
):
self
.
put
(
'iname="%s",'
%
child
.
iname
)
self
.
putItem
(
child
)
elif
len
(
field
.
name
)
==
0
:
# Anonymous union. We need a dummy name to distinguish
# multiple anonymous unions in the struct.
...
...
share/qtcreator/gdbmacros/gdbmacros.py
View file @
fe03946d
...
...
@@ -725,8 +725,8 @@ def qdump__QObject(d, item):
iname
=
item
.
iname
+
".data"
if
d
.
isExpandedIName
(
iname
):
with
Children
(
d
):
child
=
Item
(
d_ptr
,
item
.
iname
)
d
.
putFields
(
child
)
child
=
Item
(
d_ptr
,
iname
)
d
.
putFields
(
child
,
False
)
d
.
putFields
(
item
)
...
...
@@ -803,6 +803,7 @@ def qdump__QObject(d, item):
# Static properties.
propertyData
=
metaData
[
7
]
for
i
in
xrange
(
staticPropertyCount
):
with
NoAddress
(
d
):
with
SubItem
(
d
):
offset
=
propertyData
+
3
*
i
propertyName
=
extractCString
(
metaStringData
,
...
...
@@ -844,19 +845,22 @@ def qdump__QObject(d, item):
else
:
# User types.
# func = "typeToName(('%sQVariant::Type')%d)" % (d.ns, variantType)
# func = "typeToName(('%sQVariant::Type')%d)"
# % (d.ns, variantType)
# type = str(call(item.value, func))
# type = type[type.find('"') + 1 : type.rfind('"')]
# type = type.replace("Q", d.ns + "Q") # HACK!
# data = call(item.value, "constData")
# tdata = data.cast(lookupType(type).pointer()).dereference()
# tdata = data.cast(lookupType(type).pointer())
# .dereference()
# d.putValue("(%s)" % tdata.type)
# d.putType(tdata.type)
# d.putNumChild(1)
# if d.isExpanded(item):
# with Children(d):
# d.putSubItem(Item(tdata, item.iname, "data", "data"))
warn
(
"FIXME: CUSTOM QOBJECT PROPERTIES NOT IMPLEMENTED: %s %s"
# d.putSubItem(Item(tdata, item.iname,
# "data", "data"))
warn
(
"FIXME: CUSTOM QOBJECT PROPERTY: %s %s"
%
(
propertyType
,
innert
))
d
.
putType
(
propertyType
)
d
.
putValue
(
"..."
)
...
...
@@ -1611,6 +1615,7 @@ def qdump__QVariant(d, item):
if
d
.
isExpanded
(
item
):
with
Children
(
d
):
#warn("TDATA: %s" % tdata)
with
NoAddress
(
d
):
d
.
putSubItem
(
Item
(
tdata
,
item
.
iname
,
"data"
,
"data"
))
return
tdata
.
type
...
...
tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
View file @
fe03946d
...
...
@@ -137,10 +137,14 @@ int z;
class
DerivedObjectPrivate
:
public
QObjectPrivate
{
public:
DerivedObjectPrivate
()
:
m_extraX
(
43
),
m_extraY
(
44
)
{}
DerivedObjectPrivate
()
{
m_extraX
=
43
;
m_extraY
.
append
(
"xxx"
);
}
int
m_extraX
;
in
t
m_extraY
;
QStringLis
t
m_extraY
;
};
class
DerivedObject
:
public
QObject
...
...
@@ -153,12 +157,12 @@ public:
{}
Q_PROPERTY
(
int
x
READ
x
WRITE
setX
)
Q_PROPERTY
(
in
t
y
READ
y
WRITE
setY
)
Q_PROPERTY
(
QStringLis
t
y
READ
y
WRITE
setY
)
int
x
()
const
;
void
setX
(
int
x
);
in
t
y
()
const
;
void
setY
(
in
t
y
);
QStringLis
t
y
()
const
;
void
setY
(
QStringLis
t
y
);
private:
Q_DECLARE_PRIVATE
(
DerivedObject
)
...
...
@@ -176,13 +180,13 @@ void DerivedObject::setX(int x)
d
->
m_extraX
=
x
;
}
in
t
DerivedObject
::
y
()
const
QStringLis
t
DerivedObject
::
y
()
const
{
Q_D
(
const
DerivedObject
);
return
d
->
m_extraY
;
}
void
DerivedObject
::
setY
(
in
t
y
)
void
DerivedObject
::
setY
(
QStringLis
t
y
)
{
Q_D
(
DerivedObject
);
d
->
m_extraY
=
y
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment