From c63f340d90800895f007de64b7d2d14624263331 Mon Sep 17 00:00:00 2001 From: nthnluu Date: Sun, 28 Jan 2024 21:20:27 -0500 Subject: Created student weenix repository --- python/weenix/info.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 python/weenix/info.py (limited to 'python/weenix/info.py') 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 -- cgit v1.2.3-70-g09d2