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
Marco Bubke
flatpak-qt-creator
Commits
d80d68b7
Commit
d80d68b7
authored
Mar 17, 2010
by
hjk
Browse files
debugger: base individual formats on object addresses, not on inames
parent
7b49fdea
Changes
4
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/gdbmacros/dumper.py
View file @
d80d68b7
...
...
@@ -1054,7 +1054,7 @@ class Dumper:
self
.
safePutItemHelper
(
item
)
def
itemFormat
(
self
,
item
):
format
=
self
.
formats
.
get
(
item
.
iname
)
format
=
self
.
formats
.
get
(
str
(
cleanAddress
(
item
.
value
.
address
))
)
if
format
is
None
:
format
=
self
.
typeformats
.
get
(
stripClassTag
(
str
(
item
.
value
.
type
)))
return
format
...
...
src/plugins/debugger/watchhandler.cpp
View file @
d80d68b7
...
...
@@ -230,9 +230,9 @@ void WatchData::setType(const QString &str, bool guessChildrenFromType)
}
}
void
WatchData
::
setAddress
(
const
Q
String
&
str
)
void
WatchData
::
setAddress
(
const
Q
ByteArray
&
a
)
{
addr
=
str
.
toLatin1
()
;
addr
=
a
;
}
QString
WatchData
::
toString
()
const
...
...
@@ -783,7 +783,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
return
QVariant
(
QLatin1Char
(
'*'
)
+
item
->
parent
->
name
);
return
data
.
name
;
case
1
:
{
int
format
=
m_handler
->
m_individualFormats
.
value
(
data
.
iname
,
-
1
);
int
format
=
m_handler
->
m_individualFormats
.
value
(
data
.
addr
,
-
1
);
if
(
format
==
-
1
)
format
=
m_handler
->
m_typeFormats
.
value
(
data
.
type
,
-
1
);
return
truncateValue
(
formattedValue
(
data
,
format
));
...
...
@@ -839,7 +839,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
return
m_handler
->
m_typeFormats
.
value
(
data
.
type
,
-
1
);
case
IndividualFormatRole
:
return
m_handler
->
m_individualFormats
.
value
(
data
.
iname
,
-
1
);
return
m_handler
->
m_individualFormats
.
value
(
data
.
addr
,
-
1
);
case
AddressRole
:
{
if
(
!
data
.
addr
.
isEmpty
())
...
...
@@ -874,9 +874,9 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
}
else
if
(
role
==
IndividualFormatRole
)
{
const
int
format
=
value
.
toInt
();
if
(
format
==
-
1
)
{
m_handler
->
m_individualFormats
.
remove
(
data
.
iname
);
m_handler
->
m_individualFormats
.
remove
(
data
.
addr
);
}
else
{
m_handler
->
m_individualFormats
[
data
.
iname
]
=
format
;
m_handler
->
m_individualFormats
[
data
.
addr
]
=
format
;
}
m_handler
->
m_manager
->
updateWatchData
(
data
);
}
...
...
@@ -1620,10 +1620,10 @@ QByteArray WatchHandler::formatRequests() const
ba
.
append
(
"formats:"
);
if
(
!
m_individualFormats
.
isEmpty
())
{
QHashIterator
<
Q
String
,
int
>
it
(
m_individualFormats
);
QHashIterator
<
Q
ByteArray
,
int
>
it
(
m_individualFormats
);
while
(
it
.
hasNext
())
{
it
.
next
();
ba
.
append
(
it
.
key
()
.
toLatin1
()
);
ba
.
append
(
it
.
key
());
ba
.
append
(
'='
);
ba
.
append
(
QByteArray
::
number
(
it
.
value
()));
ba
.
append
(
','
);
...
...
src/plugins/debugger/watchhandler.h
View file @
d80d68b7
...
...
@@ -79,7 +79,7 @@ public:
void
setType
(
const
QString
&
,
bool
guessChildrenFromType
=
true
);
void
setValueToolTip
(
const
QString
&
);
void
setError
(
const
QString
&
);
void
setAddress
(
const
Q
String
&
address
);
void
setAddress
(
const
Q
ByteArray
&
);
bool
isSomethingNeeded
()
const
{
return
state
&
NeededMask
;
}
void
setAllNeeded
()
{
state
=
NeededMask
;
}
...
...
@@ -289,7 +289,7 @@ private:
QHash
<
QByteArray
,
int
>
m_watcherNames
;
QByteArray
watcherName
(
const
QByteArray
&
exp
);
QHash
<
QString
,
int
>
m_typeFormats
;
QHash
<
Q
String
,
int
>
m_individualFormats
;
QHash
<
Q
ByteArray
,
int
>
m_individualFormats
;
// Items expanded in the Locals & Watchers view.
QSet
<
QByteArray
>
m_expandedINames
;
...
...
src/plugins/debugger/watchwindow.cpp
View file @
d80d68b7
...
...
@@ -202,14 +202,15 @@ void WatchWindow::dropEvent(QDropEvent *ev)
void
WatchWindow
::
contextMenuEvent
(
QContextMenuEvent
*
ev
)
{
QModelIndex
idx
=
indexAt
(
ev
->
pos
());
QModelIndex
mi0
=
idx
.
sibling
(
idx
.
row
(),
0
);
QModelIndex
mi1
=
idx
.
sibling
(
idx
.
row
(),
1
);
QModelIndex
mi2
=
idx
.
sibling
(
idx
.
row
(),
2
);
QString
exp
=
model
()
->
data
(
mi0
,
ExpressionRole
).
toString
();
QString
type
=
model
()
->
data
(
mi2
).
toString
();
QStringList
alternativeFormats
=
const
QModelIndex
idx
=
indexAt
(
ev
->
pos
());
const
QModelIndex
mi0
=
idx
.
sibling
(
idx
.
row
(),
0
);
const
QModelIndex
mi1
=
idx
.
sibling
(
idx
.
row
(),
1
);
const
QModelIndex
mi2
=
idx
.
sibling
(
idx
.
row
(),
2
);
const
QString
addr
=
model
()
->
data
(
mi0
,
AddressRole
).
toString
();
const
QString
exp
=
model
()
->
data
(
mi0
,
ExpressionRole
).
toString
();
const
QString
type
=
model
()
->
data
(
mi2
).
toString
();
const
QStringList
alternativeFormats
=
model
()
->
data
(
mi0
,
TypeFormatListRole
).
toStringList
();
const
int
typeFormat
=
qMax
(
int
(
DecimalFormat
),
model
()
->
data
(
mi0
,
TypeFormatRole
).
toInt
());
...
...
@@ -224,8 +225,10 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QList
<
QAction
*>
individualFormatActions
;
QAction
*
clearIndividualFormatAction
=
0
;
if
(
idx
.
isValid
())
{
typeFormatMenu
.
setTitle
(
tr
(
"Change Format for Type '%1'"
).
arg
(
type
));
individualFormatMenu
.
setTitle
(
tr
(
"Change Format for Expression '%1'"
).
arg
(
exp
));
typeFormatMenu
.
setTitle
(
tr
(
"Change Format for Type '%1'"
).
arg
(
type
));
individualFormatMenu
.
setTitle
(
tr
(
"Change Format for Object at %1"
).
arg
(
addr
));
if
(
alternativeFormats
.
isEmpty
())
{
typeFormatMenu
.
setEnabled
(
false
);
individualFormatMenu
.
setEnabled
(
false
);
...
...
@@ -250,9 +253,9 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
}
}
}
else
{
typeFormatMenu
.
setTitle
(
tr
(
"Change
f
ormat for
t
ype"
));
typeFormatMenu
.
setTitle
(
tr
(
"Change
F
ormat for
T
ype"
));
typeFormatMenu
.
setEnabled
(
false
);
individualFormatMenu
.
setTitle
(
tr
(
"Change
f
ormat for
expression
"
));
individualFormatMenu
.
setTitle
(
tr
(
"Change
F
ormat for
Object
"
));
individualFormatMenu
.
setEnabled
(
false
);
}
...
...
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