-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathframefilter.py
37 lines (26 loc) · 940 Bytes
/
framefilter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gdb
import itertools
import cpp_pretty_frame
import functools
class CppFrameDecorator(gdb.FrameDecorator.FrameDecorator):
def __init__(self, fobj, frame_printer):
super(CppFrameDecorator, self).__init__(fobj)
self.fobj = fobj
self.frame_printer = frame_printer
def function(self):
frame = self.fobj.inferior_frame()
name = self.frame_printer.parse_line(str(frame.name()))
return name
class CppFrameFilter():
def __init__(self):
self.name = "C++ frame filter"
self.priority = 100
self.enabled = True
self.frame_printer = cpp_pretty_frame.PrettyFrame()
gdb.frame_filters[self.name] = self
def filter(self, frame_iter):
frame_iter = itertools.imap(
functools.partial(CppFrameDecorator,
frame_printer=self.frame_printer),
frame_iter)
return frame_iter