Debugger: Avoid race condition on setting initial LLDB breakpoints

Breakpoints inserting is async, so they did end up when the process
was running already.

This adds an extra roundtrip. Better, but more intrusive solution
might be to set the initial breakpoints synchronously, but that
would touch all engines.

Change-Id: Ia728a9c5ae8f1d6d29d3cc02b9e2d04952091fe9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-05-05 10:46:05 +02:00
parent a35b0858fb
commit 2dfa539b96
2 changed files with 10 additions and 3 deletions

View File

@@ -124,7 +124,6 @@ class Dumper(DumperBase):
self.interpreterBreakpointResolvers = []
self.report('lldbversion=\"%s\"' % lldb.SBDebugger.GetVersionString())
self.reportState('enginesetupok')
def fromNativeFrameValue(self, nativeValue):
return self.fromNativeValue(nativeValue)
@@ -1732,6 +1731,9 @@ class Dumper(DumperBase):
error = str(result.GetError())
self.report('success="%d",output="%s",error="%s"' % (success, output, error))
def executeRoundtrip(self, args):
self.reportResult('', args)
def fetchDisassembler(self, args):
functionName = args.get('function', '')
flavor = args.get('flavor', '')

View File

@@ -314,6 +314,13 @@ void LldbEngine::setupEngine()
const bool success = response.data["success"].toInt();
if (success) {
BreakpointManager::claimBreakpointsForEngine(this);
// Some extra roundtrip to make sure we end up behind all commands triggered
// from claimBreakpointsForEngine().
QTimer::singleShot(0, this, [this] {
DebuggerCommand cmd3("executeRoundtrip");
cmd3.callback = [this](const DebuggerResponse &) { notifyEngineSetupOk(); };
runCommand(cmd3);
});
} else {
notifyEngineSetupFailed();
}
@@ -903,8 +910,6 @@ void LldbEngine::handleStateNotification(const GdbMi &item)
notifyInferiorStopFailed();
else if (newState == "inferiorill")
notifyInferiorIll();
else if (newState == "enginesetupok")
notifyEngineSetupOk();
else if (newState == "enginesetupfailed") {
Core::AsynchronousMessageBox::critical(adapterStartFailed(),
item["error"].data());