Debugger: Replace unneeded requests for updates in PdbEngine

... by more direct flushing on the dumper side.

Change-Id: I53d91e564bb948e3c934242fec4f23f36ee8c10e
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-09-02 12:47:47 +02:00
parent 33fc9e209d
commit 1535fccffd
3 changed files with 18 additions and 11 deletions

View File

@@ -731,7 +731,7 @@ class Dumper:
def sigint_handler(self, signum, frame): def sigint_handler(self, signum, frame):
if self.allow_kbdint: if self.allow_kbdint:
raise KeyboardInterrupt raise KeyboardInterrupt
self.message("\nProgram interrupted. (Use 'cont' to resume).") self.report('state="stopped"')
self.set_step() self.set_step()
self.set_trace(frame) self.set_trace(frame)
# restore previous signal handler # restore previous signal handler
@@ -1484,7 +1484,8 @@ class Dumper:
self.flushOutput() self.flushOutput()
def flushOutput(self): def flushOutput(self):
sys.stdout.write(self.output) sys.stdout.write("@\n" + self.output + "@\n")
sys.stdout.flush()
self.output = "" self.output = ""
def put(self, value): def put(self, value):

View File

@@ -179,7 +179,6 @@ void PdbEngine::interruptInferior()
{ {
QString error; QString error;
interruptProcess(m_proc.processId(), GdbEngineType, &error); interruptProcess(m_proc.processId(), GdbEngineType, &error);
notifyInferiorStopOk();
} }
void PdbEngine::executeStep() void PdbEngine::executeStep()
@@ -188,7 +187,6 @@ void PdbEngine::executeStep()
notifyInferiorRunRequested(); notifyInferiorRunRequested();
notifyInferiorRunOk(); notifyInferiorRunOk();
postDirectCommand("step"); postDirectCommand("step");
updateAll();
} }
void PdbEngine::executeStepI() void PdbEngine::executeStepI()
@@ -197,7 +195,6 @@ void PdbEngine::executeStepI()
notifyInferiorRunRequested(); notifyInferiorRunRequested();
notifyInferiorRunOk(); notifyInferiorRunOk();
postDirectCommand("step"); postDirectCommand("step");
updateAll();
} }
void PdbEngine::executeStepOut() void PdbEngine::executeStepOut()
@@ -206,7 +203,6 @@ void PdbEngine::executeStepOut()
notifyInferiorRunRequested(); notifyInferiorRunRequested();
notifyInferiorRunOk(); notifyInferiorRunOk();
postDirectCommand("return"); postDirectCommand("return");
updateAll();
} }
void PdbEngine::executeNext() void PdbEngine::executeNext()
@@ -215,7 +211,6 @@ void PdbEngine::executeNext()
notifyInferiorRunRequested(); notifyInferiorRunRequested();
notifyInferiorRunOk(); notifyInferiorRunOk();
postDirectCommand("next"); postDirectCommand("next");
updateAll();
} }
void PdbEngine::executeNextI() void PdbEngine::executeNextI()
@@ -224,7 +219,6 @@ void PdbEngine::executeNextI()
notifyInferiorRunRequested(); notifyInferiorRunRequested();
notifyInferiorRunOk(); notifyInferiorRunOk();
postDirectCommand("next"); postDirectCommand("next");
updateAll();
} }
void PdbEngine::continueInferior() void PdbEngine::continueInferior()
@@ -234,7 +228,6 @@ void PdbEngine::continueInferior()
notifyInferiorRunOk(); notifyInferiorRunOk();
// Callback will be triggered e.g. when breakpoint is hit. // Callback will be triggered e.g. when breakpoint is hit.
postDirectCommand("continue"); postDirectCommand("continue");
updateAll();
} }
void PdbEngine::executeRunToLine(const ContextData &data) void PdbEngine::executeRunToLine(const ContextData &data)
@@ -348,6 +341,17 @@ void PdbEngine::requestModuleSymbols(const QString &moduleName)
runCommand(cmd); 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) void PdbEngine::refreshLocation(const GdbMi &reportedLocation)
{ {
StackFrame frame; StackFrame frame;
@@ -476,13 +480,12 @@ void PdbEngine::handleOutput(const QByteArray &data)
void PdbEngine::handleOutput2(const QByteArray &data) void PdbEngine::handleOutput2(const QByteArray &data)
{ {
QByteArray lineContext;
foreach (QByteArray line, data.split('\n')) { foreach (QByteArray line, data.split('\n')) {
GdbMi item; GdbMi item;
item.fromString(line); item.fromString(line);
showMessage(_("LINE: " + line)); showMessage(_(line), LogOutput);
if (line.startsWith("stack={")) { if (line.startsWith("stack={")) {
refreshStack(item); refreshStack(item);
@@ -494,6 +497,8 @@ void PdbEngine::handleOutput2(const QByteArray &data)
refreshSymbols(item); refreshSymbols(item);
} else if (line.startsWith("location={")) { } else if (line.startsWith("location={")) {
refreshLocation(item); refreshLocation(item);
} else if (line.startsWith("state=")) {
refreshState(item);
} else if (line.startsWith("Breakpoint")) { } else if (line.startsWith("Breakpoint")) {
int pos1 = line.indexOf(" at "); int pos1 = line.indexOf(" at ");
QTC_ASSERT(pos1 != -1, continue); QTC_ASSERT(pos1 != -1, continue);

View File

@@ -105,6 +105,7 @@ private:
void refreshStack(const GdbMi &stack); void refreshStack(const GdbMi &stack);
void refreshLocals(const GdbMi &vars); void refreshLocals(const GdbMi &vars);
void refreshModules(const GdbMi &modules); void refreshModules(const GdbMi &modules);
void refreshState(const GdbMi &reportedState);
void refreshSymbols(const GdbMi &symbols); void refreshSymbols(const GdbMi &symbols);
QString errorMessage(QProcess::ProcessError error) const; QString errorMessage(QProcess::ProcessError error) const;