Commit b2387fdd authored by hjk's avatar hjk
Browse files

Fixes: debugger: load modules list early

    Details:  feels better
parent 5f33b124
...@@ -107,11 +107,14 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, ...@@ -107,11 +107,14 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
: RunControl(runConfiguration), m_manager(manager), m_running(false) : RunControl(runConfiguration), m_manager(manager), m_running(false)
{ {
connect(m_manager, SIGNAL(debuggingFinished()), connect(m_manager, SIGNAL(debuggingFinished()),
this, SLOT(debuggingFinished())); this, SLOT(debuggingFinished()),
Qt::QueuedConnection);
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)), connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
this, SLOT(slotAddToOutputWindowInline(QString))); this, SLOT(slotAddToOutputWindowInline(QString)),
Qt::QueuedConnection);
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)), connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
this, SLOT(bringApplicationToForeground(qint64))); this, SLOT(bringApplicationToForeground(qint64)),
Qt::QueuedConnection);
} }
void DebuggerRunControl::start() void DebuggerRunControl::start()
......
...@@ -250,23 +250,16 @@ GdbEngine::GdbEngine(DebuggerManager *parent) ...@@ -250,23 +250,16 @@ GdbEngine::GdbEngine(DebuggerManager *parent)
{ {
q = parent; q = parent;
qq = parent->engineInterface(); qq = parent->engineInterface();
init(); initializeVariables();
initializeConnections();
} }
GdbEngine::~GdbEngine() GdbEngine::~GdbEngine()
{ {
} }
void GdbEngine::init() void GdbEngine::initializeConnections()
{ {
m_pendingRequests = 0;
m_waitingForBreakpointSynchronizationToContinue = false;
m_gdbVersion = 100;
m_outputCodec = QTextCodec::codecForLocale();
m_dataDumperState = DataDumperUninitialized;
m_oldestAcceptableToken = -1;
// Gdb Process interaction // Gdb Process interaction
connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)), this, connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)), this,
SLOT(gdbProcError(QProcess::ProcessError))); SLOT(gdbProcError(QProcess::ProcessError)));
...@@ -294,6 +287,22 @@ void GdbEngine::init() ...@@ -294,6 +287,22 @@ void GdbEngine::init()
Qt::QueuedConnection); Qt::QueuedConnection);
} }
void GdbEngine::initializeVariables()
{
m_dataDumperState = DataDumperUninitialized;
m_gdbVersion = 100;
m_fullToShortName.clear();
m_shortToFullName.clear();
m_varToType.clear();
m_modulesListOutdated = true;
m_oldestAcceptableToken = -1;
m_outputCodec = QTextCodec::codecForLocale();
m_pendingRequests = 0;
m_waitingForBreakpointSynchronizationToContinue = false;
}
void GdbEngine::gdbProcError(QProcess::ProcessError error) void GdbEngine::gdbProcError(QProcess::ProcessError error)
{ {
QString msg; QString msg;
...@@ -1109,6 +1118,8 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) ...@@ -1109,6 +1118,8 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
sendCommand("set auto-solib-add off"); sendCommand("set auto-solib-add off");
sendCommand("set stop-on-solib-events 0"); sendCommand("set stop-on-solib-events 0");
} }
// nicer to see a bit of the world we live in
reloadModules();
// this will "continue" if done // this will "continue" if done
m_waitingForBreakpointSynchronizationToContinue = true; m_waitingForBreakpointSynchronizationToContinue = true;
QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization()));
...@@ -1118,7 +1129,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) ...@@ -1118,7 +1129,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
// fall through // fall through
} }
static bool modulesDirty = false;
if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) { if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) {
if (qq->wantsSelectedPluginBreakpoints()) { if (qq->wantsSelectedPluginBreakpoints()) {
qDebug() << "SHARED LIBRARY EVENT " << data.toString(); qDebug() << "SHARED LIBRARY EVENT " << data.toString();
...@@ -1128,7 +1138,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) ...@@ -1128,7 +1138,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
q->showStatusMessage(tr("Loading %1...").arg(QString(data.toString()))); q->showStatusMessage(tr("Loading %1...").arg(QString(data.toString())));
return; return;
} }
modulesDirty = true; m_modulesListOutdated = true;
// fall through // fall through
} }
...@@ -1183,11 +1193,11 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) ...@@ -1183,11 +1193,11 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
} }
if (isStoppedReason(reason) || reason.isEmpty()) { if (isStoppedReason(reason) || reason.isEmpty()) {
if (modulesDirty) { if (m_modulesListOutdated) {
sendCommand("-file-list-exec-source-files", GdbQuerySources); sendCommand("-file-list-exec-source-files", GdbQuerySources);
sendCommand("-break-list", BreakList); sendCommand("-break-list", BreakList);
reloadModules(); reloadModules();
modulesDirty = false; m_modulesListOutdated = false;
} }
// Need another round trip // Need another round trip
if (reason == "breakpoint-hit") { if (reason == "breakpoint-hit") {
...@@ -1345,7 +1355,6 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response) ...@@ -1345,7 +1355,6 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response)
if (response.resultClass == GdbResultRunning) { if (response.resultClass == GdbResultRunning) {
qq->notifyInferiorRunning(); qq->notifyInferiorRunning();
q->showStatusMessage(tr("Running...")); q->showStatusMessage(tr("Running..."));
//reloadModules();
} else if (response.resultClass == GdbResultError) { } else if (response.resultClass == GdbResultError) {
QString msg = response.data.findChild("msg").data(); QString msg = response.data.findChild("msg").data();
if (msg == "Cannot find bounds of current function") { if (msg == "Cannot find bounds of current function") {
...@@ -1433,11 +1442,8 @@ void GdbEngine::exitDebugger() ...@@ -1433,11 +1442,8 @@ void GdbEngine::exitDebugger()
if (m_gdbProc.state() != QProcess::NotRunning) if (m_gdbProc.state() != QProcess::NotRunning)
qDebug() << "PROBLEM STOPPING DEBUGGER"; qDebug() << "PROBLEM STOPPING DEBUGGER";
m_shortToFullName.clear();
m_fullToShortName.clear();
m_varToType.clear();
m_dataDumperState = DataDumperUninitialized;
m_outputCollector.shutdown(); m_outputCollector.shutdown();
initializeVariables();
//q->settings()->m_debugDumpers = false; //q->settings()->m_debugDumpers = false;
} }
......
...@@ -144,7 +144,8 @@ private: ...@@ -144,7 +144,8 @@ private:
bool supportsThreads() const; bool supportsThreads() const;
void init(); // called by destructor void initializeConnections();
void initializeVariables();
void queryFullName(const QString &fileName, QString *fullName); void queryFullName(const QString &fileName, QString *fullName);
QString fullName(const QString &fileName); QString fullName(const QString &fileName);
QString shortName(const QString &fullName); QString shortName(const QString &fullName);
...@@ -329,6 +330,7 @@ private: ...@@ -329,6 +330,7 @@ private:
QMap<QString, QString> m_varToType; QMap<QString, QString> m_varToType;
bool m_waitingForBreakpointSynchronizationToContinue; bool m_waitingForBreakpointSynchronizationToContinue;
bool m_modulesListOutdated;
DebuggerManager *q; DebuggerManager *q;
IDebuggerManagerAccessForEngines *qq; IDebuggerManagerAccessForEngines *qq;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment