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