Commit 976e8497 authored by hjk's avatar hjk
Browse files

Debugger: Fix report of current thread from LLDB



Task-number: QTCREATORBUG-10730
Change-Id: Iab7b46da87b43c807acc11747294609d88c0e183
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent c31b03f1
...@@ -671,6 +671,13 @@ class Dumper(DumperBase): ...@@ -671,6 +671,13 @@ class Dumper(DumperBase):
line = frame.line_entry.line line = frame.line_entry.line
self.report('location={file="%s",line="%s",addr="%s"}' % (file, line, frame.pc)) self.report('location={file="%s",line="%s",addr="%s"}' % (file, line, frame.pc))
def firstStoppedThread(self):
for i in xrange(0, self.process.GetNumThreads()):
thread = self.process.GetThreadAtIndex(i)
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
return thread
return None
def reportThreads(self): def reportThreads(self):
reasons = ['None', 'Trace', 'Breakpoint', 'Watchpoint', 'Signal', 'Exception', reasons = ['None', 'Trace', 'Breakpoint', 'Watchpoint', 'Signal', 'Exception',
'Exec', 'PlanComplete'] 'Exec', 'PlanComplete']
...@@ -699,8 +706,7 @@ class Dumper(DumperBase): ...@@ -699,8 +706,7 @@ class Dumper(DumperBase):
result += '],current-thread-id="%s"},' % self.currentThread().id result += '],current-thread-id="%s"},' % self.currentThread().id
self.report(result) self.report(result)
def firstUsableFrame(self): def firstUsableFrame(self, thread):
thread = self.currentThread()
for i in xrange(10): for i in xrange(10):
frame = thread.GetFrameAtIndex(i) frame = thread.GetFrameAtIndex(i)
lineEntry = frame.GetLineEntry() lineEntry = frame.GetLineEntry()
...@@ -1082,9 +1088,12 @@ class Dumper(DumperBase): ...@@ -1082,9 +1088,12 @@ class Dumper(DumperBase):
if type == lldb.SBProcess.eBroadcastBitStateChanged: if type == lldb.SBProcess.eBroadcastBitStateChanged:
state = self.process.GetState() state = self.process.GetState()
if state == lldb.eStateStopped: if state == lldb.eStateStopped:
usableFrame = self.firstUsableFrame() stoppedThread = self.firstStoppedThread()
if stoppedThread:
self.process.SetSelectedThread(stoppedThread)
usableFrame = self.firstUsableFrame(stoppedThread)
if usableFrame: if usableFrame:
self.currentThread().SetSelectedFrame(usableFrame) stoppedThread.SetSelectedFrame(usableFrame)
self.reportStack() self.reportStack()
self.reportThreads() self.reportThreads()
self.reportLocation() self.reportLocation()
......
Supports Markdown
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