[Lldb-commits] [lldb] r201710 - Restore the ability of SBFrame::FindValue() to look for file global variables

Enrico Granata egranata at apple.com
Wed Feb 19 11:35:14 PST 2014


Author: enrico
Date: Wed Feb 19 13:35:13 2014
New Revision: 201710

URL: http://llvm.org/viewvc/llvm-project?rev=201710&view=rev
Log:
Restore the ability of SBFrame::FindValue() to look for file global variables
This should clean up the new test failures caused by r201614


Modified:
    lldb/trunk/include/lldb/Symbol/VariableList.h
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/Symbol/VariableList.cpp

Modified: lldb/trunk/include/lldb/Symbol/VariableList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/VariableList.h?rev=201710&r1=201709&r2=201710&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/VariableList.h (original)
+++ lldb/trunk/include/lldb/Symbol/VariableList.h Wed Feb 19 13:35:13 2014
@@ -55,7 +55,10 @@ public:
 
     uint32_t
     FindVariableIndex (const lldb::VariableSP &var_sp);
-
+    
+    size_t
+    AppendVariablesIfUnique(VariableList &var_list);
+    
     // Returns the actual number of unique variables that were added to the
     // list. "total_matches" will get updated with the actualy number of
     // matches that were found regardless of whether they were unique or not

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=201710&r1=201709&r2=201710&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Wed Feb 19 13:35:13 2014
@@ -845,6 +845,8 @@ SBFrame::FindValue (const char *name, Va
             frame = exe_ctx.GetFramePtr();
             if (frame)
             {
+                VariableList variable_list;
+                
                 switch (value_type)
                 {
                 case eValueTypeVariableGlobal:      // global variable
@@ -852,8 +854,7 @@ SBFrame::FindValue (const char *name, Va
                 case eValueTypeVariableArgument:    // function argument variables
                 case eValueTypeVariableLocal:       // function local variables
                     {
-                        VariableList variable_list;
-
+                        
                         SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
 
                         const bool can_create = true;
@@ -865,6 +866,13 @@ SBFrame::FindValue (const char *name, Va
                                                                    stop_if_block_is_inlined_function,
                                                                    &variable_list))
                         {
+                            if (value_type == eValueTypeVariableGlobal)
+                            {
+                                const bool get_file_globals = true;
+                                VariableList* frame_vars = frame->GetVariableList(get_file_globals);
+                                if (frame_vars)
+                                    frame_vars->AppendVariablesIfUnique(variable_list);
+                            }
                             ConstString const_name(name);
                             VariableSP variable_sp(variable_list.FindVariable(const_name,value_type));
                             if (variable_sp)

Modified: lldb/trunk/source/Symbol/VariableList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/VariableList.cpp?rev=201710&r1=201709&r2=201710&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/VariableList.cpp (original)
+++ lldb/trunk/source/Symbol/VariableList.cpp Wed Feb 19 13:35:13 2014
@@ -132,6 +132,16 @@ VariableList::FindVariable (const ConstS
 }
 
 size_t
+VariableList::AppendVariablesIfUnique(VariableList &var_list)
+{
+    const size_t initial_size = var_list.GetSize();
+    iterator pos, end = m_variables.end();
+    for (pos = m_variables.begin(); pos != end; ++pos)
+        var_list.AddVariableIfUnique(*pos);
+    return var_list.GetSize() - initial_size;
+}
+
+size_t
 VariableList::AppendVariablesIfUnique (const RegularExpression& regex, VariableList &var_list, size_t& total_matches)
 {
     const size_t initial_size = var_list.GetSize();





More information about the lldb-commits mailing list