Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
fb7f576e
Commit
fb7f576e
authored
May 17, 2011
by
hjk
Browse files
debuggger: allow change of display for templated types
parent
58176505
Changes
5
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/gdbmacros/gdbmacros.py
View file @
fb7f576e
...
...
@@ -2301,6 +2301,9 @@ def qdump__QScriptValue(d, item):
#
#######################################################################
#def qform__Eigen__Matrix():
# return "Transposed"
def
qdump__Eigen__Matrix
(
d
,
item
):
innerType
=
templateArgument
(
item
.
value
.
type
,
0
)
storage
=
item
.
value
[
"m_storage"
]
...
...
@@ -2318,18 +2321,15 @@ def qdump__Eigen__Matrix(d, item):
d
.
putField
(
"keeporder"
,
"1"
)
d
.
putNumChild
(
nrows
*
ncols
)
limit
=
100
limit
=
100
00
nncols
=
min
(
ncols
,
limit
)
nnrows
=
min
(
nrows
,
limit
*
limit
/
nncols
)
if
d
.
isExpanded
(
item
):
#format = d.itemFormat(item) # format == 1 is "Transposed"
iname
=
item
.
iname
with
Children
(
d
,
nrows
*
ncols
,
innerType
):
if
ncols
==
1
:
for
i
in
range
(
0
,
nnrows
):
v
=
(
p
+
i
).
dereference
()
d
.
putSubItem
(
Item
(
v
,
item
.
iname
))
elif
nrows
==
1
:
for
i
in
range
(
0
,
nncols
):
if
ncols
==
1
or
nrows
==
1
:
for
i
in
range
(
0
,
min
(
nrows
*
ncols
,
10000
)):
v
=
(
p
+
i
).
dereference
()
d
.
putSubItem
(
Item
(
v
,
item
.
iname
))
elif
rowMajor
==
1
:
...
...
@@ -2342,7 +2342,7 @@ def qdump__Eigen__Matrix(d, item):
for
j
in
range
(
0
,
nncols
):
for
i
in
range
(
0
,
nnrows
):
name
=
"[%d,%d]"
%
(
i
,
j
)
v
=
(
p
+
i
*
ncols
+
j
).
dereference
()
v
=
(
p
+
i
+
j
*
nrows
).
dereference
()
d
.
putSubItem
(
Item
(
v
,
item
.
iname
,
None
,
name
))
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
fb7f576e
...
...
@@ -3913,7 +3913,7 @@ void GdbEngine::insertData(const WatchData &data0)
void
GdbEngine
::
assignValueInDebugger
(
const
WatchData
*
data
,
const
QString
&
expression
,
const
QVariant
&
value
)
{
if
(
hasPython
())
{
if
(
hasPython
()
&&
!
isIntOrFloatType
(
data
->
type
)
)
{
QByteArray
cmd
=
"bbedit "
+
data
->
type
.
toHex
()
+
','
+
expression
.
toUtf8
().
toHex
()
+
','
...
...
src/plugins/debugger/watchhandler.cpp
View file @
fb7f576e
...
...
@@ -81,6 +81,12 @@ QHash<QByteArray, int> WatchHandler::m_watcherNames;
QHash
<
QByteArray
,
int
>
WatchHandler
::
m_typeFormats
;
int
WatchHandler
::
m_unprintableBase
=
0
;
static
QByteArray
stripTemplate
(
const
QByteArray
&
ba
)
{
int
pos
=
ba
.
indexOf
(
'<'
);
return
pos
==
-
1
?
ba
:
ba
.
left
(
pos
);
}
////////////////////////////////////////////////////////////////////
//
// WatchItem
...
...
@@ -577,7 +583,7 @@ int WatchModel::itemFormat(const WatchData &data) const
const
int
individualFormat
=
m_handler
->
m_individualFormats
.
value
(
data
.
iname
,
-
1
);
if
(
individualFormat
!=
-
1
)
return
individualFormat
;
return
m_handler
->
m_typeFormats
.
value
(
data
.
type
,
-
1
);
return
m_handler
->
m_typeFormats
.
value
(
stripTemplate
(
data
.
type
)
,
-
1
);
}
static
inline
QString
expression
(
const
WatchItem
*
item
)
...
...
@@ -717,13 +723,14 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
<<
tr
(
"binary"
)
<<
tr
(
"octal"
);
// Hack: Compensate for namespaces.
QString
type
=
data
.
type
;
QString
type
=
stripTemplate
(
data
.
type
)
;
int
pos
=
type
.
indexOf
(
"::Q"
);
if
(
pos
>=
0
&&
type
.
count
(
':'
)
==
2
)
type
=
type
.
mid
(
pos
+
2
);
pos
=
type
.
indexOf
(
'<'
);
if
(
pos
>=
0
)
type
=
type
.
left
(
pos
);
type
.
replace
(
':'
,
'_'
);
return
m_handler
->
m_reportedTypeFormats
.
value
(
type
);
}
case
LocalsTypeRole
:
...
...
@@ -731,7 +738,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
case
LocalsRawTypeRole
:
return
QString
::
fromLatin1
(
data
.
type
);
case
LocalsTypeFormatRole
:
return
m_handler
->
m_typeFormats
.
value
(
data
.
type
,
-
1
);
return
m_handler
->
m_typeFormats
.
value
(
stripTemplate
(
data
.
type
)
,
-
1
);
case
LocalsIndividualFormatRole
:
return
m_handler
->
m_individualFormats
.
value
(
data
.
iname
,
-
1
);
...
...
@@ -875,7 +882,8 @@ QVariant WatchModel::headerData(int section, Qt::Orientation orientation, int ro
// Set this before using any of the below according to action
static
bool
sortWatchDataAlphabetically
=
true
;
static
bool
watchDataLessThan
(
const
QByteArray
&
iname1
,
int
sortId1
,
const
QByteArray
&
iname2
,
int
sortId2
)
static
bool
watchDataLessThan
(
const
QByteArray
&
iname1
,
int
sortId1
,
const
QByteArray
&
iname2
,
int
sortId2
)
{
if
(
!
sortWatchDataAlphabetically
)
return
sortId1
<
sortId2
;
...
...
@@ -902,9 +910,10 @@ static bool watchDataLessThan(const QByteArray &iname1, int sortId1, const QByte
}
// Sort key for watch data consisting of iname and numerical sort id.
struct
WatchDataSortKey
{
explicit
WatchDataSortKey
(
const
WatchData
&
wd
)
:
iname
(
wd
.
iname
),
sortId
(
wd
.
sortId
)
{}
struct
WatchDataSortKey
{
explicit
WatchDataSortKey
(
const
WatchData
&
wd
)
:
iname
(
wd
.
iname
),
sortId
(
wd
.
sortId
)
{}
QByteArray
iname
;
int
sortId
;
};
...
...
@@ -1117,7 +1126,7 @@ void WatchModel::formatRequests(QByteArray *out, const WatchItem *item) const
{
int
format
=
m_handler
->
m_individualFormats
.
value
(
item
->
iname
,
-
1
);
if
(
format
==
-
1
)
format
=
m_handler
->
m_typeFormats
.
value
(
item
->
type
,
-
1
);
format
=
m_handler
->
m_typeFormats
.
value
(
stripTemplate
(
item
->
type
)
,
-
1
);
if
(
format
!=
-
1
)
*
out
+=
item
->
iname
+
":format="
+
QByteArray
::
number
(
format
)
+
','
;
foreach
(
const
WatchItem
*
child
,
item
->
children
)
...
...
@@ -1574,8 +1583,9 @@ QModelIndex WatchHandler::itemIndex(const QByteArray &iname) const
return
QModelIndex
();
}
void
WatchHandler
::
setFormat
(
const
QByteArray
&
type
,
int
format
)
void
WatchHandler
::
setFormat
(
const
QByteArray
&
type
0
,
int
format
)
{
const
QByteArray
type
=
stripTemplate
(
type0
);
if
(
format
==
-
1
)
m_typeFormats
.
remove
(
type
);
else
...
...
@@ -1593,7 +1603,7 @@ int WatchHandler::format(const QByteArray &iname) const
if
(
const
WatchData
*
item
=
findItem
(
iname
))
{
int
result
=
m_individualFormats
.
value
(
item
->
iname
,
-
1
);
if
(
result
==
-
1
)
result
=
m_typeFormats
.
value
(
item
->
type
,
-
1
);
result
=
m_typeFormats
.
value
(
stripTemplate
(
item
->
type
)
,
-
1
);
}
return
result
;
}
...
...
@@ -1651,7 +1661,7 @@ QByteArray WatchHandler::individualFormatRequests() const
void
WatchHandler
::
addTypeFormats
(
const
QByteArray
&
type
,
const
QStringList
&
formats
)
{
m_reportedTypeFormats
.
insert
(
type
,
formats
);
m_reportedTypeFormats
.
insert
(
stripTemplate
(
type
)
,
formats
);
}
QString
WatchHandler
::
editorContents
()
...
...
src/plugins/debugger/watchwindow.cpp
View file @
fb7f576e
...
...
@@ -146,15 +146,29 @@ private:
// Watch model query helpers.
static
inline
quint64
addressOf
(
const
QModelIndex
&
m
)
{
return
m
.
data
(
LocalsAddressRole
).
toULongLong
();
}
{
return
m
.
data
(
LocalsAddressRole
).
toULongLong
();
}
static
inline
quint64
pointerValueOf
(
const
QModelIndex
&
m
)
{
return
m
.
data
(
LocalsPointerValueRole
).
toULongLong
();
}
{
return
m
.
data
(
LocalsPointerValueRole
).
toULongLong
();
}
static
inline
QString
nameOf
(
const
QModelIndex
&
m
)
{
return
m
.
data
().
toString
();
}
{
return
m
.
data
().
toString
();
}
static
inline
QString
typeOf
(
const
QModelIndex
&
m
)
{
return
m
.
data
(
LocalsTypeRole
).
toString
();
}
{
return
m
.
data
(
LocalsTypeRole
).
toString
();
}
static
inline
uint
sizeOf
(
const
QModelIndex
&
m
)
{
return
m
.
data
(
LocalsSizeRole
).
toUInt
();
}
{
return
m
.
data
(
LocalsSizeRole
).
toUInt
();
}
// Create a map of value->name for register markup
typedef
QMap
<
quint64
,
QString
>
RegisterMap
;
...
...
tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
View file @
fb7f576e
...
...
@@ -2590,6 +2590,8 @@ void testEigen()
#if USE_EIGEN
using
namespace
Eigen
;
Vector3d
test
=
Vector3d
::
Zero
();
Matrix3d
myMatrix
=
Matrix3d
::
Constant
(
5
);
MatrixXd
myDynamicMatrix
(
30
,
10
);
...
...
@@ -2597,11 +2599,11 @@ void testEigen()
myDynamicMatrix
(
1
,
0
)
=
1
;
myDynamicMatrix
(
2
,
0
)
=
2
;
Matrix
<
double
,
2
,
1
,
Row
Major
>
row
MajorMatrix
1
;
row
MajorMatrix
1
<<
3
4
,
44
;
Matrix
<
double
,
2
,
3
,
Col
Major
>
col
MajorMatrix
;
col
MajorMatrix
<<
0
,
1
,
2
,
3
,
4
,
5
;
Matrix
<
double
,
2
,
2
,
RowMajor
>
rowMajorMatrix
;
rowMajorMatrix
<<
0
,
1
,
2
,
3
;
Matrix
<
double
,
2
,
3
,
RowMajor
>
rowMajorMatrix
;
rowMajorMatrix
<<
0
,
1
,
2
,
3
,
4
,
5
;
int
i
=
0
;
++
i
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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