diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/examples/python/disasm.py | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-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/examples/python/disasm.py')
-rwxr-xr-x | lldb/examples/python/disasm.py | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/lldb/examples/python/disasm.py b/lldb/examples/python/disasm.py index 732cf106b11..af024a6887d 100755 --- a/lldb/examples/python/disasm.py +++ b/lldb/examples/python/disasm.py @@ -12,10 +12,12 @@ import lldb import os import sys -def disassemble_instructions (insts): + +def disassemble_instructions(insts): for i in insts: print i + def usage(): print "Usage: disasm.py [-n name] executable-image" print " By default, it breaks at and disassembles the 'main' function." @@ -36,63 +38,69 @@ else: # Create a new debugger instance debugger = lldb.SBDebugger.Create() -# When we step or continue, don't return from the function until the process +# When we step or continue, don't return from the function until the process # stops. We do this by setting the async mode to false. -debugger.SetAsync (False) +debugger.SetAsync(False) # Create a target from a file and arch print "Creating a target for '%s'" % exe -target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT) +target = debugger.CreateTargetWithFileAndArch(exe, lldb.LLDB_ARCH_DEFAULT) if target: # If the target is valid set a breakpoint at main - main_bp = target.BreakpointCreateByName (fname, target.GetExecutable().GetFilename()); + main_bp = target.BreakpointCreateByName( + fname, target.GetExecutable().GetFilename()) print main_bp # Launch the process. Since we specified synchronous mode, we won't return # from this function until we hit the breakpoint at main - process = target.LaunchSimple (None, None, os.getcwd()) - + process = target.LaunchSimple(None, None, os.getcwd()) + # Make sure the launch went ok if process: # Print some simple process info - state = process.GetState () + state = process.GetState() print process if state == lldb.eStateStopped: # Get the first thread - thread = process.GetThreadAtIndex (0) + thread = process.GetThreadAtIndex(0) if thread: # Print some simple thread info print thread # Get the first frame - frame = thread.GetFrameAtIndex (0) + frame = thread.GetFrameAtIndex(0) if frame: # Print some simple frame info print frame function = frame.GetFunction() # See if we have debug info (a function) if function: - # We do have a function, print some info for the function + # We do have a function, print some info for the + # function print function - # Now get all instructions for this function and print them + # Now get all instructions for this function and print + # them insts = function.GetInstructions(target) - disassemble_instructions (insts) + disassemble_instructions(insts) else: - # See if we have a symbol in the symbol table for where we stopped - symbol = frame.GetSymbol(); + # See if we have a symbol in the symbol table for where + # we stopped + symbol = frame.GetSymbol() if symbol: - # We do have a symbol, print some info for the symbol + # We do have a symbol, print some info for the + # symbol print symbol - # Now get all instructions for this symbol and print them + # Now get all instructions for this symbol and + # print them insts = symbol.GetInstructions(target) - disassemble_instructions (insts) + disassemble_instructions(insts) registerList = frame.GetRegisters() print "Frame registers (size of register set = %d):" % registerList.GetSize() for value in registerList: - #print value + # print value print "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren()) for child in value: print "Name: ", child.GetName(), " Value: ", child.GetValue() @@ -111,9 +119,8 @@ if target: elif state == lldb.eStateExited: print "Didn't hit the breakpoint at main, program has exited..." else: - print "Unexpected process state: %s, killing process..." % debugger.StateAsCString (state) + print "Unexpected process state: %s, killing process..." % debugger.StateAsCString(state) process.Kill() - lldb.SBDebugger.Terminate() |