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

View File

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