Exemplo n.º 1
0
def GetBaseTypes(module, type_name):
    t = FindGdbType(module, type_name)
    if t is None:
        # Type is a base type?
        return [JsDbgTypes.SBaseTypeResult(module, type_name, 0)]

    return GetBaseTypesFromGdbType(module, t)
Exemplo n.º 2
0
def GetBaseTypesFromGdbType(module, type, extra_bitoffset=0):
    try:
        fields = type.fields()
    except:
        # Type does not have fields (not a struct/class/union)
        return [JsDbgTypes.SBaseTypeResult(module, type.name, 0)]

    resultFields = []
    for field in fields:
        if not field.is_base_class:
            continue
        resultFields.append(JsDbgTypes.SBaseTypeResult(
            module, field.type.name, (extra_bitoffset + field.bitpos) / 8))
        resultFields.extend(GetBaseTypesFromGdbType(
            module, field.type, extra_bitoffset + field.bitpos))

    return resultFields