summaryrefslogtreecommitdiffstats
path: root/lldb/utils/lui/lui.py
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/utils/lui/lui.py
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** 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
Diffstat (limited to 'lldb/utils/lui/lui.py')
-rwxr-xr-xlldb/utils/lui/lui.py191
1 files changed, 103 insertions, 88 deletions
diff --git a/lldb/utils/lui/lui.py b/lldb/utils/lui/lui.py
index 31b152c77f0..9b473f5ff82 100755
--- a/lldb/utils/lui/lui.py
+++ b/lldb/utils/lui/lui.py
@@ -1,15 +1,14 @@
#!/usr/bin/env python
##===-- lui.py -----------------------------------------------*- Python -*-===##
##
-## The LLVM Compiler Infrastructure
+# The LLVM Compiler Infrastructure
##
-## This file is distributed under the University of Illinois Open Source
-## License. See LICENSE.TXT for details.
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
##
##===----------------------------------------------------------------------===##
-
import curses
import lldb
@@ -33,103 +32,119 @@ import statuswin
event_queue = None
-def handle_args(driver, argv):
- parser = OptionParser()
- parser.add_option("-p", "--attach", dest="pid", help="Attach to specified Process ID", type="int")
- parser.add_option("-c", "--core", dest="core", help="Load specified core file", type="string")
- (options, args) = parser.parse_args(argv)
+def handle_args(driver, argv):
+ parser = OptionParser()
+ parser.add_option(
+ "-p",
+ "--attach",
+ dest="pid",
+ help="Attach to specified Process ID",
+ type="int")
+ parser.add_option(
+ "-c",
+ "--core",
+ dest="core",
+ help="Load specified core file",
+ type="string")
+
+ (options, args) = parser.parse_args(argv)
+
+ if options.pid is not None:
+ try:
+ pid = int(options.pid)
+ driver.attachProcess(ui, pid)
+ except ValueError:
+ print "Error: expecting integer PID, got '%s'" % options.pid
+ elif options.core is not None:
+ if not os.path.exists(options.core):
+ raise Exception(
+ "Specified core file '%s' does not exist." %
+ options.core)
+ driver.loadCore(options.core)
+ elif len(args) == 2:
+ if not os.path.isfile(args[1]):
+ raise Exception("Specified target '%s' does not exist" % args[1])
+ driver.createTarget(args[1])
+ elif len(args) > 2:
+ if not os.path.isfile(args[1]):
+ raise Exception("Specified target '%s' does not exist" % args[1])
+ driver.createTarget(args[1], args[2:])
- if options.pid is not None:
- try:
- pid = int(options.pid)
- driver.attachProcess(ui, pid)
- except ValueError:
- print "Error: expecting integer PID, got '%s'" % options.pid
- elif options.core is not None:
- if not os.path.exists(options.core):
- raise Exception("Specified core file '%s' does not exist." % options.core)
- driver.loadCore(options.core)
- elif len(args) == 2:
- if not os.path.isfile(args[1]):
- raise Exception("Specified target '%s' does not exist" % args[1])
- driver.createTarget(args[1])
- elif len(args) > 2:
- if not os.path.isfile(args[1]):
- raise Exception("Specified target '%s' does not exist" % args[1])
- driver.createTarget(args[1], args[2:])
def sigint_handler(signal, frame):
- global debugger
- debugger.terminate()
+ global debugger
+ debugger.terminate()
+
class LLDBUI(cui.CursesUI):
- def __init__(self, screen, event_queue, driver):
- super(LLDBUI, self).__init__(screen, event_queue)
-
- self.driver = driver
-
- h, w = self.screen.getmaxyx()
-
- command_win_height = 20
- break_win_width = 60
-
- self.status_win = statuswin.StatusWin(0, h-1, w, 1)
- h -= 1
- self.command_win = commandwin.CommandWin(driver, 0, h - command_win_height,
- w, command_win_height)
- h -= command_win_height
- self.source_win = sourcewin.SourceWin(driver, 0, 0,
- w - break_win_width - 1, h)
- self.break_win = breakwin.BreakWin(driver, w - break_win_width, 0,
- break_win_width, h)
-
-
- self.wins = [self.status_win,
- #self.event_win,
- self.source_win,
- self.break_win,
- self.command_win,
- ]
-
- self.focus = len(self.wins) - 1 # index of command window;
-
- def handleEvent(self, event):
- # hack
- if isinstance(event, int):
- if event == curses.KEY_F10:
- self.driver.terminate()
- if event == 20: # ctrl-T
- def foo(cmd):
- ret = lldb.SBCommandReturnObject()
- self.driver.getCommandInterpreter().HandleCommand(cmd, ret)
- foo('target create a.out')
- foo('b main')
- foo('run')
- super(LLDBUI, self).handleEvent(event)
+
+ def __init__(self, screen, event_queue, driver):
+ super(LLDBUI, self).__init__(screen, event_queue)
+
+ self.driver = driver
+
+ h, w = self.screen.getmaxyx()
+
+ command_win_height = 20
+ break_win_width = 60
+
+ self.status_win = statuswin.StatusWin(0, h - 1, w, 1)
+ h -= 1
+ self.command_win = commandwin.CommandWin(
+ driver, 0, h - command_win_height, w, command_win_height)
+ h -= command_win_height
+ self.source_win = sourcewin.SourceWin(driver, 0, 0,
+ w - break_win_width - 1, h)
+ self.break_win = breakwin.BreakWin(driver, w - break_win_width, 0,
+ break_win_width, h)
+
+ self.wins = [self.status_win,
+ # self.event_win,
+ self.source_win,
+ self.break_win,
+ self.command_win,
+ ]
+
+ self.focus = len(self.wins) - 1 # index of command window;
+
+ def handleEvent(self, event):
+ # hack
+ if isinstance(event, int):
+ if event == curses.KEY_F10:
+ self.driver.terminate()
+ if event == 20: # ctrl-T
+ def foo(cmd):
+ ret = lldb.SBCommandReturnObject()
+ self.driver.getCommandInterpreter().HandleCommand(cmd, ret)
+ foo('target create a.out')
+ foo('b main')
+ foo('run')
+ super(LLDBUI, self).handleEvent(event)
+
def main(screen):
- signal.signal(signal.SIGINT, sigint_handler)
+ signal.signal(signal.SIGINT, sigint_handler)
- global event_queue
- event_queue = Queue.Queue()
+ global event_queue
+ event_queue = Queue.Queue()
- global debugger
- debugger = lldb.SBDebugger.Create()
+ global debugger
+ debugger = lldb.SBDebugger.Create()
- driver = debuggerdriver.createDriver(debugger, event_queue)
- view = LLDBUI(screen, event_queue, driver)
+ driver = debuggerdriver.createDriver(debugger, event_queue)
+ view = LLDBUI(screen, event_queue, driver)
- driver.start()
+ driver.start()
- # hack to avoid hanging waiting for prompts!
- driver.handleCommand("settings set auto-confirm true")
+ # hack to avoid hanging waiting for prompts!
+ driver.handleCommand("settings set auto-confirm true")
- handle_args(driver, sys.argv)
- view.eventLoop()
+ handle_args(driver, sys.argv)
+ view.eventLoop()
if __name__ == "__main__":
- try:
- curses.wrapper(main)
- except KeyboardInterrupt:
- exit()
+ try:
+ curses.wrapper(main)
+ except KeyboardInterrupt:
+ exit()
OpenPOWER on IntegriCloud