From 1535fccffd5768c6102e67f1ec78355459e9e89a Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 2 Sep 2015 12:47:47 +0200 Subject: [PATCH] Debugger: Replace unneeded requests for updates in PdbEngine ... by more direct flushing on the dumper side. Change-Id: I53d91e564bb948e3c934242fec4f23f36ee8c10e Reviewed-by: Christian Stenger --- share/qtcreator/debugger/pdbbridge.py | 5 +++-- src/plugins/debugger/pdb/pdbengine.cpp | 23 ++++++++++++++--------- src/plugins/debugger/pdb/pdbengine.h | 1 + 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/share/qtcreator/debugger/pdbbridge.py b/share/qtcreator/debugger/pdbbridge.py index ba203778009..f5ded418916 100644 --- a/share/qtcreator/debugger/pdbbridge.py +++ b/share/qtcreator/debugger/pdbbridge.py @@ -731,7 +731,7 @@ class Dumper: def sigint_handler(self, signum, frame): if self.allow_kbdint: raise KeyboardInterrupt - self.message("\nProgram interrupted. (Use 'cont' to resume).") + self.report('state="stopped"') self.set_step() self.set_trace(frame) # restore previous signal handler @@ -1484,7 +1484,8 @@ class Dumper: self.flushOutput() def flushOutput(self): - sys.stdout.write(self.output) + sys.stdout.write("@\n" + self.output + "@\n") + sys.stdout.flush() self.output = "" def put(self, value): diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index f6a24357370..d458d995afa 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -179,7 +179,6 @@ void PdbEngine::interruptInferior() { QString error; interruptProcess(m_proc.processId(), GdbEngineType, &error); - notifyInferiorStopOk(); } void PdbEngine::executeStep() @@ -188,7 +187,6 @@ void PdbEngine::executeStep() notifyInferiorRunRequested(); notifyInferiorRunOk(); postDirectCommand("step"); - updateAll(); } void PdbEngine::executeStepI() @@ -197,7 +195,6 @@ void PdbEngine::executeStepI() notifyInferiorRunRequested(); notifyInferiorRunOk(); postDirectCommand("step"); - updateAll(); } void PdbEngine::executeStepOut() @@ -206,7 +203,6 @@ void PdbEngine::executeStepOut() notifyInferiorRunRequested(); notifyInferiorRunOk(); postDirectCommand("return"); - updateAll(); } void PdbEngine::executeNext() @@ -215,7 +211,6 @@ void PdbEngine::executeNext() notifyInferiorRunRequested(); notifyInferiorRunOk(); postDirectCommand("next"); - updateAll(); } void PdbEngine::executeNextI() @@ -224,7 +219,6 @@ void PdbEngine::executeNextI() notifyInferiorRunRequested(); notifyInferiorRunOk(); postDirectCommand("next"); - updateAll(); } void PdbEngine::continueInferior() @@ -234,7 +228,6 @@ void PdbEngine::continueInferior() notifyInferiorRunOk(); // Callback will be triggered e.g. when breakpoint is hit. postDirectCommand("continue"); - updateAll(); } void PdbEngine::executeRunToLine(const ContextData &data) @@ -348,6 +341,17 @@ void PdbEngine::requestModuleSymbols(const QString &moduleName) runCommand(cmd); } +void PdbEngine::refreshState(const GdbMi &reportedState) +{ + QByteArray newState = reportedState.data(); + if (newState == "stopped") { + notifyInferiorSpontaneousStop(); + updateAll(); + } else if (newState == "inferiorexited") { + notifyInferiorExited(); + } +} + void PdbEngine::refreshLocation(const GdbMi &reportedLocation) { StackFrame frame; @@ -476,13 +480,12 @@ void PdbEngine::handleOutput(const QByteArray &data) void PdbEngine::handleOutput2(const QByteArray &data) { - QByteArray lineContext; foreach (QByteArray line, data.split('\n')) { GdbMi item; item.fromString(line); - showMessage(_("LINE: " + line)); + showMessage(_(line), LogOutput); if (line.startsWith("stack={")) { refreshStack(item); @@ -494,6 +497,8 @@ void PdbEngine::handleOutput2(const QByteArray &data) refreshSymbols(item); } else if (line.startsWith("location={")) { refreshLocation(item); + } else if (line.startsWith("state=")) { + refreshState(item); } else if (line.startsWith("Breakpoint")) { int pos1 = line.indexOf(" at "); QTC_ASSERT(pos1 != -1, continue); diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h index 7100305e896..cd27f93524a 100644 --- a/src/plugins/debugger/pdb/pdbengine.h +++ b/src/plugins/debugger/pdb/pdbengine.h @@ -105,6 +105,7 @@ private: void refreshStack(const GdbMi &stack); void refreshLocals(const GdbMi &vars); void refreshModules(const GdbMi &modules); + void refreshState(const GdbMi &reportedState); void refreshSymbols(const GdbMi &symbols); QString errorMessage(QProcess::ProcessError error) const;