From b9c1b51e45b845debb76d8658edabca70ca56079 Mon Sep 17 00:00:00 2001 From: Kate Stone Date: Tue, 6 Sep 2016 20:57:50 +0000 Subject: =?UTF-8?q?***=20This=20commit=20represents=20a=20complete=20refor?= =?UTF-8?q?matting=20of=20the=20LLDB=20source=20code=20***=20to=20conform?= =?UTF-8?q?=20to=20clang-format=E2=80=99s=20LLVM=20style.=20=20This=20kind?= =?UTF-8?q?=20of=20mass=20change=20has=20***=20two=20obvious=20implication?= =?UTF-8?q?s:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- lldb/examples/python/jump.py | 79 ++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 28 deletions(-) (limited to 'lldb/examples/python/jump.py') diff --git a/lldb/examples/python/jump.py b/lldb/examples/python/jump.py index c904009..6e41b4c 100644 --- a/lldb/examples/python/jump.py +++ b/lldb/examples/python/jump.py @@ -1,8 +1,10 @@ -import lldb, re +import lldb +import re -def parse_linespec (linespec, frame, result): + +def parse_linespec(linespec, frame, result): """Handles a subset of GDB-style linespecs. Specifically: - + number - A line in the current file +offset - The line /offset/ lines after this line -offset - The line /offset/ lines before this line @@ -21,65 +23,73 @@ def parse_linespec (linespec, frame, result): if (not matched): mo = re.match("^([0-9]+)$", linespec) - if (mo != None): + if (mo is not None): matched = True - #print "Matched " + # print "Matched " line_number = int(mo.group(1)) line_entry = frame.GetLineEntry() if not line_entry.IsValid(): - result.AppendMessage("Specified a line in the current file, but the current frame doesn't have line table information.") + result.AppendMessage( + "Specified a line in the current file, but the current frame doesn't have line table information.") return - breakpoint = target.BreakpointCreateByLocation (line_entry.GetFileSpec(), line_number) + breakpoint = target.BreakpointCreateByLocation( + line_entry.GetFileSpec(), line_number) if (not matched): mo = re.match("^\+([0-9]+)$", linespec) - if (mo != None): + if (mo is not None): matched = True - #print "Matched +" + # print "Matched +" line_number = int(mo.group(1)) line_entry = frame.GetLineEntry() if not line_entry.IsValid(): - result.AppendMessage("Specified a line in the current file, but the current frame doesn't have line table information.") + result.AppendMessage( + "Specified a line in the current file, but the current frame doesn't have line table information.") return - breakpoint = target.BreakpointCreateByLocation(line_entry.GetFileSpec(), (line_entry.GetLine() + line_number)) - + breakpoint = target.BreakpointCreateByLocation( + line_entry.GetFileSpec(), (line_entry.GetLine() + line_number)) + if (not matched): mo = re.match("^\-([0-9]+)$", linespec) - if (mo != None): + if (mo is not None): matched = True - #print "Matched -" + # print "Matched -" line_number = int(mo.group(1)) line_entry = frame.GetLineEntry() if not line_entry.IsValid(): - result.AppendMessage("Specified a line in the current file, but the current frame doesn't have line table information.") + result.AppendMessage( + "Specified a line in the current file, but the current frame doesn't have line table information.") return - breakpoint = target.BreakpointCreateByLocation(line_entry.GetFileSpec(), (line_entry.GetLine() - line_number)) + breakpoint = target.BreakpointCreateByLocation( + line_entry.GetFileSpec(), (line_entry.GetLine() - line_number)) if (not matched): mo = re.match("^(.*):([0-9]+)$", linespec) - if (mo != None): + if (mo is not None): matched = True - #print "Matched :" + # print "Matched :" file_name = mo.group(1) line_number = int(mo.group(2)) - breakpoint = target.BreakpointCreateByLocation(file_name, line_number) + breakpoint = target.BreakpointCreateByLocation( + file_name, line_number) if (not matched): mo = re.match("\*((0x)?([0-9a-f]+))$", linespec) - if (mo != None): + if (mo is not None): matched = True - #print "Matched " + # print "Matched " address = long(mo.group(1), base=0) breakpoint = target.BreakpointCreateByAddress(address) if (not matched): - #print "Trying " + # print "Trying " breakpoint = target.BreakpointCreateByName(linespec) num_locations = breakpoint.GetNumLocations() if (num_locations == 0): - result.AppendMessage("The line specification provided doesn't resolve to any addresses.") + result.AppendMessage( + "The line specification provided doesn't resolve to any addresses.") addr_list = [] @@ -91,6 +101,7 @@ def parse_linespec (linespec, frame, result): return addr_list + def usage_string(): return """ Sets the program counter to a specific address. @@ -106,7 +117,8 @@ Command Options Usage: serves to disambiguate when multiple locations could be meant.""" -def jump (debugger, command, result, internal_dict): + +def jump(debugger, command, result, internal_dict): if (command == ""): result.AppendMessage(usage_string()) @@ -151,17 +163,28 @@ def jump (debugger, command, result, internal_dict): if (desired_index >= 0) and (desired_index < len(addresses)): desired_address = addresses[desired_index] else: - result.AppendMessage("Desired index " + args[1] + " is not one of the options.") + result.AppendMessage( + "Desired index " + + args[1] + + " is not one of the options.") return else: index = 0 - result.AppendMessage("The specified location resolves to multiple targets."); + result.AppendMessage( + "The specified location resolves to multiple targets.") for address in addresses: stream.Clear() address.GetDescription(stream) - result.AppendMessage(" Location ID " + str(index) + ": " + stream.GetData()) + result.AppendMessage( + " Location ID " + + str(index) + + ": " + + stream.GetData()) index = index + 1 - result.AppendMessage("Please type 'jump " + command + " ' to choose one.") + result.AppendMessage( + "Please type 'jump " + + command + + " ' to choose one.") return frame.SetPC(desired_address.GetLoadAddress(target)) -- cgit v1.1