aboutsummaryrefslogtreecommitdiff
path: root/kapi/gdb/devices/device.py
diff options
context:
space:
mode:
Diffstat (limited to 'kapi/gdb/devices/device.py')
-rw-r--r--kapi/gdb/devices/device.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/kapi/gdb/devices/device.py b/kapi/gdb/devices/device.py
new file mode 100644
index 0000000..8e515ef
--- /dev/null
+++ b/kapi/gdb/devices/device.py
@@ -0,0 +1,20 @@
+import gdb
+
+
+class KapiDevicesDevicePrinter(gdb.ValuePrinter):
+ def __init__(self, val):
+ self.__val = val
+
+ def to_string(self):
+ return (
+ f"{self.__val['m_name']} @ {self.__val['m_major']}:{self.__val['m_minor']}"
+ )
+
+ def children(self):
+ yield ("major", self.__val["m_major"])
+ yield ("minor", self.__val["m_minor"])
+ yield ("name", self.__val["m_name"])
+ yield ("parent", self.__val["m_parent"])
+
+ def display_hint(self):
+ return None