20 """Basic implementation of a Frame Decorator"""
22 """ This base frame decorator decorates a frame or another frame
23 decorator, and provides convenience methods. If this object
is
24 wrapping a frame decorator, defer to that wrapped object
's method
25 if it has one. This allows
for frame decorators that have
26 sub-classed FrameDecorator object, but also wrap other frame
27 decorators on the same frame to correctly execute.
31 If the result of frame filters running means we have one gdb.Frame
32 wrapped by multiple frame decorators, all sub-classed
from
33 FrameDecorator, the resulting hierarchy will be:
37 -- (wraps) FrameDecorator
40 In this case we have two frame decorators, both of which are
41 sub-classed
from FrameDecorator. If Decorator1 just overrides the
42 'function' method, then all of the other methods are carried out
44 overriden other methods, so FrameDecorator will look at the
45 'base' parameter
and defer to that
class's methods. And so on,
57 """Internal utility to determine if the frame is special or
59 sal = frame.find_sal()
63 or not sal.symtab.filename
64 or frame.type() == gdb.DUMMY_FRAME
65 or frame.type() == gdb.SIGTRAMP_FRAME
73 """Return any elided frames that this class might be
75 if hasattr(self.
_base,
"elided"):
81 """Return the name of the frame's function or an address of
82 the function of the frame. First determine if this
is a
83 special frame. If
not,
try to determine filename
from GDB
's
84 frame internal function API. Finally, if a name cannot be
85 determined
return the address. If this function returns an
86 address, GDB will attempt to determine the function name
from
87 its internal minimal symbols store (
for example,
for inferiors
88 without debug-info).
"""
92 if not isinstance(self.
_base, gdb.Frame):
93 if hasattr(self.
_base,
"function"):
96 return self.
_base.function()
100 if frame.type() == gdb.DUMMY_FRAME:
101 return "<function called from gdb>"
102 elif frame.type() == gdb.SIGTRAMP_FRAME:
103 return "<signal handler called>"
105 func = frame.function()
118 """Return the address of the frame's pc"""
120 if hasattr(self.
_base,
"address"):
127 """Return the filename associated with this frame, detecting
128 and returning the appropriate library name
is this
is a shared
131 if hasattr(self.
_base,
"filename"):
135 sal = frame.find_sal()
136 if not sal.symtab
or not sal.symtab.filename:
140 return sal.symtab.filename
143 """Return an iterable of frame arguments for this frame, if
144 any. The iterable object contains objects conforming with the
145 Symbol/Value interface. If there are no frame arguments,
or
146 if this frame
is deemed to be a special case,
return None.
"""
148 if hasattr(self.
_base,
"frame_args"):
156 return args.fetch_frame_args()
159 """Return an iterable of local variables for this frame, if
160 any. The iterable object contains objects conforming with the
161 Symbol/Value interface. If there are no frame locals,
or if
162 this frame
is deemed to be a special case,
return None.
"""
164 if hasattr(self.
_base,
"frame_locals"):
172 return args.fetch_frame_locals()
175 """Return line number information associated with the frame's
176 pc. If symbol table/line information does not exist,
or if
177 this frame
is deemed to be a special case,
return None"""
179 if hasattr(self.
_base,
"line"):
186 sal = frame.find_sal()
193 """Return the gdb.Frame underpinning this frame decorator."""
197 if hasattr(self.
_base,
"inferior_frame"):
203 """A container class conforming to the Symbol/Value interface
204 which holds frame locals or frame arguments.
"""
211 """Return the value associated with this symbol, or None"""
215 """Return the symbol, or Python text, associated with this
222 """Utility class to fetch and store frame local variables, or
228 gdb.SYMBOL_LOC_STATIC:
True,
229 gdb.SYMBOL_LOC_REGISTER:
True,
230 gdb.SYMBOL_LOC_ARG:
True,
231 gdb.SYMBOL_LOC_REF_ARG:
True,
232 gdb.SYMBOL_LOC_LOCAL:
True,
233 gdb.SYMBOL_LOC_REGPARM_ADDR:
True,
234 gdb.SYMBOL_LOC_COMPUTED:
True,
238 """Local utility method to determine if according to Symbol
239 type whether it should be included in the iterator. Not all
240 symbols are fetched,
and only symbols that
return
241 True from this method should be fetched.
"""
246 if isinstance(sym, str):
249 sym_type = sym.addr_class
254 """Public utility method to fetch frame local variables for
255 the stored frame. Frame arguments are not fetched. If there
256 are no frame local variables,
return an empty list.
"""
264 while block
is not None:
265 if block.is_global
or block.is_static:
273 block = block.superblock
278 """Public utility method to fetch frame arguments for the
279 stored frame. Frame arguments are the only type fetched. If
280 there are no frame argument variables, return an empty list.
"""
289 while block
is not None:
290 if block.function
is not None:
292 block = block.superblock
294 if block
is not None:
296 if not sym.is_argument:
constexpr string_view get()
def _is_limited_frame(frame)
def fetch_frame_locals(self)
def __init__(self, frame)
def fetch_frame_args(self)
def __init__(self, symbol, value)