22 """Check the calling function's name.
24 Usage: $_caller_is (NAME [, NUMBER-OF-FRAMES])
28 NAME: The name of the function to search for.
30 NUMBER-OF-FRAMES: How many stack frames to traverse back
from the currently
31 selected frame to compare
with. If the value
is greater than the depth of
32 the stack
from that point then the result
is False.
36 True if the function
's name at the specified frame is equal to NAME."""
39 super(CallerIs, self).
__init__(
"_caller_is")
43 raise ValueError(
"nframes must be >= 0")
44 frame = gdb.selected_frame()
50 return frame.name() == name.string()
54 """Compare the calling function's name with a regexp.
56 Usage: $_caller_matches (REGEX [, NUMBER-OF-FRAMES])
60 REGEX: The regular expression to compare the function's name with.
62 NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently
63 selected frame to compare
with. If the value
is greater than the depth of
64 the stack
from that point then the result
is False.
68 True if the function
's name at the specified frame matches REGEX."""
71 super(CallerMatches, self).
__init__(
"_caller_matches")
75 raise ValueError(
"nframes must be >= 0")
76 frame = gdb.selected_frame()
82 return re.match(name.string(), frame.name())
is not None
86 """Check all calling function's names.
88 Usage: $_any_caller_is (NAME [, NUMBER-OF-FRAMES])
92 NAME: The name of the function to search for.
94 NUMBER-OF-FRAMES: How many stack frames to traverse back
from the currently
95 selected frame to compare
with. If the value
is greater than the depth of
96 the stack
from that point then the result
is False.
100 True if any function
's name is equal to NAME."""
103 super(AnyCallerIs, self).
__init__(
"_any_caller_is")
107 raise ValueError(
"nframes must be >= 0")
108 frame = gdb.selected_frame()
110 if frame.name() == name.string():
112 frame = frame.older()
115 nframes = nframes - 1
120 """Compare all calling function's names with a regexp.
122 Usage: $_any_caller_matches (REGEX [, NUMBER-OF-FRAMES])
126 REGEX: The regular expression to compare the function's name with.
128 NUMBER-OF-FRAMES: How many stack frames to traverse back from the currently
129 selected frame to compare
with. If the value
is greater than the depth of
130 the stack
from that point then the result
is False.
134 True if any function
's name matches REGEX."""
137 super(AnyCallerMatches, self).
__init__(
"_any_caller_matches")
141 raise ValueError(
"nframes must be >= 0")
142 frame = gdb.selected_frame()
143 name_re = re.compile(name.string())
145 if name_re.match(frame.name())
is not None:
147 frame = frame.older()
150 nframes = nframes - 1
def invoke(self, name, nframes=1)
def invoke(self, name, nframes=1)
def invoke(self, name, nframes=1)
def invoke(self, name, nframes=1)