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
72671f14
Commit
72671f14
authored
Jan 17, 2011
by
hjk
Browse files
debugger: extract qt namespace before running the inferior.
parent
fa304b45
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/gdb/abstractplaingdbadapter.cpp
View file @
72671f14
...
...
@@ -94,9 +94,24 @@ void AbstractPlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &respon
void
AbstractPlainGdbAdapter
::
runEngine
()
{
QTC_ASSERT
(
state
()
==
EngineRunRequested
,
qDebug
()
<<
state
());
m_engine
->
postCommand
(
"print QString"
,
CB
(
handleNamespaceExtraction
));
m_engine
->
postCommand
(
"-exec-run"
,
GdbEngine
::
RunRequest
,
CB
(
handleExecRun
));
}
void
AbstractPlainGdbAdapter
::
handleNamespaceExtraction
(
const
GdbResponse
&
response
)
{
if
(
response
.
resultClass
==
GdbResultDone
)
{
// $1 = {void (myns::QString * const, const char *)} 0x8058e2c <QString>"}
const
QByteArray
ba
=
response
.
data
.
findChild
(
"consolestreamoutput"
).
data
();
const
int
posQString
=
ba
.
indexOf
(
"QString"
);
const
int
posNs
=
ba
.
lastIndexOf
(
'('
,
posQString
)
+
1
;
const
QByteArray
ns
=
ba
.
mid
(
posNs
,
posQString
-
posNs
);
//qDebug() << "BA: " << response.toString() << ba << posQString << posNs << ns;
if
(
!
ns
.
isEmpty
())
m_engine
->
setQtNamespace
(
ns
);
}
}
void
AbstractPlainGdbAdapter
::
handleExecRun
(
const
GdbResponse
&
response
)
{
QTC_ASSERT
(
state
()
==
EngineRunRequested
,
qDebug
()
<<
state
());
...
...
src/plugins/debugger/gdb/abstractplaingdbadapter.h
View file @
72671f14
...
...
@@ -52,6 +52,7 @@ public:
protected:
void
handleInfoTarget
(
const
GdbResponse
&
response
);
void
handleNamespaceExtraction
(
const
GdbResponse
&
response
);
private:
virtual
QByteArray
execFilePath
()
const
=
0
;
...
...
@@ -60,7 +61,6 @@ private:
virtual
QString
fromLocalEncoding
(
const
QByteArray
&
b
)
const
=
0
;
void
handleExecRun
(
const
GdbResponse
&
response
);
void
handleFileExecAndSymbols
(
const
GdbResponse
&
response
);
};
}
// namespace Debugger
...
...
src/plugins/debugger/gdb/gdbengine.cpp
View file @
72671f14
...
...
@@ -3719,30 +3719,32 @@ void GdbEngine::watchPoint(const QPoint &pnt)
{
QByteArray
x
=
QByteArray
::
number
(
pnt
.
x
());
QByteArray
y
=
QByteArray
::
number
(
pnt
.
y
());
postCommand
(
"print 'QApplication::widgetAt'("
+
x
+
','
+
y
+
')'
,
postCommand
(
"print '"
+
qtNamespace
()
+
"QApplication::widgetAt'("
+
x
+
','
+
y
+
')'
,
NeedsStop
,
CB
(
handleWatchPoint
));
}
void
GdbEngine
::
handleWatchPoint
(
const
GdbResponse
&
response
)
{
if
(
response
.
resultClass
==
GdbResultDone
)
{
GdbMi
contents
=
response
.
data
.
findChild
(
"consolestreamoutput"
);
const
GdbMi
contents
=
response
.
data
.
findChild
(
"consolestreamoutput"
);
// "$5 = (void *) 0xbfa7ebfc\n"
QByteArray
ba
=
parsePlainConsoleStream
(
response
);
const
QByteArray
ba
=
parsePlainConsoleStream
(
response
);
//qDebug() << "BA: " << ba;
const
int
posWidget
=
ba
.
indexOf
(
"QWidget"
);
if
(
posWidget
==
-
1
)
return
;
const
int
posNs
=
ba
.
lastIndexOf
(
' '
,
posWidget
)
+
1
;
if
(
posNs
==
0
)
return
;
const
int
pos0x
=
ba
.
indexOf
(
"0x"
,
posWidget
+
7
);
if
(
pos0x
==
-
1
)
return
;
const
QByteArray
addr
=
ba
.
mid
(
pos0x
);
const
QByteArray
ns
=
ba
.
mid
(
posNs
,
posWidget
-
posNs
);
const
QByteArray
type
=
ns
.
isEmpty
()
?
"QWidget*"
:
(
"'"
+
ns
+
"QWidget'*"
);
const
QString
exp
=
_
(
"(*(%1)%2)"
).
arg
(
_
(
type
)).
arg
(
_
(
addr
));
watchHandler
()
->
watchExpression
(
exp
);
if
(
posWidget
==
-
1
||
posNs
==
0
||
pos0x
==
-
1
)
{
showStatusMessage
(
tr
(
"Cannot read widget data: %1"
).
arg
(
_
(
ba
)));
}
else
{
const
QByteArray
addr
=
ba
.
mid
(
pos0x
);
//const QByteArray ns = ba.mid(posNs, posWidget - posNs);
const
QByteArray
ns
=
qtNamespace
();
const
QByteArray
type
=
ns
.
isEmpty
()
?
"QWidget*"
:
(
"'"
+
ns
+
"QWidget'*"
);
const
QString
exp
=
_
(
"(*(%1)%2)"
).
arg
(
_
(
type
)).
arg
(
_
(
addr
));
// qDebug() << posNs << posWidget << pos0x << addr << ns << type;
watchHandler
()
->
watchExpression
(
exp
);
}
}
}
...
...
src/plugins/debugger/gdb/gdbengine.h
View file @
72671f14
...
...
@@ -116,6 +116,8 @@ private: ////////// General Interface //////////
virtual
void
executeDebuggerCommand
(
const
QString
&
command
);
virtual
QByteArray
qtNamespace
()
const
{
return
m_dumperHelper
.
qtNamespace
();
}
virtual
void
setQtNamespace
(
const
QByteArray
&
ns
)
{
return
m_dumperHelper
.
setQtNamespace
(
ns
);
}
private:
////////// General State //////////
...
...
src/plugins/debugger/watchutils.cpp
View file @
72671f14
...
...
@@ -970,7 +970,8 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents)
qDebug
()
<<
"parseQuery"
<<
contents
.
toString
(
true
,
2
);
// Common info, dumper version, etc
m_qtNamespace
=
contents
.
findChild
(
"namespace"
).
data
();
QByteArray
ns
=
contents
.
findChild
(
"namespace"
).
data
();
setQtNamespace
(
ns
);
int
qtv
=
0
;
const
GdbMi
qtversion
=
contents
.
findChild
(
"qtversion"
);
if
(
qtversion
.
children
().
size
()
==
3
)
{
...
...
src/plugins/debugger/watchutils.h
View file @
72671f14
...
...
@@ -172,6 +172,8 @@ public:
int
qtVersion
()
const
;
QByteArray
qtVersionString
()
const
;
QByteArray
qtNamespace
()
const
;
void
setQtNamespace
(
const
QByteArray
&
ba
)
{
if
(
!
ba
.
isEmpty
())
m_qtNamespace
=
ba
;
}
// Complete parse of "query" (protocol 1) response from debuggee buffer.
// 'data' excludes the leading indicator character.
...
...
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