2011-06-30 05:19:39 +08:00
|
|
|
"""
|
|
|
|
Fuzz tests an object after the default construction to make sure it does not crash lldb.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import lldb
|
|
|
|
|
|
|
|
def fuzz_obj(obj):
|
|
|
|
obj.GetError()
|
|
|
|
obj.GetName()
|
|
|
|
obj.GetTypeName()
|
|
|
|
obj.GetByteSize()
|
|
|
|
obj.IsInScope()
|
|
|
|
obj.GetFormat()
|
|
|
|
obj.SetFormat(lldb.eFormatBoolean)
|
|
|
|
obj.GetValue()
|
|
|
|
obj.GetValueType()
|
|
|
|
obj.GetValueDidChange()
|
|
|
|
obj.GetSummary()
|
|
|
|
obj.GetObjectDescription()
|
|
|
|
obj.GetLocation()
|
|
|
|
obj.SetValueFromCString("my_new_value")
|
|
|
|
obj.GetChildAtIndex(1)
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
obj.GetChildAtIndex(2, lldb.eNoDynamicValues, False)
|
2011-06-30 05:19:39 +08:00
|
|
|
obj.GetIndexOfChildWithName("my_first_child")
|
|
|
|
obj.GetChildMemberWithName("my_first_child")
|
|
|
|
obj.GetChildMemberWithName("my_first_child", lldb.eNoDynamicValues)
|
|
|
|
obj.GetNumChildren()
|
|
|
|
obj.GetOpaqueType()
|
|
|
|
obj.Dereference()
|
|
|
|
obj.TypeIsPointerType()
|
|
|
|
stream = lldb.SBStream()
|
|
|
|
obj.GetDescription(stream)
|
|
|
|
obj.GetExpressionPath(stream)
|
|
|
|
obj.GetExpressionPath(stream, True)
|
2011-10-14 08:42:25 +08:00
|
|
|
obj.Watch(True, True, False)
|
|
|
|
obj.WatchPointee(True, False, True)
|
2011-10-04 06:02:59 +08:00
|
|
|
for child_val in obj:
|
|
|
|
print child_val
|