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

# Class SBValue

source code

    Represents the value of a variable, a register, or an expression.

    SBValue supports iteration through its child, which in turn is represented
    as an SBValue.  For example, we can get the general purpose registers of a
    frame as an SBValue, and iterate through all the registers,

        registerSet = frame.GetRegisters() # Returns an SBValueList.
        for regs in registerSet:
            if 'general purpose registers' in regs.getName().lower():
                GPRs = regs
                break

        print '%s (number of children = %d):' % (GPRs.GetName(), GPRs.GetNumChildren())
        for reg in GPRs:
            print 'Name: ', reg.GetName(), ' Value: ', reg.GetValue()

    produces the output:

    General Purpose Registers (number of children = 21):
    Name:  rax  Value:  0x0000000100000c5c
    Name:  rbx  Value:  0x0000000000000000
    Name:  rcx  Value:  0x00007fff5fbffec0
    Name:  rdx  Value:  0x00007fff5fbffeb8
    Name:  rdi  Value:  0x0000000000000001
    Name:  rsi  Value:  0x00007fff5fbffea8
    Name:  rbp  Value:  0x00007fff5fbffe80
    Name:  rsp  Value:  0x00007fff5fbffe60
    Name:  r8  Value:  0x0000000008668682
    Name:  r9  Value:  0x0000000000000000
    Name:  r10  Value:  0x0000000000001200
    Name:  r11  Value:  0x0000000000000206
    Name:  r12  Value:  0x0000000000000000
    Name:  r13  Value:  0x0000000000000000
    Name:  r14  Value:  0x0000000000000000
    Name:  r15  Value:  0x0000000000000000
    Name:  rip  Value:  0x0000000100000dae
    Name:  rflags  Value:  0x0000000000000206
    Name:  cs  Value:  0x0000000000000027
    Name:  fs  Value:  0x0000000000000010
    Name:  gs  Value:  0x0000000000000048

    See also linked_list_iter() for another perspective on how to iterate through an
    SBValue instance which interprets the value object as representing the head of a
    linked list.

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
__eol_test__(val) Default function for end of list test takes an SBValue object. | source code
linked_list_iter(self, next_item_name, end_of_list_test=<function __eol_test__ at 0x1b106e0>) Generator adaptor to support iteration for SBValue as a linked list. | source code
__init__(self, *args) __init__(lldb::SBValue self) -> SBValue __init__(lldb::SBValue self, SBValue rhs) -> SBValue | source code
__swig_destroy__(...) delete_SBValue(SBValue self) |
__del__(self) | source code
__nonzero__(self) | source code
IsValid(self) IsValid(SBValue self) -> bool | source code
Clear(self) Clear(SBValue self) | source code
GetError(self) GetError(SBValue self) -> SBError | source code
GetID(self) GetID(SBValue self) -> lldb::user_id_t | source code
GetName(self) GetName(SBValue self) -> str const * | source code
GetTypeName(self) GetTypeName(SBValue self) -> str const * | source code
GetByteSize(self) GetByteSize(SBValue self) -> size_t | source code
IsInScope(self) IsInScope(SBValue self) -> bool | source code
GetFormat(self) GetFormat(SBValue self) -> lldb::Format | source code
SetFormat(self, *args) SetFormat(SBValue self, lldb::Format format) | source code
GetValue(self) GetValue(SBValue self) -> str const * | source code
GetValueAsSigned(self, *args) GetValueAsSigned(SBValue self, SBError error, int64_t fail_value=0) -> int64_t GetValueAsSigned(SBValue self, SBError error) -> int64_t GetValueAsSigned(SBValue self, int64_t fail_value=0) -> int64_t GetValueAsSigned(SBValue self) -> int64_t | source code
GetValueAsUnsigned(self, *args) GetValueAsUnsigned(SBValue self, SBError error, uint64_t fail_value=0) -> uint64_t GetValueAsUnsigned(SBValue self, SBError error) -> uint64_t GetValueAsUnsigned(SBValue self, uint64_t fail_value=0) -> uint64_t GetValueAsUnsigned(SBValue self) -> uint64_t | source code
GetValueType(self) GetValueType(SBValue self) -> lldb::ValueType | source code
GetValueDidChange(self) GetValueDidChange(SBValue self) -> bool | source code
GetSummary(self) GetSummary(SBValue self) -> str const * | source code
GetObjectDescription(self) GetObjectDescription(SBValue self) -> str const * | source code
GetDynamicValue(self, *args) GetDynamicValue(SBValue self, lldb::DynamicValueType use_dynamic) -> SBValue | source code
GetStaticValue(self) GetStaticValue(SBValue self) -> SBValue | source code
GetNonSyntheticValue(self) GetNonSyntheticValue(SBValue self) -> SBValue | source code
GetPreferDynamicValue(self) GetPreferDynamicValue(SBValue self) -> lldb::DynamicValueType | source code
SetPreferDynamicValue(self, *args) SetPreferDynamicValue(SBValue self, lldb::DynamicValueType use_dynamic) | source code
GetPreferSyntheticValue(self) GetPreferSyntheticValue(SBValue self) -> bool | source code
SetPreferSyntheticValue(self, *args) SetPreferSyntheticValue(SBValue self, bool use_synthetic) | source code
IsDynamic(self) IsDynamic(SBValue self) -> bool | source code
IsSynthetic(self) IsSynthetic(SBValue self) -> bool | source code
GetLocation(self) GetLocation(SBValue self) -> str const * | source code
SetValueFromCString(self, *args) SetValueFromCString(SBValue self, str const * value_str) -> bool SetValueFromCString(SBValue self, str const * value_str, SBError error) -> bool | source code
GetTypeFormat(self) GetTypeFormat(SBValue self) -> SBTypeFormat | source code
GetTypeSummary(self) GetTypeSummary(SBValue self) -> SBTypeSummary | source code
GetTypeFilter(self) GetTypeFilter(SBValue self) -> SBTypeFilter | source code
GetTypeSynthetic(self) GetTypeSynthetic(SBValue self) -> SBTypeSynthetic | source code
GetChildAtIndex(self, *args) GetChildAtIndex(SBValue self, uint32_t idx) -> SBValue GetChildAtIndex(SBValue self, uint32_t idx, lldb::DynamicValueType use_dynamic, bool can_create_synthetic) -> SBValue | source code
CreateChildAtOffset(self, *args) CreateChildAtOffset(SBValue self, str const * name, uint32_t offset, SBType type) -> SBValue | source code
Cast(self, *args) Cast(SBValue self, SBType type) -> SBValue | source code
CreateValueFromExpression(self, *args) CreateValueFromExpression(SBValue self, str const * name, str const * expression) -> SBValue CreateValueFromExpression(SBValue self, str const * name, str const * expression, SBExpressionOptions options) -> SBValue | source code
CreateValueFromAddress(self, *args) CreateValueFromAddress(SBValue self, str const * name, lldb::addr_t address, SBType type) -> SBValue | source code
CreateValueFromData(self, *args) CreateValueFromData(SBValue self, str const * name, SBData data, SBType type) -> SBValue | source code
GetType(self) GetType(SBValue self) -> SBType | source code
GetIndexOfChildWithName(self, *args) GetIndexOfChildWithName(SBValue self, str const * name) -> uint32_t | source code
GetChildMemberWithName(self, *args) GetChildMemberWithName(SBValue self, str const * name) -> SBValue GetChildMemberWithName(SBValue self, str const * name, lldb::DynamicValueType use_dynamic) -> SBValue | source code
GetValueForExpressionPath(self, *args) GetValueForExpressionPath(SBValue self, str const * expr_path) -> SBValue | source code
GetDeclaration(self) GetDeclaration(SBValue self) -> SBDeclaration | source code
MightHaveChildren(self) MightHaveChildren(SBValue self) -> bool | source code
GetNumChildren(self) GetNumChildren(SBValue self) -> uint32_t | source code
GetOpaqueType(self) GetOpaqueType(SBValue self) -> void * | source code
Dereference(self) Dereference(SBValue self) -> SBValue | source code
AddressOf(self) AddressOf(SBValue self) -> SBValue | source code
TypeIsPointerType(self) TypeIsPointerType(SBValue self) -> bool | source code
GetTarget(self) GetTarget(SBValue self) -> SBTarget | source code
GetProcess(self) GetProcess(SBValue self) -> SBProcess | source code
GetThread(self) GetThread(SBValue self) -> SBThread | source code
GetFrame(self) GetFrame(SBValue self) -> SBFrame | source code
Watch(self, *args) Watch(SBValue self, bool resolve_location, bool read, bool write, SBError error) -> SBWatchpoint | source code
WatchPointee(self, *args) WatchPointee(SBValue self, bool resolve_location, bool read, bool write, SBError error) -> SBWatchpoint | source code
GetDescription(self, *args) GetDescription(SBValue self, SBStream description) -> bool | source code
GetPointeeData(self, item_idx=0, item_count=1) GetPointeeData(SBValue self, uint32_t item_idx=0, uint32_t item_count=1) -> SBData GetPointeeData(SBValue self, uint32_t item_idx=0) -> SBData GetPointeeData(SBValue self) -> SBData | source code
GetData(self) GetData(SBValue self) -> SBData | source code
SetData(self, *args) SetData(SBValue self, SBData data, SBError error) -> bool | source code
GetLoadAddress(self) GetLoadAddress(SBValue self) -> lldb::addr_t | source code
GetAddress(self) GetAddress(SBValue self) -> SBAddress | source code
GetExpressionPath(self, *args) GetExpressionPath(SBValue self, SBStream description) -> bool GetExpressionPath(SBValue self, SBStream description, bool qualify_cxx_base_classes) -> bool | source code
__get_dynamic__(self) Helper function for the "SBValue.dynamic" property. | source code
get_expr_path(self) | source code
__str__(self) __str__(SBValue 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]
| addr A read only property that returns an lldb.SBAddress that represents the address of this value if it is in memory.
| address_of A read only property that returns an lldb.SBValue that represents the address-of this value.
| changed A read only property that returns a boolean value that indicates if this value has changed since it was last updated.
| data A read only property that returns an lldb object (lldb.SBData) that represents the bytes that make up the value for this object.
| deref A read only property that returns an lldb.SBValue that is created by dereferencing this value.
| description A read only property that returns the language-specific description of this value as a string
| dynamic A read only property that returns an lldb.SBValue that is created by finding the dynamic type of this value.
| error A read only property that returns the lldb.SBError that represents the error from the last time the variable value was calculated.
| format A read/write property that gets/sets the format used for lldb.SBValue().GetValue() for this value.
| frame A read only property that returns the lldb.SBFrame that this value is associated with, the returned value might be invalid and should be tested.
| is_in_scope A read only property that returns a boolean value that indicates whether this value is currently lexically in scope.
| load_addr A read only property that returns the load address of this value as an integer.
| location A read only property that returns the location of this value as a string.
| name A read only property that returns the name of this value as a string.
| num_children A read only property that returns the number of child lldb.SBValues that this value has.
| path A read only property that returns the expression path that one can use to reach this value in an expression.
| process A read only property that returns the lldb.SBProcess that this value is associated with, the returned value might be invalid and should be tested.
| signed A read only property that returns the value of this SBValue as a signed integer.
| size A read only property that returns the size in bytes of this value.
| summary A read only property that returns the summary for this value as a string
| target A read only property that returns the lldb.SBTarget that this value is associated with.
| thread A read only property that returns the lldb.SBThread that this value is associated with, the returned value might be invalid and should be tested.
| type A read only property that returns a lldb.SBType object that represents the type for this value.
| unsigned A read only property that returns the value of this SBValue as an usigned integer.
| value A read/write property that gets/sets value from a string.
| value_type A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eValueType") that represents the type of this value (local, argument, global, register, etc.).
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)

### __eol_test__(val) | source code
Default function for end of list test takes an SBValue object. Return True if val is invalid or it corresponds to a null pointer. Otherwise, return False.

### linked_list_iter(self, next_item_name, end_of_list_test=<function __eol_test__ at 0x1b106e0>) | source code
    Generator adaptor to support iteration for SBValue as a linked list.

    linked_list_iter() is a special purpose iterator to treat the SBValue as
    the head of a list data structure, where you specify the child member
    name which points to the next item on the list and you specify the
    end-of-list test function which takes an SBValue for an item and returns
    True if EOL is reached and False if not.

    linked_list_iter() also detects infinite loop and bails out early.

    The end_of_list_test arg, if omitted, defaults to the __eol_test__
    function above.

    For example,

    # Get Frame #0.
    ...

    # Get variable 'task_head'.
    task_head = frame0.FindVariable('task_head')
    ...

    for t in task_head.linked_list_iter('next'):
        print t

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

### GetChildAtIndex(self, *args) | source code
    GetChildAtIndex(SBValue self, uint32_t idx) -> SBValue
    GetChildAtIndex(SBValue self, uint32_t idx, lldb::DynamicValueType use_dynamic, bool can_create_synthetic) -> SBValue

    Get a child value by index from a value.

    Structs, unions, classes, arrays and and pointers have child
    values that can be access by index.

    Structs and unions access child members using a zero based index
    for each child member. For

    Classes reserve the first indexes for base classes that have
    members (empty base classes are omitted), and all members of the
    current class will then follow the base classes.

    Pointers differ depending on what they point to. If the pointer
    points to a simple type, the child at index zero
    is the only child value available, unless synthetic_allowed
    is true, in which case the pointer will be used as an array
    and can create 'synthetic' child values using positive or
    negative indexes. If the pointer points to an aggregate type
    (an array, class, union, struct), then the pointee is
    transparently skipped and any children are going to be the indexes
    of the child values within the aggregate type. For example if
    we have a 'Point' type and we have a SBValue that contains a
    pointer to a 'Point' type, then the child at index zero will be
    the 'x' member, and the child at index 1 will be the 'y' member
    (the child at index zero won't be a 'Point' instance).

    Arrays have a preset number of children that can be accessed by
    index and will returns invalid child values for indexes that are
    out of bounds unless the synthetic_allowed is true. In this
    case the array can create 'synthetic' child values for indexes
    that aren't in the array bounds using positive or negative
    indexes.

    @param[in] idx
        The index of the child value to get

    @param[in] use_dynamic
        An enumeration that specifies wether to get dynamic values,
        and also if the target can be run to figure out the dynamic
        type of the child value.

    @param[in] synthetic_allowed
        If true, then allow child values to be created by index
        for pointers and arrays for indexes that normally wouldn't
        be allowed.

    @return
        A new SBValue object that represents the child member value.

### GetIndexOfChildWithName(self, *args) | source code
    GetIndexOfChildWithName(SBValue self, str const * name) -> uint32_t

    Returns the child member index.

    Matches children of this object only and will match base classes and
    member names if this is a clang typed object.

    @param[in] name
        The name of the child value to get

    @return
        An index to the child member value.

### GetChildMemberWithName(self, *args) | source code
    GetChildMemberWithName(SBValue self, str const * name) -> SBValue
    GetChildMemberWithName(SBValue self, str const * name, lldb::DynamicValueType use_dynamic) -> SBValue

    Returns the child member value.

    Matches child members of this object and child members of any base
    classes.

    @param[in] name
        The name of the child value to get

    @param[in] use_dynamic
        An enumeration that specifies wether to get dynamic values,
        and also if the target can be run to figure out the dynamic
        type of the child value.

    @return
        A new SBValue object that represents the child member value.

### GetValueForExpressionPath(self, *args) | source code
GetValueForExpressionPath(SBValue self, str const * expr_path) -> SBValue Expands nested expressions like .a->b[0].c[1]->d.

### Watch(self, *args) | source code
Watch(SBValue self, bool resolve_location, bool read, bool write, SBError error) -> SBWatchpoint Find and watch a variable. It returns an SBWatchpoint, which may be invalid.

### WatchPointee(self, *args) | source code
WatchPointee(SBValue self, bool resolve_location, bool read, bool write, SBError error) -> SBWatchpoint Find and watch the location pointed to by a variable. It returns an SBWatchpoint, which may be invalid.

### GetPointeeData(self, item_idx=0, item_count=1) | source code
    GetPointeeData(SBValue self, uint32_t item_idx=0, uint32_t item_count=1) -> SBData
    GetPointeeData(SBValue self, uint32_t item_idx=0) -> SBData
    GetPointeeData(SBValue self) -> SBData

       Get an SBData wrapping what this SBValue points to.

       This method will dereference the current SBValue, if its
       data type is a T* or T[], and extract item_count elements
       of type T from it, copying their contents in an SBData.

       @param[in] item_idx
           The index of the first item to retrieve. For an array
           this is equivalent to array[item_idx], for a pointer
           to *(pointer + item_idx). In either case, the measurement
           unit for item_idx is the sizeof(T) rather than the byte

       @param[in] item_count
           How many items should be copied into the output. By default
           only one item is copied, but more can be asked for.

       @return
           An SBData with the contents of the copied items, on success.
           An empty SBData otherwise.

### GetData(self) | source code
    GetData(SBValue self) -> SBData

       Get an SBData wrapping the contents of this SBValue.

       This method will read the contents of this object in memory
       and copy them into an SBData for future use.

       @return
           An SBData with the contents of this SBValue, on success.
           An empty SBData otherwise.

### GetExpressionPath(self, *args) | source code
GetExpressionPath(SBValue self, SBStream description) -> bool GetExpressionPath(SBValue self, SBStream description, bool qualify_cxx_base_classes) -> bool Returns an expression path for this value.

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

Property Details | [hide private]

### addr A read only property that returns an lldb.SBAddress that represents the address of this value if it is in memory. Get Method: GetAddress(self) - GetAddress(SBValue self) -> SBAddress

### address_of A read only property that returns an lldb.SBValue that represents the address-of this value. Get Method: AddressOf(self) - AddressOf(SBValue self) -> SBValue

### changed A read only property that returns a boolean value that indicates if this value has changed since it was last updated. Get Method: GetValueDidChange(self) - GetValueDidChange(SBValue self) -> bool

### data A read only property that returns an lldb object (lldb.SBData) that represents the bytes that make up the value for this object. Get Method: GetData(self) - GetData(SBValue self) -> SBData

### deref A read only property that returns an lldb.SBValue that is created by dereferencing this value. Get Method: Dereference(self) - Dereference(SBValue self) -> SBValue

### description A read only property that returns the language-specific description of this value as a string Get Method: GetObjectDescription(self) - GetObjectDescription(SBValue self) -> str const *

### dynamic A read only property that returns an lldb.SBValue that is created by finding the dynamic type of this value. Get Method: __get_dynamic__(self) - Helper function for the "SBValue.dynamic" property.

### error A read only property that returns the lldb.SBError that represents the error from the last time the variable value was calculated. Get Method: GetError(self) - GetError(SBValue self) -> SBError

### format A read/write property that gets/sets the format used for lldb.SBValue().GetValue() for this value. See enumerations that start with "lldb.eFormat". Get Method: GetName(self) - GetName(SBValue self) -> str const * Set Method: SetFormat(self, *args) - SetFormat(SBValue self, lldb::Format format)

### frame A read only property that returns the lldb.SBFrame that this value is associated with, the returned value might be invalid and should be tested. Get Method: GetFrame(self) - GetFrame(SBValue self) -> SBFrame

### is_in_scope A read only property that returns a boolean value that indicates whether this value is currently lexically in scope. Get Method: IsInScope(self) - IsInScope(SBValue self) -> bool

### load_addr A read only property that returns the load address of this value as an integer. Get Method: GetLoadAddress(self) - GetLoadAddress(SBValue self) -> lldb::addr_t

### location A read only property that returns the location of this value as a string. Get Method: GetLocation(self) - GetLocation(SBValue self) -> str const *

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

### num_children A read only property that returns the number of child lldb.SBValues that this value has. Get Method: GetNumChildren(self) - GetNumChildren(SBValue self) -> uint32_t

### path A read only property that returns the expression path that one can use to reach this value in an expression. Get Method: get_expr_path(self)

### process A read only property that returns the lldb.SBProcess that this value is associated with, the returned value might be invalid and should be tested. Get Method: GetProcess(self) - GetProcess(SBValue self) -> SBProcess

### signed A read only property that returns the value of this SBValue as a signed integer. Get Method: GetValueAsSigned(self, *args) - GetValueAsSigned(SBValue self, SBError error, int64_t fail_value=0) -> int64_t GetValueAsSigned(SBValue self, SBError error) -> int64_t GetValueAsSigned(SBValue self, int64_t fail_value=0) -> int64_t GetValueAsSigned(SBValue self) -> int64_t

### size A read only property that returns the size in bytes of this value. Get Method: GetByteSize(self) - GetByteSize(SBValue self) -> size_t

### summary A read only property that returns the summary for this value as a string Get Method: GetSummary(self) - GetSummary(SBValue self) -> str const *

### target A read only property that returns the lldb.SBTarget that this value is associated with. Get Method: GetTarget(self) - GetTarget(SBValue self) -> SBTarget

### thread A read only property that returns the lldb.SBThread that this value is associated with, the returned value might be invalid and should be tested. Get Method: GetThread(self) - GetThread(SBValue self) -> SBThread

### type A read only property that returns a lldb.SBType object that represents the type for this value. Get Method: GetType(self) - GetType(SBValue self) -> SBType

### unsigned A read only property that returns the value of this SBValue as an usigned integer. Get Method: GetValueAsUnsigned(self, *args) - GetValueAsUnsigned(SBValue self, SBError error, uint64_t fail_value=0) -> uint64_t GetValueAsUnsigned(SBValue self, SBError error) -> uint64_t GetValueAsUnsigned(SBValue self, uint64_t fail_value=0) -> uint64_t GetValueAsUnsigned(SBValue self) -> uint64_t

### value A read/write property that gets/sets value from a string. Get Method: GetValue(self) - GetValue(SBValue self) -> str const * Set Method: SetValueFromCString(self, *args) - SetValueFromCString(SBValue self, str const * value_str) -> bool SetValueFromCString(SBValue self, str const * value_str, SBError error) -> bool

### value_type A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eValueType") that represents the type of this value (local, argument, global, register, etc.). Get Method: GetValueType(self) - GetValueType(SBValue self) -> lldb::ValueType