Exemple #1
0
def load(name, dtype=None, dmemb=None):
	weenix.assert_type(name, _list_type)

	if (dtype != None):
		try:
			if (not isinstance(dtype, gdb.Type)):
				typ = gdb.lookup_type(dtype)
			else:
				typ = dtype
		except RuntimeError:
			raise gdb.GdbError("no such type: {0}".format(dtype))
	
		found = False
		for field in typ.strip_typedefs().fields():
			if (field.name == dmemb):
				try:
					weenix.assert_type(field.type, _list_link_type)
				except gdb.GdbError as err:
					raise gdb.GdbError(
						"field '{0}' of type '{1}' has wrong type: {2}"
						.format(dmemb, dtype, str(err)))
				found = True
		if (not found):
			raise gdb.GdbError("'{0}' type does not contain field '{1}'"
							   .format(dtype, dmemb))

	value = name if isinstance(name, gdb.Value) else gdb.parse_and_eval(name)
	return List(value, dtype, dmemb)
Exemple #2
0
def load(name, dtype=None, dmemb=None):
    weenix.assert_type(name, _list_type)

    if (dtype != None):
        try:
            if (not isinstance(dtype, gdb.Type)):
                typ = gdb.lookup_type(dtype)
            else:
                typ = dtype
        except RuntimeError:
            raise gdb.GdbError("no such type: {0}".format(dtype))

        found = False
        for field in typ.strip_typedefs().fields():
            if (field.name == dmemb):
                try:
                    weenix.assert_type(field.type, _list_link_type)
                except gdb.GdbError as err:
                    raise gdb.GdbError(
                        "field '{0}' of type '{1}' has wrong type: {2}".format(
                            dmemb, dtype, str(err)))
                found = True
        if (not found):
            raise gdb.GdbError(
                "'{0}' type does not contain field '{1}'".format(dtype, dmemb))

    value = name if isinstance(name, gdb.Value) else gdb.parse_and_eval(name)
    return List(value, dtype, dmemb)
Exemple #3
0
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
Exemple #4
0
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