GIF89a;
0: frame = frame.older () nframes = nframes - 1 return frame.name () == name.string () class CallerMatches (gdb.Function): """Return True if the calling function's name matches a string. This function takes one or two arguments. The first argument is a regular expression; if the calling function's name is matched by this argument, this function returns True. The optional second argument tells this function how many stack frames to traverse to find the calling function. The default is 1.""" def __init__ (self): super (CallerMatches, self).__init__ ("caller_matches") def invoke (self, name, nframes = 1): frame = gdb.selected_frame () while nframes > 0: frame = frame.older () nframes = nframes - 1 return re.match (name.string (), frame.name ()) is not None CallerIs() CallerMatches()