[Lldb-commits] [PATCH] D40557: Variable: Fix usage of uninitialised value

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 28 07:14:48 PST 2017


labath created this revision.
Herald added a subscriber: mehdi_amini.

Variable::GetValuesForVariableExpressionPath was passing an
uninitialised value for the final_task_on_target argument. On my
compiler/optimization level combo, the final_task_on_target happened to
contain "dereference" in some circumstances, which produced hilarious
results. The same is true for other arguments to the
GetValueForExpressionPath call.

The correct behavior here seems to be to just omit the arguments
altogether and let the default behavior take place.


https://reviews.llvm.org/D40557

Files:
  source/Symbol/Variable.cpp


Index: source/Symbol/Variable.cpp
===================================================================
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -425,14 +425,8 @@
       llvm::StringRef variable_sub_expr_path =
           variable_expr_path.drop_front(variable_name.size());
       if (!variable_sub_expr_path.empty()) {
-        ValueObject::ExpressionPathScanEndReason reason_to_stop;
-        ValueObject::ExpressionPathEndResultType final_value_type;
-        ValueObject::GetValueForExpressionPathOptions options;
-        ValueObject::ExpressionPathAftermath final_task_on_target;
-
         valobj_sp = variable_valobj_sp->GetValueForExpressionPath(
-            variable_sub_expr_path, &reason_to_stop, &final_value_type, options,
-            &final_task_on_target);
+            variable_sub_expr_path);
         if (!valobj_sp) {
           error.SetErrorStringWithFormat(
               "invalid expression path '%s' for variable '%s'",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40557.124571.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171128/83d4c4ab/attachment.bin>


More information about the lldb-commits mailing list