Hi,

I have attached a patch for a bug in
Variable::GetValuesForVariableExpressionPath().
There is also a small patch for a typo.

Can you please review them?

Thanks,
Yacine

From: Yacine Belkadi <[email protected]>
Date: Sat, 18 May 2013 10:43:19 +0200
Subject: [PATCH] Symbol/Variable: fix case where multiple matching variables
 are found

In GetValuesForVariableExpressionPath(), if there were multiple matching
variables in variable_list, then after processing the first one,
variable_expr_path was pointing past the end of the original variable_expr_path
string.
---
 source/Symbol/Variable.cpp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index 9b7f4c5..8b827db 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -416,8 +416,8 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path,
                                     ValueObjectSP variable_valobj_sp(ValueObjectVariable::Create (scope, var_sp));
                                     if (variable_valobj_sp)
                                     {
-                                        variable_expr_path += variable_name.size();
-                                        if (*variable_expr_path)
+                                        const char *variable_sub_expr_path = variable_expr_path + variable_name.size();
+                                        if (*variable_sub_expr_path)
                                         {
                                             const char* first_unparsed = NULL;
                                             ValueObject::ExpressionPathScanEndReason reason_to_stop;
@@ -425,7 +425,7 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path,
                                             ValueObject::GetValueForExpressionPathOptions options;
                                             ValueObject::ExpressionPathAftermath final_task_on_target;
 
-                                            valobj_sp = variable_valobj_sp->GetValueForExpressionPath (variable_expr_path,
+                                            valobj_sp = variable_valobj_sp->GetValueForExpressionPath (variable_sub_expr_path,
                                                                                                        &first_unparsed,
                                                                                                        &reason_to_stop,
                                                                                                        &final_value_type,
@@ -434,7 +434,7 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path,
                                             if (!valobj_sp)
                                             {
                                                 error.SetErrorStringWithFormat ("invalid expression path '%s' for variable '%s'",
-                                                                                variable_expr_path,
+                                                                                variable_sub_expr_path,
                                                                                 var_sp->GetName().GetCString());
                                             }
                                         }
-- 
1.7.10.4


From: Yacine Belkadi <[email protected]>
Date: Sat, 18 May 2013 10:43:45 +0200
Subject: [PATCH] Symbol/Variable: fix typo

---
 source/Symbol/Variable.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index 8b827db..bcbea2f 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -465,7 +465,7 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path,
                         }
                     }
                 }
-                error.SetErrorStringWithFormat ("unable to extracta variable name from '%s'", variable_expr_path);
+                error.SetErrorStringWithFormat ("unable to extract a variable name from '%s'", variable_expr_path);
             }
             break;
         }
-- 
1.7.10.4


_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to