-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbacktrace.py
More file actions
40 lines (29 loc) · 963 Bytes
/
backtrace.py
File metadata and controls
40 lines (29 loc) · 963 Bytes
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
38
39
40
import gdb
from gdb.FrameDecorator import FrameDecorator
class LispFrameFilter:
def __init__(self, enabled=True):
self.name = "lisp-objects"
self.enabled = enabled
self.priority = 100
gdb.frame_filters[self.name] = self
def filter(self, frames):
for frame in frames:
if CFunctions.cool_func(frame.function()):
yield LispFrameDecorator(frame.inferior_frame())
class LispFrameDecorator(FrameDecorator):
def __init__(self, frame: gdb.Frame):
super().__init__(frame)
self.lisp_function = LispFunction.create(frame)
def address(self):
return None
def filename(self):
return None
def line(self):
return None
def function(self):
return self.lisp_function.name()
def frame_args(self):
try:
return self.lisp_function.args_list()
except InvalidArgsError as e:
return e.args