xref: /llvm-project/lldb/bindings/interface/SBFunctionDocstrings.i (revision 662548c82683bd8657a3179afee693c4965a3dfd)
1*662548c8SAlex Langford %feature("docstring",
2*662548c8SAlex Langford "Represents a generic function, which can be inlined or not.
3*662548c8SAlex Langford 
4*662548c8SAlex Langford For example (from test/lldbutil.py, but slightly modified for doc purpose),::
5*662548c8SAlex Langford 
6*662548c8SAlex Langford         ...
7*662548c8SAlex Langford 
8*662548c8SAlex Langford         frame = thread.GetFrameAtIndex(i)
9*662548c8SAlex Langford         addr = frame.GetPCAddress()
10*662548c8SAlex Langford         load_addr = addr.GetLoadAddress(target)
11*662548c8SAlex Langford         function = frame.GetFunction()
12*662548c8SAlex Langford         mod_name = frame.GetModule().GetFileSpec().GetFilename()
13*662548c8SAlex Langford 
14*662548c8SAlex Langford         if not function:
15*662548c8SAlex Langford             # No debug info for 'function'.
16*662548c8SAlex Langford             symbol = frame.GetSymbol()
17*662548c8SAlex Langford             file_addr = addr.GetFileAddress()
18*662548c8SAlex Langford             start_addr = symbol.GetStartAddress().GetFileAddress()
19*662548c8SAlex Langford             symbol_name = symbol.GetName()
20*662548c8SAlex Langford             symbol_offset = file_addr - start_addr
21*662548c8SAlex Langford             print >> output, '  frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format(
22*662548c8SAlex Langford                 num=i, addr=load_addr, mod=mod_name, symbol=symbol_name, offset=symbol_offset)
23*662548c8SAlex Langford         else:
24*662548c8SAlex Langford             # Debug info is available for 'function'.
25*662548c8SAlex Langford             func_name = frame.GetFunctionName()
26*662548c8SAlex Langford             file_name = frame.GetLineEntry().GetFileSpec().GetFilename()
27*662548c8SAlex Langford             line_num = frame.GetLineEntry().GetLine()
28*662548c8SAlex Langford             print >> output, '  frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format(
29*662548c8SAlex Langford                 num=i, addr=load_addr, mod=mod_name,
30*662548c8SAlex Langford                 func='%s [inlined]' % func_name] if frame.IsInlined() else func_name,
31*662548c8SAlex Langford                 file=file_name, line=line_num, args=get_args_as_string(frame, showFuncName=False))
32*662548c8SAlex Langford 
33*662548c8SAlex Langford         ..."
34*662548c8SAlex Langford ) lldb::SBFunction;
35*662548c8SAlex Langford 
36*662548c8SAlex Langford %feature("docstring", "
37*662548c8SAlex Langford     Returns true if the function was compiled with optimization.
38*662548c8SAlex Langford     Optimization, in this case, is meant to indicate that the debugger
39*662548c8SAlex Langford     experience may be confusing for the user -- variables optimized away,
40*662548c8SAlex Langford     stepping jumping between source lines -- and the driver may want to
41*662548c8SAlex Langford     provide some guidance to the user about this.
42*662548c8SAlex Langford     Returns false if unoptimized, or unknown."
43*662548c8SAlex Langford ) lldb::SBFunction::GetIsOptimized;
44