feat: owloysius - dynamic init function invocator
[lunaix-os.git] / lunaix-os / scripts / gdb / lunadbg / utils.py
index b48adee776a8bc2961c134ef0a8aa84cde6d07a3..43d947a3df4a1342d409aaf68863084ae38203c5 100644 (file)
@@ -1,6 +1,16 @@
+import gdb
 
 def pid_argument(argument):
     if not argument:
         return "__current"
     else:
-        return f"sched_ctx._procs[({argument})]"
\ No newline at end of file
+        return f"sched_ctx._procs[({argument})]"
+
+def llist_foreach(head, container_type, cb):
+    c = head
+    i = 0
+    while (c["next"] != head):
+        el = c["next"].cast(container_type)
+        cb(i, el)
+        c = c["next"]
+        i+=1
\ No newline at end of file