21 """Check the calling function's name.
24 $_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.
40 super(CallerIs, self).
__init__(
"_caller_is")
44 raise ValueError(
"nframes must be >= 0")
45 frame = gdb.selected_frame()
51 return frame.name() == name.string()
54 """Compare the calling function's name with a regexp.
57 $_caller_matches(regex [, number_of_frames])
61 regex: The regular expression to compare the function's name with.
63 number_of_frames: How many stack frames to traverse back from the currently
64 selected frame to compare with. If the value is greater than the depth of
65 the stack from that point then the result is False.
69 True if the function's name at the specified frame matches regex.
73 super(CallerMatches, self).
__init__(
"_caller_matches")
77 raise ValueError(
"nframes must be >= 0")
78 frame = gdb.selected_frame()
84 return re.match(name.string(), frame.name())
is not None
87 """Check all calling function's names.
90 $_any_caller_is(name [, number_of_frames])
94 name: The name of the function to search for.
96 number_of_frames: How many stack frames to traverse back from the currently
97 selected frame to compare with. If the value is greater than the depth of
98 the stack from that point then the result is False.
102 True if any function's name is equal to name.
106 super(AnyCallerIs, self).
__init__(
"_any_caller_is")
110 raise ValueError(
"nframes must be >= 0")
111 frame = gdb.selected_frame()
113 if frame.name() == name.string():
115 frame = frame.older()
118 nframes = nframes - 1
122 """Compare all calling function's names with a regexp.
125 $_any_caller_matches(regex [, number_of_frames])
129 regex: The regular expression to compare the function's name with.
131 number_of_frames: How many stack frames to traverse back from the currently
132 selected frame to compare with. If the value is greater than the depth of
133 the stack from that point then the result is False.
137 True if any function's name matches regex.
141 super(AnyCallerMatches, self).
__init__(
"_any_caller_matches")
145 raise ValueError(
"nframes must be >= 0")
146 frame = gdb.selected_frame()
147 name_re = re.compile(name.string())
149 if name_re.match(frame.name())
is not None:
151 frame = frame.older()
154 nframes = nframes - 1