aboutsummaryrefslogtreecommitdiff
path: root/python/weenix/info.py
blob: e624746a6ee60d82cd44713cdd418df5fec9320a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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