================ @@ -151,10 +151,23 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command, result.SetStatus(eReturnStatusSuccessFinishResult); }; - // First, try `expr` as the name of a frame variable. - if (frame) { - auto valobj_sp = frame->FindVariable(ConstString(expr)); - if (valobj_sp && valobj_sp->GetError().Success()) { + // First, try `expr` as a _limited_ frame variable expression path: only the + // dot operator (`.`) is permitted for this case. + // + // This is limited to support only unambiguous expression paths. Of note, + // expression paths are not attempted if the expression contain either the + // arrow operator (`->`) or the subscript operator (`[]`). This is because + // both operators can be overloaded in C++, and could result in ambiguity in + // how the expression is handled. Additionally, `*` and `&` are not supported. + bool try_variable_path = expr.find_first_of("*&->[]") == StringRef::npos; ---------------- Michael137 wrote:
Nit: ```suggestion const bool try_variable_path = expr.find_first_of("*&->[]") == StringRef::npos; ``` https://github.com/llvm/llvm-project/pull/117452 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits