debugger: extract qt namespace before running the inferior.

This commit is contained in:
hjk
2011-01-17 15:11:11 +01:00
parent fa304b45e5
commit 72671f1463
6 changed files with 38 additions and 16 deletions

View File

@@ -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());