aboutsummaryrefslogtreecommitdiff
path: root/python/weenix/info.py
diff options
context:
space:
mode:
authornthnluu <nate1299@me.com>2024-01-28 21:20:27 -0500
committernthnluu <nate1299@me.com>2024-01-28 21:20:27 -0500
commitc63f340d90800895f007de64b7d2d14624263331 (patch)
tree2c0849fa597dd6da831c8707b6f2603403778d7b /python/weenix/info.py
Created student weenix repository
Diffstat (limited to 'python/weenix/info.py')
-rw-r--r--python/weenix/info.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/weenix/info.py b/python/weenix/info.py
new file mode 100644
index 0000000..e624746
--- /dev/null
+++ b/python/weenix/info.py
@@ -0,0 +1,20 @@
+import gdb
+import weenix
+
+_dbg_infofunc_type = gdb.lookup_type("dbg_infofunc_t")
+_char_p_type = gdb.lookup_type("char").pointer()
+
+def string(infofunc, data=None):
+ weenix.assert_type("&" + infofunc, _dbg_infofunc_type)
+
+ if (data == None):
+ data = "0"
+
+ npages = 8
+ buf = weenix.eval_func("page_alloc_n", npages)
+
+ weenix.eval_func(infofunc, data, buf, "PAGE_SIZE")
+ res = buf.cast(_char_p_type).string()
+
+ weenix.eval_func("page_free_n", buf, npages);
+ return res