-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid expression evaluation in libStdC++ std::vector<bool> synthetic children provider #108414
Changes from 5 commits
6e84ab9
b23f3ea
b8ec0fb
1a350e4
d56c9b3
37a5ffa
257cd0d
713242a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -645,6 +645,33 @@ lldb::SBValue SBValue::CreateValueFromData(const char *name, SBData data, | |
return sb_value; | ||
} | ||
|
||
lldb::SBValue SBValue::CreateBoolValue(const char *name, bool value) { | ||
LLDB_INSTRUMENT_VA(this, name); | ||
|
||
lldb::SBValue sb_value; | ||
lldb::ValueObjectSP new_value_sp; | ||
ValueLocker locker; | ||
lldb::ValueObjectSP value_sp(GetSP(locker)); | ||
ProcessSP process_sp = m_opaque_sp->GetProcessSP(); | ||
lldb::SBTarget target = GetTarget(); | ||
if (!target.IsValid()) | ||
return sb_value; | ||
lldb::SBType boolean_type = target.GetBasicType(lldb::eBasicTypeBool); | ||
lldb::TypeImplSP type_impl_sp(boolean_type.GetSP()); | ||
if (value_sp && process_sp && type_impl_sp) { | ||
int data_buf[1] = {value ? 1 : 0}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is a data buffer the only option here because of the bitwise logic? I ask because we could just have the address point to a singular byte instead right? |
||
lldb::SBData data = lldb::SBData::CreateDataFromSInt32Array( | ||
process_sp->GetByteOrder(), sizeof(data_buf[0]), data_buf, | ||
sizeof(data_buf) / sizeof(data_buf[0])); | ||
ExecutionContext exe_ctx(value_sp->GetExecutionContextRef()); | ||
new_value_sp = ValueObject::CreateValueObjectFromData( | ||
name, **data, exe_ctx, type_impl_sp->GetCompilerType(true)); | ||
new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did the lack of this line cause problems? bool values can't have children, so it's a bit surprising you had to specify this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied it from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem comes with ValueObjects that live in lldb host memory for instance ValueObjectConstResult "history" entities or ValueObject made from DataExtractors. If you have such a result value that includes pointers that you copied up from the target memory, even though the ValueObject itself lives in lldb host memory, the pointer children still point into the target (are load addresses). This API states that that is true for this ValueObject. It's not relevant for ValueObjects that can't have pointer children. |
||
} | ||
sb_value.SetSP(new_value_sp); | ||
return sb_value; | ||
} | ||
|
||
SBValue SBValue::GetChildAtIndex(uint32_t idx) { | ||
LLDB_INSTRUMENT_VA(this, idx); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a blurb this is created from data not address