diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-07-19 01:07:06 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-07-19 01:07:06 +0000 |
commit | 349f076330dc18ea12a5c04293de64d0bda5a367 (patch) | |
tree | 4ef0f5304624a8292eeedc3966d23adbff83d0b3 /lldb/scripts/Python/interface/SBFrame.i | |
parent | 7ca23dde4e7f036ce2fc96a89769f2a2eef64363 (diff) | |
download | bcm5719-llvm-349f076330dc18ea12a5c04293de64d0bda5a367.tar.gz bcm5719-llvm-349f076330dc18ea12a5c04293de64d0bda5a367.zip |
Add SWIG interface files for SBSymbol, SBSymbolContext, and SBSymbolContextList.
llvm-svn: 135459
Diffstat (limited to 'lldb/scripts/Python/interface/SBFrame.i')
-rw-r--r-- | lldb/scripts/Python/interface/SBFrame.i | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lldb/scripts/Python/interface/SBFrame.i b/lldb/scripts/Python/interface/SBFrame.i index eb17a095ac5..bf33b6fe31a 100644 --- a/lldb/scripts/Python/interface/SBFrame.i +++ b/lldb/scripts/Python/interface/SBFrame.i @@ -11,7 +11,33 @@ namespace lldb { %feature("docstring", "Represents one of the stack frames associated with a thread. -SBThread contains SBFrame(s)." +SBThread contains SBFrame(s). For example (from test/lldbutil.py), + +def print_stacktrace(thread, string_buffer = False): + '''Prints a simple stack trace of this thread.''' + + ... + + for i in range(depth): + frame = thread.GetFrameAtIndex(i) + function = frame.GetFunction() + + load_addr = addrs[i].GetLoadAddress(target) + if not function: + file_addr = addrs[i].GetFileAddress() + start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress() + symbol_offset = file_addr - start_addr + print >> output, ' frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format( + num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset) + else: + print >> output, ' frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format( + num=i, addr=load_addr, mod=mods[i], + func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i], + file=files[i], line=lines[i], + args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()') + + ... +" ) SBFrame; class SBFrame { |