Debugger: Rely less on implicit state in lldbbridge.

Ideally, all 'current' data should be passed down from the engine.

Change-Id: Ibfe7c466ec564c6907398ec2ec6c05d04e6670d6
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-27 15:01:29 +01:00
parent 91c0629fe1
commit 672ab5c8d8
2 changed files with 10 additions and 11 deletions

View File

@@ -757,9 +757,7 @@ class Dumper(DumperBase):
thread = self.currentThread() thread = self.currentThread()
return None if thread is None else thread.GetSelectedFrame() return None if thread is None else thread.GetSelectedFrame()
def reportLocation(self): def reportLocation(self, frame):
thread = self.currentThread()
frame = thread.GetSelectedFrame()
if int(frame.pc) != 0xffffffffffffffff: if int(frame.pc) != 0xffffffffffffffff:
file = fileName(frame.line_entry.file) file = fileName(frame.line_entry.file)
line = frame.line_entry.line line = frame.line_entry.line
@@ -1340,7 +1338,8 @@ class Dumper(DumperBase):
self.process.SetSelectedThread(stoppedThread) self.process.SetSelectedThread(stoppedThread)
self.reportStackTop() self.reportStackTop()
self.reportThreads() self.reportThreads()
self.reportLocation() if stoppedThread:
self.reportLocation(stoppedThread.GetSelectedFrame())
elif eventType == lldb.SBProcess.eBroadcastBitInterrupt: # 2 elif eventType == lldb.SBProcess.eBroadcastBitInterrupt: # 2
pass pass
elif eventType == lldb.SBProcess.eBroadcastBitSTDOUT: elif eventType == lldb.SBProcess.eBroadcastBitSTDOUT:
@@ -1565,16 +1564,14 @@ class Dumper(DumperBase):
self.reportState("running") self.reportState("running")
self.reportState("stopped") self.reportState("stopped")
self.reportError(error) self.reportError(error)
self.reportLocation() self.reportLocation(self.currentFrame())
else: else:
self.reportData() self.reportData()
def executeJumpToLocation(self, args): def executeJumpToLocation(self, args):
frame = self.currentFrame() frame = self.currentFrame()
self.reportState("stopped")
if not frame: if not frame:
self.reportStatus("No frame available.") self.reportStatus("No frame available.")
self.reportLocation()
return return
addr = args.get('address', 0) addr = args.get('address', 0)
if addr: if addr:
@@ -1585,12 +1582,15 @@ class Dumper(DumperBase):
if bp.GetNumLocations() == 0: if bp.GetNumLocations() == 0:
self.target.BreakpointDelete(bp.GetID()) self.target.BreakpointDelete(bp.GetID())
self.reportStatus("No target location found.") self.reportStatus("No target location found.")
self.reportLocation() self.reportLocation(frame)
return return
loc = bp.GetLocationAtIndex(0) loc = bp.GetLocationAtIndex(0)
self.target.BreakpointDelete(bp.GetID()) self.target.BreakpointDelete(bp.GetID())
frame.SetPC(loc.GetLoadAddress()) if frame.SetPC(loc.GetLoadAddress()):
self.reportData() self.report("Jumped.")
else:
self.report("Cannot jump.")
self.reportLocation(frame)
def breakList(self): def breakList(self):
result = lldb.SBCommandReturnObject() result = lldb.SBCommandReturnObject()

View File

@@ -517,7 +517,6 @@ void LldbEngine::executeRunToFunction(const QString &functionName)
void LldbEngine::executeJumpToLine(const ContextData &data) void LldbEngine::executeJumpToLine(const ContextData &data)
{ {
resetLocation(); resetLocation();
notifyInferiorRunRequested();
DebuggerCommand cmd("executeJumpToLocation"); DebuggerCommand cmd("executeJumpToLocation");
cmd.arg("file", data.fileName); cmd.arg("file", data.fileName);
cmd.arg("line", data.lineNumber); cmd.arg("line", data.lineNumber);