Package lldb :: Class SBType |
[hide private]
[frames] | no frames]

# Class SBType

source code

        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
    ', 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)

        ...

Instance Methods | [hide private]
__setattr__(self, name, value) x.__setattr__('name', value) <==> x.name = value | source code
__getattr__(self, name) | source code
__repr__(self) repr(x) | source code
__iter__(self) | source code
__len__(self) | source code
__eq__(self, other) | source code
__ne__(self, other) | source code
__init__(self, *args) __init__(lldb::SBType self) -> SBType __init__(lldb::SBType self, SBType rhs) -> SBType | source code
__swig_destroy__(...) delete_SBType(SBType self) |
__del__(self) | source code
__nonzero__(self) | source code
IsValid(self) IsValid(SBType self) -> bool | source code
GetByteSize(self) GetByteSize(SBType self) -> uint64_t | source code
IsPointerType(self) IsPointerType(SBType self) -> bool | source code
IsReferenceType(self) IsReferenceType(SBType self) -> bool | source code
IsFunctionType(self) IsFunctionType(SBType self) -> bool | source code
IsPolymorphicClass(self) IsPolymorphicClass(SBType self) -> bool | source code
GetPointerType(self) GetPointerType(SBType self) -> SBType | source code
GetPointeeType(self) GetPointeeType(SBType self) -> SBType | source code
GetReferenceType(self) GetReferenceType(SBType self) -> SBType | source code
GetDereferencedType(self) GetDereferencedType(SBType self) -> SBType | source code
GetUnqualifiedType(self) GetUnqualifiedType(SBType self) -> SBType | source code
GetCanonicalType(self) GetCanonicalType(SBType self) -> SBType | source code
GetBasicType(self, *args) GetBasicType(SBType self) -> lldb::BasicType GetBasicType(SBType self, lldb::BasicType type) -> SBType | source code
GetNumberOfFields(self) GetNumberOfFields(SBType self) -> uint32_t | source code
GetNumberOfDirectBaseClasses(self) GetNumberOfDirectBaseClasses(SBType self) -> uint32_t | source code
GetNumberOfVirtualBaseClasses(self) GetNumberOfVirtualBaseClasses(SBType self) -> uint32_t | source code
GetFieldAtIndex(self, *args) GetFieldAtIndex(SBType self, uint32_t idx) -> SBTypeMember | source code
GetDirectBaseClassAtIndex(self, *args) GetDirectBaseClassAtIndex(SBType self, uint32_t idx) -> SBTypeMember | source code
GetVirtualBaseClassAtIndex(self, *args) GetVirtualBaseClassAtIndex(SBType self, uint32_t idx) -> SBTypeMember | source code
GetName(self) GetName(SBType self) -> str const * | source code
GetTypeClass(self) GetTypeClass(SBType self) -> lldb::TypeClass | source code
GetNumberOfTemplateArguments(self) GetNumberOfTemplateArguments(SBType self) -> uint32_t | source code
GetTemplateArgumentType(self, *args) GetTemplateArgumentType(SBType self, uint32_t idx) -> SBType | source code
GetTemplateArgumentKind(self, *args) GetTemplateArgumentKind(SBType self, uint32_t idx) -> lldb::TemplateArgumentKind | source code
GetFunctionReturnType(self) GetFunctionReturnType(SBType self) -> SBType | source code
GetFunctionArgumentTypes(self) GetFunctionArgumentTypes(SBType self) -> SBTypeList | source code
IsTypeComplete(self) IsTypeComplete(SBType self) -> bool | source code
template_arg_array(self) | source code
get_bases_array(self) An accessor function that returns a list() that contains all direct base classes in a lldb.SBType object. | source code
get_vbases_array(self) An accessor function that returns a list() that contains all fields in a lldb.SBType object. | source code
get_fields_array(self) An accessor function that returns a list() that contains all fields in a lldb.SBType object. | source code
get_members_array(self) 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. | source code
__str__(self) __str__(SBType self) -> PyObject * | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

Class Variables | [hide private]
| __swig_setmethods__ = ``{``}``
| __swig_getmethods__ = `{}`

Properties | [hide private]
| bases A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes 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.
| 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.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __setattr__(self, name, value) | source code
x.__setattr__('name', value) <==> x.name = value Overrides: object.__setattr__ (inherited documentation)

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### __init__(self, *args) (Constructor) | source code
__init__(lldb::SBType self) -> SBType __init__(lldb::SBType self, SBType rhs) -> SBType Overrides: object.__init__

### __str__(self) (Informal representation operator) | source code
__str__(SBType self) -> PyObject * Overrides: object.__str__

Property Details | [hide private]

### bases A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes for this type. Get Method: get_bases_array(self) - An accessor function that returns a list() that contains all direct base classes in a lldb.SBType object.

### fields A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the fields for this type. Get Method: get_fields_array(self) - An accessor function that returns a list() that contains all fields in a lldb.SBType object.

### 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). Get Method: IsTypeComplete(self) - IsTypeComplete(SBType self) -> bool

### is_pointer A read only property that returns a boolean value that indicates if this type is a pointer type. Get Method: IsPointerType(self) - IsPointerType(SBType self) -> bool

### is_reference A read only property that returns a boolean value that indicates if this type is a function type. Get Method: IsReferenceType(self) - IsReferenceType(SBType self) -> bool

### 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. Get Method: get_members_array(self) - 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.

### name A read only property that returns the name for this type as a string. Get Method: GetName(self) - GetName(SBType self) -> str const *

### num_bases A read only property that returns number of direct base classes in this type as an integer. Get Method: GetNumberOfDirectBaseClasses(self) - GetNumberOfDirectBaseClasses(SBType self) -> uint32_t

### num_fields A read only property that returns number of fields in this type as an integer. Get Method: GetNumberOfFields(self) - GetNumberOfFields(SBType self) -> uint32_t

### num_template_args A read only property that returns number of template arguments in this type as an integer. Get Method: GetNumberOfTemplateArguments(self) - GetNumberOfTemplateArguments(SBType self) -> uint32_t

### num_vbases A read only property that returns number of virtual base classes in this type as an integer. Get Method: GetNumberOfVirtualBaseClasses(self) - GetNumberOfVirtualBaseClasses(SBType self) -> uint32_t

### size A read only property that returns size in bytes for this type as an integer. Get Method: GetByteSize(self) - GetByteSize(SBType self) -> uint64_t

### template_args A read only property that returns a list() of lldb.SBType objects that represent all template arguments in this type. Get Method: template_arg_array(self)

### 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. Get Method: GetTypeClass(self) - GetTypeClass(SBType self) -> lldb::TypeClass

### vbases A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the virtual base classes for this type. Get Method: get_vbases_array(self) - An accessor function that returns a list() that contains all fields in a lldb.SBType object.