if (log)
log->Printf("[ExpandIndexedExpression] name to deref: %s",
ptr_deref_buffer.c_str());
- const char *first_unparsed;
ValueObject::GetValueForExpressionPathOptions options;
ValueObject::ExpressionPathEndResultType final_value_type;
ValueObject::ExpressionPathScanEndReason reason_to_stop;
(deref_pointer ? ValueObject::eExpressionPathAftermathDereference
: ValueObject::eExpressionPathAftermathNothing);
ValueObjectSP item = valobj->GetValueForExpressionPath(
- ptr_deref_buffer.c_str(), &first_unparsed, &reason_to_stop,
- &final_value_type, options, &what_next);
+ ptr_deref_buffer.c_str(), &reason_to_stop, &final_value_type, options,
+ &what_next);
if (!item) {
if (log)
- log->Printf("[ExpandIndexedExpression] ERROR: unparsed portion = %s, why "
- "stopping = %d,"
+ log->Printf("[ExpandIndexedExpression] ERROR: why stopping = %d,"
" final_value_type %d",
- first_unparsed, reason_to_stop, final_value_type);
+ reason_to_stop, final_value_type);
} else {
if (log)
- log->Printf("[ExpandIndexedExpression] ALL RIGHT: unparsed portion = %s, "
- "why stopping = %d,"
- " final_value_type %d",
- first_unparsed, reason_to_stop, final_value_type);
+ log->Printf("[ExpandIndexedExpression] ALL RIGHT: why stopping = %d, "
+ "final_value_type %d",
+ reason_to_stop, final_value_type);
}
return item;
}
int64_t index_lower = -1;
int64_t index_higher = -1;
bool is_array_range = false;
- const char *first_unparsed;
bool was_plain_var = false;
bool was_var_format = false;
bool was_var_indexed = false;
log->Printf("[Debugger::FormatPrompt] symbol to expand: %s",
expr_path.c_str());
- target = valobj
- ->GetValueForExpressionPath(expr_path.c_str(), &first_unparsed,
- &reason_to_stop, &final_value_type,
- options, &what_next)
- .get();
+ target =
+ valobj
+ ->GetValueForExpressionPath(expr_path.c_str(), &reason_to_stop,
+ &final_value_type, options, &what_next)
+ .get();
if (!target) {
if (log)
- log->Printf("[Debugger::FormatPrompt] ERROR: unparsed portion = %s, "
- "why stopping = %d,"
- " final_value_type %d",
- first_unparsed, reason_to_stop, final_value_type);
+ log->Printf("[Debugger::FormatPrompt] ERROR: expr = %s, "
+ "why stopping = %d, final_value_type %d",
+ expr_path.c_str(), reason_to_stop, final_value_type);
return false;
} else {
if (log)
- log->Printf("[Debugger::FormatPrompt] ALL RIGHT: unparsed portion = "
- "%s, why stopping = %d,"
- " final_value_type %d",
- first_unparsed, reason_to_stop, final_value_type);
+ log->Printf("[Debugger::FormatPrompt] ALL RIGHT: expr = %s, "
+ "why stopping = %d, final_value_type %d",
+ expr_path.c_str(), reason_to_stop, final_value_type);
target = target
->GetQualifiedRepresentationIfAvailable(
target->GetDynamicValueType(), true)
// We haven't made a synthetic array member for expression yet, so
// lets make one and cache it for any future reference.
synthetic_child_sp = GetValueForExpressionPath(
- expression, NULL, NULL, NULL,
+ expression, nullptr, nullptr,
GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
None));
}
ValueObjectSP ValueObject::GetValueForExpressionPath(
- const char *expression, const char **first_unparsed,
- ExpressionPathScanEndReason *reason_to_stop,
+ const char *expression, ExpressionPathScanEndReason *reason_to_stop,
ExpressionPathEndResultType *final_value_type,
const GetValueForExpressionPathOptions &options,
ExpressionPathAftermath *final_task_on_target) {
- const char *dummy_first_unparsed;
ExpressionPathScanEndReason dummy_reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnknown;
ExpressionPathEndResultType dummy_final_value_type =
ValueObject::eExpressionPathAftermathNothing;
ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
- expression, first_unparsed ? first_unparsed : &dummy_first_unparsed,
- reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
+ expression, reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
final_value_type ? final_value_type : &dummy_final_value_type, options,
final_task_on_target ? final_task_on_target
: &dummy_final_task_on_target);
}
ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
- const char *expression_cstr, const char **first_unparsed,
- ExpressionPathScanEndReason *reason_to_stop,
+ const char *expression_cstr, ExpressionPathScanEndReason *reason_to_stop,
ExpressionPathEndResultType *final_result,
const GetValueForExpressionPathOptions &options,
ExpressionPathAftermath *what_next) {
if (!root.get())
return ValueObjectSP();
- *first_unparsed = expression_cstr;
-
while (true) {
- const char *expression_cstr =
- *first_unparsed; // hide the top level expression_cstr
-
CompilerType root_compiler_type = root->GetCompilerType();
CompilerType pointee_compiler_type;
Flags pointee_compiler_type_info;
// non-pointer and I
// must catch the error
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonArrowInsteadOfDot;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
// when this is forbidden
root_compiler_type_info.Test(eTypeIsPointer) &&
options.m_no_fragile_ivar) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonFragileIVarNotAllowed;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
return ValueObjectSP();
}
if (expression_cstr[1] != '>') {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
// and I must catch the
// error
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonDotInsteadOfArrow;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
if (child_valobj_sp.get()) // we know we are done, so just return
{
- *first_unparsed = "";
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonEndOfString;
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
// so we hit the "else" branch, and return an error
if (child_valobj_sp.get()) // if it worked, just return
{
- *first_unparsed = "";
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonEndOfString;
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
return child_valobj_sp;
} else {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
if (child_valobj_sp.get()) // store the new root and move on
{
root = child_valobj_sp;
- *first_unparsed = next_separator;
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
continue;
} else {
if (child_valobj_sp.get()) // if it worked, move on
{
root = child_valobj_sp;
- *first_unparsed = next_separator;
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
continue;
} else {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
None) // ...only chance left is synthetic
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
// check that we can
// expand bitfields
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonRangeOperatorNotAllowed;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
']') // if this is an unbounded range it only works for arrays
{
if (!root_compiler_type_info.Test(eTypeIsArray)) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
} else // even if something follows, we cannot expand unbounded ranges,
// just let the caller do it
{
- *first_unparsed = expression_cstr + 2;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
*final_result =
const char *close_bracket_position = ::strchr(expression_cstr + 1, ']');
if (!close_bracket_position) // if there is no ], this is a syntax error
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
if (end != close_bracket_position) // if something weird is in
// our way return an error
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
root->GetSyntheticValue()->GetChildAtIndex(index, true);
if (child_valobj_sp) {
root = child_valobj_sp;
- *first_unparsed = end + 1; // skip ]
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
continue;
} else {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
Error error;
root = root->Dereference(error);
if (error.Fail() || !root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
} else
root = root->GetSyntheticArrayMember(index, true);
if (!root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
return ValueObjectSP();
} else {
- *first_unparsed = end + 1; // skip ]
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
continue;
}
} else if (root_compiler_type_info.Test(eTypeIsScalar)) {
root = root->GetSyntheticBitFieldChild(index, index, true);
if (!root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
} else // we do not know how to expand members of bitfields, so we
// just return and let the caller do any further processing
{
- *first_unparsed = end + 1; // skip ]
*reason_to_stop = ValueObject::
eExpressionPathScanEndReasonBitfieldRangeOperatorMet;
*final_result = ValueObject::eExpressionPathEndResultTypeBitfield;
} else if (root_compiler_type_info.Test(eTypeIsVector)) {
root = root->GetChildAtIndex(index, true);
if (!root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
return ValueObjectSP();
} else {
- *first_unparsed = end + 1; // skip ]
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
continue;
}
if (root->HasSyntheticValue())
root = root->GetSyntheticValue();
else if (!root->IsSynthetic()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
// to go
if (!root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
}
root = root->GetChildAtIndex(index, true);
if (!root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
return ValueObjectSP();
} else {
- *first_unparsed = end + 1; // skip ]
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
continue;
}
} else {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
if (end != separator_position) // if something weird is in our
// way return an error
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
if (end != close_bracket_position) // if something weird is in
// our way return an error
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
root =
root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
if (!root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonNoSuchChild;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
return ValueObjectSP();
} else {
- *first_unparsed = end + 1; // skip ]
*reason_to_stop = ValueObject::
eExpressionPathScanEndReasonBitfieldRangeOperatorMet;
*final_result = ValueObject::eExpressionPathEndResultTypeBitfield;
Error error;
root = root->Dereference(error);
if (error.Fail() || !root.get()) {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
continue;
}
} else {
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
*final_result = ValueObject::eExpressionPathEndResultTypeBoundedRange;
}
default: // some non-separator is in the way
{
- *first_unparsed = expression_cstr;
*reason_to_stop =
ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;