2013-10-12 01:13:07 +08:00
|
|
|
##===-- breakwin.py ------------------------------------------*- Python -*-===##
|
|
|
|
##
|
|
|
|
## The LLVM Compiler Infrastructure
|
|
|
|
##
|
|
|
|
## This file is distributed under the University of Illinois Open Source
|
|
|
|
## License. See LICENSE.TXT for details.
|
|
|
|
##
|
|
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
|
2013-10-10 06:11:30 +08:00
|
|
|
import cui
|
|
|
|
import curses
|
|
|
|
import lldb, lldbutil
|
|
|
|
|
|
|
|
class BreakWin(cui.TitledWin):
|
|
|
|
def __init__(self, driver, x, y, w, h):
|
|
|
|
super(BreakWin, self).__init__(x, y, w, h, 'Breakpoints')
|
|
|
|
self.win.scrollok(1)
|
|
|
|
super(BreakWin, self).draw()
|
|
|
|
self.driver = driver
|
|
|
|
|
|
|
|
def handleEvent(self, event):
|
|
|
|
if isinstance(event, lldb.SBEvent):
|
|
|
|
if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
|
|
|
|
self.update()
|
|
|
|
|
|
|
|
def update(self):
|
|
|
|
target = self.driver.getTarget()
|
|
|
|
if not target.IsValid():
|
|
|
|
return
|
|
|
|
self.win.addstr(0, 0, '')
|
|
|
|
for i in range(0, target.GetNumBreakpoints()):
|
|
|
|
bp = target.GetBreakpointAtIndex(i)
|
|
|
|
if bp.IsInternal():
|
|
|
|
continue
|
|
|
|
text = lldbutil.get_description(bp)
|
|
|
|
self.win.addstr(text)
|
|
|
|
self.win.addstr('\n')
|