diff options
| author | Jim Ingham <jingham@apple.com> | 2011-03-30 01:55:23 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-03-30 01:55:23 +0000 |
| commit | 406ef962d94c9d8e1984a87e5adda586c966e85a (patch) | |
| tree | a8ec5ba16d491fe01eeab7314d9edc785b8c46ac /lldb/examples/python | |
| parent | 075de167f8f233b714a4a5e59cc1540368a632d4 (diff) | |
| download | bcm5719-llvm-406ef962d94c9d8e1984a87e5adda586c966e85a.tar.gz bcm5719-llvm-406ef962d94c9d8e1984a87e5adda586c966e85a.zip | |
The example had gotten stale, so I made it work again, and for fun printed out the frame registers as well.
llvm-svn: 128523
Diffstat (limited to 'lldb/examples/python')
| -rwxr-xr-x | lldb/examples/python/disasm.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lldb/examples/python/disasm.py b/lldb/examples/python/disasm.py index 5d20874855a..e7f482ffa66 100755 --- a/lldb/examples/python/disasm.py +++ b/lldb/examples/python/disasm.py @@ -31,13 +31,14 @@ target = debugger.CreateTargetWithFileAndArch (sys.argv[1], lldb.LLDB_ARCH_DEFAU if target.IsValid(): # If the target is valid set a breakpoint at main - main_bp = target.BreakpointCreateByName ("main", sys.argv[1]); + main_bp = target.BreakpointCreateByName ("main", 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.LaunchProcess ([''], [''], "/dev/stdout", 0, False) + error = lldb.SBError() + process = target.Launch (debugger.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error) # Make sure the launch went ok if process.IsValid(): @@ -72,6 +73,19 @@ if target.IsValid(): # Now get all instructions for this symbol and print them insts = symbol.GetInstructions(target) disassemble_instructions (insts) + + print "Frame registers:" + registerList = frame.GetRegisters() + numRegisterSets = registerList.GetSize() + for i in range (0, numRegisterSets): + value = registerList.GetValueAtIndex(i) + print value + numChildren = value.GetNumChildren() + if numChildren > 0: + for j in range (0, numChildren): + child = value.GetChildAtIndex(j) + print "Name: ", child.GetName(), " Value: ", child.GetValue(frame) + print "Hit the breakpoint at main, continue and wait for program to exit..." # Now continue to the program exit process.Continue() |

