xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBFrameDocstrings.i (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric %feature("docstring",
2*06c3fb27SDimitry Andric "Represents one of the stack frames associated with a thread.
3*06c3fb27SDimitry Andric 
4*06c3fb27SDimitry Andric SBThread contains SBFrame(s). For example (from test/lldbutil.py), ::
5*06c3fb27SDimitry Andric 
6*06c3fb27SDimitry Andric     def print_stacktrace(thread, string_buffer = False):
7*06c3fb27SDimitry Andric         '''Prints a simple stack trace of this thread.'''
8*06c3fb27SDimitry Andric 
9*06c3fb27SDimitry Andric         ...
10*06c3fb27SDimitry Andric 
11*06c3fb27SDimitry Andric         for i in range(depth):
12*06c3fb27SDimitry Andric             frame = thread.GetFrameAtIndex(i)
13*06c3fb27SDimitry Andric             function = frame.GetFunction()
14*06c3fb27SDimitry Andric 
15*06c3fb27SDimitry Andric             load_addr = addrs[i].GetLoadAddress(target)
16*06c3fb27SDimitry Andric             if not function:
17*06c3fb27SDimitry Andric                 file_addr = addrs[i].GetFileAddress()
18*06c3fb27SDimitry Andric                 start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
19*06c3fb27SDimitry Andric                 symbol_offset = file_addr - start_addr
20*06c3fb27SDimitry Andric                 print >> output, '  frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}'.format(
21*06c3fb27SDimitry Andric                     num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset)
22*06c3fb27SDimitry Andric             else:
23*06c3fb27SDimitry Andric                 print >> output, '  frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}'.format(
24*06c3fb27SDimitry Andric                     num=i, addr=load_addr, mod=mods[i],
25*06c3fb27SDimitry Andric                     func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
26*06c3fb27SDimitry Andric                     file=files[i], line=lines[i],
27*06c3fb27SDimitry Andric                     args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()')
28*06c3fb27SDimitry Andric 
29*06c3fb27SDimitry Andric         ...
30*06c3fb27SDimitry Andric 
31*06c3fb27SDimitry Andric And, ::
32*06c3fb27SDimitry Andric 
33*06c3fb27SDimitry Andric     for frame in thread:
34*06c3fb27SDimitry Andric         print frame
35*06c3fb27SDimitry Andric 
36*06c3fb27SDimitry Andric See also SBThread."
37*06c3fb27SDimitry Andric ) lldb::SBFrame;
38*06c3fb27SDimitry Andric 
39*06c3fb27SDimitry Andric %feature("docstring", "
40*06c3fb27SDimitry Andric     Get the Canonical Frame Address for this stack frame.
41*06c3fb27SDimitry Andric     This is the DWARF standard's definition of a CFA, a stack address
42*06c3fb27SDimitry Andric     that remains constant throughout the lifetime of the function.
43*06c3fb27SDimitry Andric     Returns an lldb::addr_t stack address, or LLDB_INVALID_ADDRESS if
44*06c3fb27SDimitry Andric     the CFA cannot be determined."
45*06c3fb27SDimitry Andric ) lldb::SBFrame::GetCFA;
46*06c3fb27SDimitry Andric 
47*06c3fb27SDimitry Andric %feature("docstring", "
48*06c3fb27SDimitry Andric     Gets the deepest block that contains the frame PC.
49*06c3fb27SDimitry Andric 
50*06c3fb27SDimitry Andric     See also GetFrameBlock()."
51*06c3fb27SDimitry Andric ) lldb::SBFrame::GetBlock;
52*06c3fb27SDimitry Andric 
53*06c3fb27SDimitry Andric     %feature("docstring", "
54*06c3fb27SDimitry Andric     Get the appropriate function name for this frame. Inlined functions in
55*06c3fb27SDimitry Andric     LLDB are represented by Blocks that have inlined function information, so
56*06c3fb27SDimitry Andric     just looking at the SBFunction or SBSymbol for a frame isn't enough.
57*06c3fb27SDimitry Andric     This function will return the appropriate function, symbol or inlined
58*06c3fb27SDimitry Andric     function name for the frame.
59*06c3fb27SDimitry Andric 
60*06c3fb27SDimitry Andric     This function returns:
61*06c3fb27SDimitry Andric     - the name of the inlined function (if there is one)
62*06c3fb27SDimitry Andric     - the name of the concrete function (if there is one)
63*06c3fb27SDimitry Andric     - the name of the symbol (if there is one)
64*06c3fb27SDimitry Andric     - NULL
65*06c3fb27SDimitry Andric 
66*06c3fb27SDimitry Andric     See also IsInlined()."
67*06c3fb27SDimitry Andric ) lldb::SBFrame::GetFunctionName;
68*06c3fb27SDimitry Andric 
69*06c3fb27SDimitry Andric %feature("docstring", "
70*06c3fb27SDimitry Andric     Returns the language of the frame's SBFunction, or if there.
71*06c3fb27SDimitry Andric     is no SBFunction, guess the language from the mangled name.
72*06c3fb27SDimitry Andric     ."
73*06c3fb27SDimitry Andric ) lldb::SBFrame::GuessLanguage;
74*06c3fb27SDimitry Andric 
75*06c3fb27SDimitry Andric %feature("docstring", "
76*06c3fb27SDimitry Andric     Return true if this frame represents an inlined function.
77*06c3fb27SDimitry Andric 
78*06c3fb27SDimitry Andric     See also GetFunctionName()."
79*06c3fb27SDimitry Andric ) lldb::SBFrame::IsInlined;
80*06c3fb27SDimitry Andric 
81*06c3fb27SDimitry Andric %feature("docstring", "
82*06c3fb27SDimitry Andric     Return true if this frame is artificial (e.g a frame synthesized to
83*06c3fb27SDimitry Andric     capture a tail call). Local variables may not be available in an artificial
84*06c3fb27SDimitry Andric     frame."
85*06c3fb27SDimitry Andric ) lldb::SBFrame::IsArtificial;
86*06c3fb27SDimitry Andric 
87*06c3fb27SDimitry Andric %feature("docstring", "
88*06c3fb27SDimitry Andric     The version that doesn't supply a 'use_dynamic' value will use the
89*06c3fb27SDimitry Andric     target's default."
90*06c3fb27SDimitry Andric ) lldb::SBFrame::EvaluateExpression;
91*06c3fb27SDimitry Andric 
92*06c3fb27SDimitry Andric %feature("docstring", "
93*06c3fb27SDimitry Andric     Gets the lexical block that defines the stack frame. Another way to think
94*06c3fb27SDimitry Andric     of this is it will return the block that contains all of the variables
95*06c3fb27SDimitry Andric     for a stack frame. Inlined functions are represented as SBBlock objects
96*06c3fb27SDimitry Andric     that have inlined function information: the name of the inlined function,
97*06c3fb27SDimitry Andric     where it was called from. The block that is returned will be the first
98*06c3fb27SDimitry Andric     block at or above the block for the PC (SBFrame::GetBlock()) that defines
99*06c3fb27SDimitry Andric     the scope of the frame. When a function contains no inlined functions,
100*06c3fb27SDimitry Andric     this will be the top most lexical block that defines the function.
101*06c3fb27SDimitry Andric     When a function has inlined functions and the PC is currently
102*06c3fb27SDimitry Andric     in one of those inlined functions, this method will return the inlined
103*06c3fb27SDimitry Andric     block that defines this frame. If the PC isn't currently in an inlined
104*06c3fb27SDimitry Andric     function, the lexical block that defines the function is returned."
105*06c3fb27SDimitry Andric ) lldb::SBFrame::GetFrameBlock;
106*06c3fb27SDimitry Andric 
107*06c3fb27SDimitry Andric %feature("docstring", "
108*06c3fb27SDimitry Andric     The version that doesn't supply a 'use_dynamic' value will use the
109*06c3fb27SDimitry Andric     target's default."
110*06c3fb27SDimitry Andric ) lldb::SBFrame::GetVariables;
111*06c3fb27SDimitry Andric 
112*06c3fb27SDimitry Andric %feature("docstring", "
113*06c3fb27SDimitry Andric     The version that doesn't supply a 'use_dynamic' value will use the
114*06c3fb27SDimitry Andric     target's default."
115*06c3fb27SDimitry Andric ) lldb::SBFrame::FindVariable;
116*06c3fb27SDimitry Andric 
117*06c3fb27SDimitry Andric %feature("docstring", "
118*06c3fb27SDimitry Andric     Get a lldb.SBValue for a variable path.
119*06c3fb27SDimitry Andric 
120*06c3fb27SDimitry Andric     Variable paths can include access to pointer or instance members: ::
121*06c3fb27SDimitry Andric 
122*06c3fb27SDimitry Andric         rect_ptr->origin.y
123*06c3fb27SDimitry Andric         pt.x
124*06c3fb27SDimitry Andric 
125*06c3fb27SDimitry Andric     Pointer dereferences: ::
126*06c3fb27SDimitry Andric 
127*06c3fb27SDimitry Andric         *this->foo_ptr
128*06c3fb27SDimitry Andric         **argv
129*06c3fb27SDimitry Andric 
130*06c3fb27SDimitry Andric     Address of: ::
131*06c3fb27SDimitry Andric 
132*06c3fb27SDimitry Andric         &pt
133*06c3fb27SDimitry Andric         &my_array[3].x
134*06c3fb27SDimitry Andric 
135*06c3fb27SDimitry Andric     Array accesses and treating pointers as arrays: ::
136*06c3fb27SDimitry Andric 
137*06c3fb27SDimitry Andric         int_array[1]
138*06c3fb27SDimitry Andric         pt_ptr[22].x
139*06c3fb27SDimitry Andric 
140*06c3fb27SDimitry Andric     Unlike `EvaluateExpression()` which returns :py:class:`SBValue` objects
141*06c3fb27SDimitry Andric     with constant copies of the values at the time of evaluation,
142*06c3fb27SDimitry Andric     the result of this function is a value that will continue to
143*06c3fb27SDimitry Andric     track the current value of the value as execution progresses
144*06c3fb27SDimitry Andric     in the current frame."
145*06c3fb27SDimitry Andric ) lldb::SBFrame::GetValueForVariablePath;
146*06c3fb27SDimitry Andric 
147*06c3fb27SDimitry Andric %feature("docstring", "
148*06c3fb27SDimitry Andric     Find variables, register sets, registers, or persistent variables using
149*06c3fb27SDimitry Andric     the frame as the scope.
150*06c3fb27SDimitry Andric 
151*06c3fb27SDimitry Andric     The version that doesn't supply a ``use_dynamic`` value will use the
152*06c3fb27SDimitry Andric     target's default."
153*06c3fb27SDimitry Andric ) lldb::SBFrame::FindValue;
154