Commit b75209d6 authored by hjk's avatar hjk

Debugger: Cleaner shutdown of LLDB/python machinery

Change-Id: I482e78c352066ddd05e96199fd8ead088e3e9f58
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 31634a07
...@@ -525,6 +525,7 @@ class Dumper: ...@@ -525,6 +525,7 @@ class Dumper:
self.sizetType_ = None self.sizetType_ = None
self.charPtrType_ = None self.charPtrType_ = None
self.voidType_ = None self.voidType_ = None
self.isShuttingDown_ = False
def extractTemplateArgument(self, typename, index): def extractTemplateArgument(self, typename, index):
level = 0 level = 0
...@@ -1020,9 +1021,12 @@ class Dumper: ...@@ -1020,9 +1021,12 @@ class Dumper:
self.report('state="%s"' % stateNames[state]) self.report('state="%s"' % stateNames[state])
self.eventState = state self.eventState = state
if state == lldb.eStateExited: if state == lldb.eStateExited:
warn("PROCESS EXITED. %d: %s" if self.isShuttingDown_:
self.report('state="inferiorshutdownok"')
else:
self.report('state="inferiorexited"')
self.report('exited={status="%s",desc="%s"}'
% (self.process.GetExitStatus(), self.process.GetExitDescription())) % (self.process.GetExitStatus(), self.process.GetExitDescription()))
self.report('state="inferiorexited"')
if type == lldb.SBProcess.eBroadcastBitStateChanged: if type == lldb.SBProcess.eBroadcastBitStateChanged:
self.reportData() self.reportData()
elif type == lldb.SBProcess.eBroadcastBitInterrupt: elif type == lldb.SBProcess.eBroadcastBitInterrupt:
...@@ -1190,8 +1194,13 @@ class Dumper: ...@@ -1190,8 +1194,13 @@ class Dumper:
def executeStep(self, _ = None): def executeStep(self, _ = None):
self.currentThread().StepInto() self.currentThread().StepInto()
def shutdownInferior(self, _ = None):
self.isShuttingDown_ = True
self.process.Kill()
def quit(self, _ = None): def quit(self, _ = None):
self.debugger.Terminate() self.report('state="engineshutdownok"')
self.process.Kill()
def executeStepI(self, _ = None): def executeStepI(self, _ = None):
self.currentThread().StepInstruction(lldb.eOnlyThisThread) self.currentThread().StepInstruction(lldb.eOnlyThisThread)
...@@ -1229,12 +1238,8 @@ class Dumper: ...@@ -1229,12 +1238,8 @@ class Dumper:
command = args['command'] command = args['command']
self.debugger.GetCommandInterpreter().HandleCommand(command, result) self.debugger.GetCommandInterpreter().HandleCommand(command, result)
success = result.Succeeded() success = result.Succeeded()
if success: output = result.GetOutput()
output = result.GetOutput() error = str(result.GetError())
error = ''
else:
output = ''
error = str(result.GetError())
self.report('success="%d",output="%s",error="%s"' % (success, output, error)) self.report('success="%d",output="%s",error="%s"' % (success, output, error))
def setOptions(self, args): def setOptions(self, args):
......
...@@ -119,7 +119,7 @@ void LldbEngine::runCommand(const Command &command) ...@@ -119,7 +119,7 @@ void LldbEngine::runCommand(const Command &command)
void LldbEngine::shutdownInferior() void LldbEngine::shutdownInferior()
{ {
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
notifyInferiorShutdownOk(); runCommand(Command("shutdownInferior"));
} }
void LldbEngine::shutdownEngine() void LldbEngine::shutdownEngine()
...@@ -1018,6 +1018,14 @@ void LldbEngine::refreshState(const GdbMi &reportedState) ...@@ -1018,6 +1018,14 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
notifyEngineRunAndInferiorRunOk(); notifyEngineRunAndInferiorRunOk();
else if (newState == "enginerunandinferiorstopok") else if (newState == "enginerunandinferiorstopok")
notifyEngineRunAndInferiorStopOk(); notifyEngineRunAndInferiorStopOk();
else if (newState == "inferiorshutdownok")
notifyInferiorShutdownOk();
else if (newState == "inferiorshutdownfailed")
notifyInferiorShutdownFailed();
else if (newState == "engineshutdownok")
notifyEngineShutdownOk();
else if (newState == "engineshutdownfailed")
notifyEngineShutdownFailed();
else if (newState == "inferiorexited") else if (newState == "inferiorexited")
notifyInferiorExited(); notifyInferiorExited();
} }
......
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