forked from qt-creator/qt-creator
Debugger: Move python initialization after first stop
This enables access to object-specific plain gdb pretty printers which are not available before startup. Change-Id: Icc8cbec177825d4d1adb1957a618abb33cbbf319 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -185,7 +185,7 @@ void GdbCoreEngine::handleTargetCore(const GdbResponse &response)
|
|||||||
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
// HACK: The namespace is not accessible in the initial run.
|
// HACK: The namespace is not accessible in the initial run.
|
||||||
loadPythonDumpers();
|
tryLoadPythonDumpers();
|
||||||
showMessage(tr("Attached to core."), StatusBar);
|
showMessage(tr("Attached to core."), StatusBar);
|
||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
// Due to the auto-solib-add off setting, we don't have any
|
// Due to the auto-solib-add off setting, we don't have any
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
|
|||||||
m_terminalTrap = startParameters.useTerminal;
|
m_terminalTrap = startParameters.useTerminal;
|
||||||
m_fullStartDone = false;
|
m_fullStartDone = false;
|
||||||
m_forceAsyncModel = false;
|
m_forceAsyncModel = false;
|
||||||
|
m_pythonAttemptedToLoad = false;
|
||||||
|
|
||||||
invalidateSourcesList();
|
invalidateSourcesList();
|
||||||
|
|
||||||
@@ -1433,11 +1434,12 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tryLoadPythonDumpers();
|
||||||
|
|
||||||
bool gotoHandleStop1 = true;
|
bool gotoHandleStop1 = true;
|
||||||
if (!m_fullStartDone) {
|
if (!m_fullStartDone) {
|
||||||
m_fullStartDone = true;
|
m_fullStartDone = true;
|
||||||
postCommand("sharedlibrary .*");
|
postCommand("sharedlibrary .*");
|
||||||
loadPythonDumpers();
|
|
||||||
postCommand("p 3", CB(handleStop1));
|
postCommand("p 3", CB(handleStop1));
|
||||||
gotoHandleStop1 = false;
|
gotoHandleStop1 = false;
|
||||||
}
|
}
|
||||||
@@ -4842,16 +4844,19 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
} else {
|
} else {
|
||||||
m_fullStartDone = true;
|
m_fullStartDone = true;
|
||||||
postCommand("set auto-solib-add on", ConsoleCommand);
|
postCommand("set auto-solib-add on", ConsoleCommand);
|
||||||
loadPythonDumpers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dummy command to guarantee a roundtrip before the adapter proceed.
|
|
||||||
postCommand("pwd", ConsoleCommand, CB(reportEngineSetupOk));
|
|
||||||
|
|
||||||
if (debuggerCore()->boolSetting(MultiInferior)) {
|
if (debuggerCore()->boolSetting(MultiInferior)) {
|
||||||
//postCommand("set follow-exec-mode new");
|
//postCommand("set follow-exec-mode new");
|
||||||
postCommand("set detach-on-fork off");
|
postCommand("set detach-on-fork off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quick check whether we have python.
|
||||||
|
postCommand("python print 43", ConsoleCommand, CB(handleHasPython));
|
||||||
|
|
||||||
|
// Dummy command to guarantee a roundtrip before the adapter proceed.
|
||||||
|
// Make sure this stays the last command in startGdb().
|
||||||
|
postCommand("pwd", ConsoleCommand, CB(reportEngineSetupOk));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::reportEngineSetupOk(const GdbResponse &response)
|
void GdbEngine::reportEngineSetupOk(const GdbResponse &response)
|
||||||
@@ -4888,10 +4893,15 @@ void GdbEngine::loadInitScript()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::loadPythonDumpers()
|
void GdbEngine::tryLoadPythonDumpers()
|
||||||
{
|
{
|
||||||
if (m_forceAsyncModel)
|
if (m_forceAsyncModel)
|
||||||
return;
|
return;
|
||||||
|
if (!m_hasPython)
|
||||||
|
return;
|
||||||
|
if (m_pythonAttemptedToLoad)
|
||||||
|
return;
|
||||||
|
m_pythonAttemptedToLoad = true;
|
||||||
|
|
||||||
const QByteArray dumperSourcePath =
|
const QByteArray dumperSourcePath =
|
||||||
Core::ICore::resourcePath().toLocal8Bit() + "/dumper/";
|
Core::ICore::resourcePath().toLocal8Bit() + "/dumper/";
|
||||||
@@ -4909,7 +4919,7 @@ void GdbEngine::loadPythonDumpers()
|
|||||||
|
|
||||||
loadInitScript();
|
loadInitScript();
|
||||||
|
|
||||||
postCommand("bbsetup", ConsoleCommand, CB(handleHasPython));
|
postCommand("bbsetup", ConsoleCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleGdbError(QProcess::ProcessError error)
|
void GdbEngine::handleGdbError(QProcess::ProcessError error)
|
||||||
|
|||||||
@@ -230,12 +230,13 @@ protected: ////////// Gdb Process Management //////////
|
|||||||
|
|
||||||
void startGdb(const QStringList &args = QStringList());
|
void startGdb(const QStringList &args = QStringList());
|
||||||
void reportEngineSetupOk(const GdbResponse &response);
|
void reportEngineSetupOk(const GdbResponse &response);
|
||||||
|
void handleCheckForPython(const GdbResponse &response);
|
||||||
void handleInferiorShutdown(const GdbResponse &response);
|
void handleInferiorShutdown(const GdbResponse &response);
|
||||||
void handleGdbExit(const GdbResponse &response);
|
void handleGdbExit(const GdbResponse &response);
|
||||||
void handleNamespaceExtraction(const GdbResponse &response);
|
void handleNamespaceExtraction(const GdbResponse &response);
|
||||||
|
|
||||||
void loadInitScript();
|
void loadInitScript();
|
||||||
void loadPythonDumpers();
|
void tryLoadPythonDumpers();
|
||||||
void pythonDumpersFailed();
|
void pythonDumpersFailed();
|
||||||
|
|
||||||
// Something went wrong with the adapter *before* adapterStarted() was emitted.
|
// Something went wrong with the adapter *before* adapterStarted() was emitted.
|
||||||
@@ -705,6 +706,7 @@ protected:
|
|||||||
// debug information.
|
// debug information.
|
||||||
bool attemptQuickStart() const;
|
bool attemptQuickStart() const;
|
||||||
bool m_fullStartDone;
|
bool m_fullStartDone;
|
||||||
|
bool m_pythonAttemptedToLoad;
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
bool m_forceAsyncModel;
|
bool m_forceAsyncModel;
|
||||||
|
|||||||
Reference in New Issue
Block a user