aboutsummaryrefslogtreecommitdiff
path: root/kapi/gdb/devices
diff options
context:
space:
mode:
Diffstat (limited to 'kapi/gdb/devices')
-rw-r--r--kapi/gdb/devices/__init__.py1
-rw-r--r--kapi/gdb/devices/device.py20
2 files changed, 21 insertions, 0 deletions
diff --git a/kapi/gdb/devices/__init__.py b/kapi/gdb/devices/__init__.py
new file mode 100644
index 0000000..3bab1ea
--- /dev/null
+++ b/kapi/gdb/devices/__init__.py
@@ -0,0 +1 @@
+from .device import KapiDevicesDevicePrinter
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