mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 06:06:07 +00:00

*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
95 lines
3.2 KiB
Python
95 lines
3.2 KiB
Python
##===-- breakwin.py ------------------------------------------*- Python -*-===##
|
|
##
|
|
# The LLVM Compiler Infrastructure
|
|
##
|
|
# This file is distributed under the University of Illinois Open Source
|
|
# License. See LICENSE.TXT for details.
|
|
##
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
import cui
|
|
import curses
|
|
import lldb
|
|
import lldbutil
|
|
import re
|
|
|
|
|
|
class BreakWin(cui.ListWin):
|
|
|
|
def __init__(self, driver, x, y, w, h):
|
|
super(BreakWin, self).__init__(x, y, w, h)
|
|
self.driver = driver
|
|
self.update()
|
|
self.showDetails = {}
|
|
|
|
def handleEvent(self, event):
|
|
if isinstance(event, lldb.SBEvent):
|
|
if lldb.SBBreakpoint.EventIsBreakpointEvent(event):
|
|
self.update()
|
|
if isinstance(event, int):
|
|
if event == ord('d'):
|
|
self.deleteSelected()
|
|
if event == curses.ascii.NL or event == curses.ascii.SP:
|
|
self.toggleSelected()
|
|
elif event == curses.ascii.TAB:
|
|
if self.getSelected() != -1:
|
|
target = self.driver.getTarget()
|
|
if not target.IsValid():
|
|
return
|
|
i = target.GetBreakpointAtIndex(self.getSelected()).id
|
|
self.showDetails[i] = not self.showDetails[i]
|
|
self.update()
|
|
super(BreakWin, self).handleEvent(event)
|
|
|
|
def toggleSelected(self):
|
|
if self.getSelected() == -1:
|
|
return
|
|
target = self.driver.getTarget()
|
|
if not target.IsValid():
|
|
return
|
|
bp = target.GetBreakpointAtIndex(self.getSelected())
|
|
bp.SetEnabled(not bp.IsEnabled())
|
|
|
|
def deleteSelected(self):
|
|
if self.getSelected() == -1:
|
|
return
|
|
target = self.driver.getTarget()
|
|
if not target.IsValid():
|
|
return
|
|
bp = target.GetBreakpointAtIndex(self.getSelected())
|
|
target.BreakpointDelete(bp.id)
|
|
|
|
def update(self):
|
|
target = self.driver.getTarget()
|
|
if not target.IsValid():
|
|
self.win.erase()
|
|
self.win.noutrefresh()
|
|
return
|
|
selected = self.getSelected()
|
|
self.clearItems()
|
|
for i in range(0, target.GetNumBreakpoints()):
|
|
bp = target.GetBreakpointAtIndex(i)
|
|
if bp.IsInternal():
|
|
continue
|
|
text = lldbutil.get_description(bp)
|
|
# FIXME: Use an API for this, not parsing the description.
|
|
match = re.search('SBBreakpoint: id = ([^,]+), (.*)', text)
|
|
try:
|
|
id = match.group(1)
|
|
desc = match.group(2).strip()
|
|
if bp.IsEnabled():
|
|
text = '%s: %s' % (id, desc)
|
|
else:
|
|
text = '%s: (disabled) %s' % (id, desc)
|
|
except ValueError as e:
|
|
# bp unparsable
|
|
pass
|
|
|
|
if self.showDetails.setdefault(bp.id, False):
|
|
for location in bp:
|
|
desc = lldbutil.get_description(
|
|
location, lldb.eDescriptionLevelFull)
|
|
text += '\n ' + desc
|
|
self.addItem(text)
|
|
self.setSelected(selected)
|