SBType

class lldb.SBType(*args)

Represents a data type in lldb. The FindFirstType() method of SBTarget/SBModule returns a SBType.

SBType supports the eq/ne operator. For example,:

//main.cpp:

class Task {
public:
    int id;
    Task *next;
    Task(int i, Task *n):
        id(i),
        next(n)
    {}
};

int main (int argc, char const *argv[])
{
    Task *task_head = new Task(-1, NULL);
    Task *task1 = new Task(1, NULL);
    Task *task2 = new Task(2, NULL);
    Task *task3 = new Task(3, NULL); // Orphaned.
    Task *task4 = new Task(4, NULL);
    Task *task5 = new Task(5, NULL);

    task_head->next = task1;
    task1->next = task2;
    task2->next = task4;
    task4->next = task5;

    int total = 0;
    Task *t = task_head;
    while (t != NULL) {
        if (t->id >= 0)
            ++total;
        t = t->next;
    }
    printf('We have a total number of %d tasks\n', total);

    // This corresponds to an empty task list.
    Task *empty_task_head = new Task(-1, NULL);

    return 0; // Break at this line
}

# find_type.py:

        # Get the type 'Task'.
        task_type = target.FindFirstType('Task')
        self.assertTrue(task_type)

        # Get the variable 'task_head'.
        frame0.FindVariable('task_head')
        task_head_type = task_head.GetType()
        self.assertTrue(task_head_type.IsPointerType())

        # task_head_type is 'Task *'.
        task_pointer_type = task_type.GetPointerType()
        self.assertTrue(task_head_type == task_pointer_type)

        # Get the child mmember 'id' from 'task_head'.
        id = task_head.GetChildMemberWithName('id')
        id_type = id.GetType()

        # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h).
        int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
        # id_type and int_type should be the same type!
        self.assertTrue(id_type == int_type)

Attributes Summary

bases A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes for this type.
enum_members A read only property that returns a list() of all lldb.SBTypeEnumMember objects that represent the enum members for this type.
fields A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the fields for this type.
is_complete A read only property that returns a boolean value that indicates if this type is a complete type (True) or a forward declaration (False).
is_pointer A read only property that returns a boolean value that indicates if this type is a pointer type.
is_reference A read only property that returns a boolean value that indicates if this type is a function type.
members A read only property that returns a list() of all lldb.SBTypeMember objects that represent all of the base classes, virtual base classes and fields for this type in ascending bit offset order.
module A read only property that returns the module in which type is defined.
name A read only property that returns the name for this type as a string.
num_bases A read only property that returns number of direct base classes in this type as an integer.
num_fields A read only property that returns number of fields in this type as an integer.
num_template_args A read only property that returns number of template arguments in this type as an integer.
num_vbases A read only property that returns number of virtual base classes in this type as an integer.
size A read only property that returns size in bytes for this type as an integer.
template_args A read only property that returns a list() of lldb.SBType objects that represent all template arguments in this type.
type A read only property that returns an lldb enumeration value (see enumerations that start with “lldb.eTypeClass”) that represents a classification for this type.
vbases A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the virtual base classes for this type.

Methods Summary

GetArrayElementType(SBType self)
GetArrayType(SBType self, uint64_t size)
GetBasicType(SBType self) GetBasicType(SBType self, lldb::BasicType type) -> SBType
GetByteSize(SBType self)
GetCanonicalType(SBType self)
GetDereferencedType(SBType self)
GetDirectBaseClassAtIndex(SBType self, …)
GetDisplayTypeName(SBType self)
GetEnumMembers(SBType self)
GetEnumerationIntegerType(SBType self)
GetFieldAtIndex(SBType self, uint32_t idx)
GetFunctionArgumentTypes(SBType self)
GetFunctionReturnType(SBType self)
GetMemberFunctionAtIndex(SBType self, …)
GetModule(SBType self)
GetName(SBType self)
GetNumberOfDirectBaseClasses(SBType self)
GetNumberOfFields(SBType self)
GetNumberOfMemberFunctions(SBType self)
GetNumberOfTemplateArguments(SBType self)
GetNumberOfVirtualBaseClasses(SBType self)
GetPointeeType(SBType self)
GetPointerType(SBType self)
GetReferenceType(SBType self)
GetTemplateArgumentKind(SBType self, …)
GetTemplateArgumentType(SBType self, …)
GetTypeClass(SBType self)
GetTypeFlags(SBType self)
GetTypedefedType(SBType self)
GetUnqualifiedType(SBType self)
GetVectorElementType(SBType self)
GetVirtualBaseClassAtIndex(SBType self, …)
IsAnonymousType(SBType self)
IsArrayType(SBType self)
IsFunctionType(SBType self)
IsPointerType(SBType self)
IsPolymorphicClass(SBType self)
IsReferenceType(SBType self)
IsScopedEnumerationType(SBType self)
IsTypeComplete(SBType self)
IsTypedefType(SBType self)
IsValid(SBType self)
IsVectorType(SBType self)
get_bases_array() An accessor function that returns a list() that contains all direct base classes in a lldb.SBType object.
get_enum_members_array() An accessor function that returns a list() that contains all enum members in an lldb.SBType object.
get_fields_array() An accessor function that returns a list() that contains all fields in a lldb.SBType object.
get_members_array() An accessor function that returns a list() that contains all members (base classes and fields) in a lldb.SBType object in ascending bit offset order.
get_vbases_array() An accessor function that returns a list() that contains all fields in a lldb.SBType object.
template_arg_array()

Attributes Documentation

bases

A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes for this type.

enum_members

A read only property that returns a list() of all lldb.SBTypeEnumMember objects that represent the enum members for this type.

fields

A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the fields for this type.

is_complete

A read only property that returns a boolean value that indicates if this type is a complete type (True) or a forward declaration (False).

is_pointer

A read only property that returns a boolean value that indicates if this type is a pointer type.

is_reference

A read only property that returns a boolean value that indicates if this type is a function type.

members

A read only property that returns a list() of all lldb.SBTypeMember objects that represent all of the base classes, virtual base classes and fields for this type in ascending bit offset order.

module

A read only property that returns the module in which type is defined.

name

A read only property that returns the name for this type as a string.

num_bases

A read only property that returns number of direct base classes in this type as an integer.

num_fields

A read only property that returns number of fields in this type as an integer.

num_template_args

A read only property that returns number of template arguments in this type as an integer.

num_vbases

A read only property that returns number of virtual base classes in this type as an integer.

size

A read only property that returns size in bytes for this type as an integer.

template_args

A read only property that returns a list() of lldb.SBType objects that represent all template arguments in this type.

type

A read only property that returns an lldb enumeration value (see enumerations that start with “lldb.eTypeClass”) that represents a classification for this type.

vbases

A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the virtual base classes for this type.

Methods Documentation

GetArrayElementType(SBType self) → SBType
GetArrayType(SBType self, uint64_t size) → SBType
GetBasicType(SBType self) → lldb::BasicType

GetBasicType(SBType self, lldb::BasicType type) -> SBType

GetByteSize(SBType self) → uint64_t
GetCanonicalType(SBType self) → SBType
GetDereferencedType(SBType self) → SBType
GetDirectBaseClassAtIndex(SBType self, uint32_t idx) → SBTypeMember
GetDisplayTypeName(SBType self) → char const *
GetEnumMembers(SBType self) → SBTypeEnumMemberList
GetEnumerationIntegerType(SBType self) → SBType
GetFieldAtIndex(SBType self, uint32_t idx) → SBTypeMember
GetFunctionArgumentTypes(SBType self) → SBTypeList
GetFunctionReturnType(SBType self) → SBType
GetMemberFunctionAtIndex(SBType self, uint32_t idx) → SBTypeMemberFunction
GetModule(SBType self) → SBModule
GetName(SBType self) → char const *
GetNumberOfDirectBaseClasses(SBType self) → uint32_t
GetNumberOfFields(SBType self) → uint32_t
GetNumberOfMemberFunctions(SBType self) → uint32_t
GetNumberOfTemplateArguments(SBType self) → uint32_t
GetNumberOfVirtualBaseClasses(SBType self) → uint32_t
GetPointeeType(SBType self) → SBType
GetPointerType(SBType self) → SBType
GetReferenceType(SBType self) → SBType
GetTemplateArgumentKind(SBType self, uint32_t idx) → lldb::TemplateArgumentKind
GetTemplateArgumentType(SBType self, uint32_t idx) → SBType
GetTypeClass(SBType self) → lldb::TypeClass
GetTypeFlags(SBType self) → uint32_t
GetTypedefedType(SBType self) → SBType
GetUnqualifiedType(SBType self) → SBType
GetVectorElementType(SBType self) → SBType
GetVirtualBaseClassAtIndex(SBType self, uint32_t idx) → SBTypeMember
IsAnonymousType(SBType self) → bool
IsArrayType(SBType self) → bool
IsFunctionType(SBType self) → bool
IsPointerType(SBType self) → bool
IsPolymorphicClass(SBType self) → bool
IsReferenceType(SBType self) → bool
IsScopedEnumerationType(SBType self) → bool
IsTypeComplete(SBType self) → bool
IsTypedefType(SBType self) → bool
IsValid(SBType self) → bool
IsVectorType(SBType self) → bool
get_bases_array()

An accessor function that returns a list() that contains all direct base classes in a lldb.SBType object.

get_enum_members_array()

An accessor function that returns a list() that contains all enum members in an lldb.SBType object.

get_fields_array()

An accessor function that returns a list() that contains all fields in a lldb.SBType object.

get_members_array()

An accessor function that returns a list() that contains all members (base classes and fields) in a lldb.SBType object in ascending bit offset order.

get_vbases_array()

An accessor function that returns a list() that contains all fields in a lldb.SBType object.

template_arg_array()