mirror of
https://github.com/intel/llvm.git
synced 2026-01-30 22:53:05 +08:00
Fix error handling after [<index>] in 'frame variable'
Summary:
This fixes a bug where
frame var a[0]+5
returns the value a[0] without any warning because the current logic simply ignores everything after ']' as long as there is no '.', '-' or '[' in the rest of the string.
The fix simplifies the termination condition of the expression path parsing loop to check if have a non-empty remaining string to parse. Previously, the condition checked if a separator was found. That condition coincided with the remaining string-to-parse condition except for the buggy indexed case where non-empty string was left ("+5" in the example above), but the separator index was 'npos'.
Reviewed By: teemperor, labath
Differential Revision: https://reviews.llvm.org/D79404
This commit is contained in:
committed by
Pavel Labath
parent
0054c46095
commit
cf5ed6dc59
@@ -606,7 +606,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
|
||||
}
|
||||
|
||||
// We are dumping at least one child
|
||||
while (separator_idx != std::string::npos) {
|
||||
while (!var_expr.empty()) {
|
||||
// Calculate the next separator index ahead of time
|
||||
ValueObjectSP child_valobj_sp;
|
||||
const char separator_type = var_expr[0];
|
||||
@@ -940,7 +940,6 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
|
||||
return ValueObjectSP();
|
||||
}
|
||||
|
||||
separator_idx = var_expr.find_first_of(".-[");
|
||||
if (use_dynamic != eNoDynamicValues) {
|
||||
ValueObjectSP dynamic_value_sp(
|
||||
child_valobj_sp->GetDynamicValue(use_dynamic));
|
||||
@@ -1025,7 +1024,6 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
|
||||
return ValueObjectSP();
|
||||
}
|
||||
|
||||
separator_idx = var_expr.find_first_of(".-[");
|
||||
if (use_dynamic != eNoDynamicValues) {
|
||||
ValueObjectSP dynamic_value_sp(
|
||||
child_valobj_sp->GetDynamicValue(use_dynamic));
|
||||
@@ -1051,9 +1049,6 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
|
||||
|
||||
if (child_valobj_sp)
|
||||
valobj_sp = child_valobj_sp;
|
||||
|
||||
if (var_expr.empty())
|
||||
break;
|
||||
}
|
||||
if (valobj_sp) {
|
||||
if (deref) {
|
||||
|
||||
Reference in New Issue
Block a user