[Lldb-commits] [lldb] r179539 - Audited the existing Materializer code to ensure

Malea, Daniel daniel.malea at intel.com
Tue Apr 16 11:46:18 PDT 2013


This change seems to have blown up the testing time on mac os x from ~2min
to >20min (timeout)

Before the change: 
http://lab.llvm.org:8011/builders/lldb-x86_64-darwin11/builds/1831

First build with this change:
http://lab.llvm.org:8011/builders/lldb-x86_64-darwin11/builds/1832


Could it be responsible for or related to the hangs we're seeing
across-the-board?



Cheers,
Dan

On 2013-04-15 1:12 PM, "Sean Callanan" <scallanan at apple.com> wrote:

>Author: spyffe
>Date: Mon Apr 15 12:12:47 2013
>New Revision: 179539
>
>URL: http://llvm.org/viewvc/llvm-project?rev=179539&view=rev
>Log:
>Audited the existing Materializer code to ensure
>that it works in the absence of a process.  Codepaths
>in the Materializer now use the best execution context
>scope available to them.
>
>Modified:
>    lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
>    lldb/trunk/include/lldb/Expression/IRMemoryMap.h
>    lldb/trunk/source/Expression/ClangExpressionParser.cpp
>    lldb/trunk/source/Expression/IRExecutionUnit.cpp
>    lldb/trunk/source/Expression/IRMemoryMap.cpp
>    lldb/trunk/source/Expression/Materializer.cpp
>
>Modified: lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
>URL: 
>http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRE
>xecutionUnit.h?rev=179539&r1=179538&r2=179539&view=diff
>==========================================================================
>====
>--- lldb/trunk/include/lldb/Expression/IRExecutionUnit.h (original)
>+++ lldb/trunk/include/lldb/Expression/IRExecutionUnit.h Mon Apr 15
>12:12:47 2013
>@@ -66,7 +66,7 @@ public:
>     //------------------------------------------------------------------
>     IRExecutionUnit (std::auto_ptr<llvm::Module> &module_ap,
>                      ConstString &name,
>-                     lldb::ProcessSP process_sp,
>+                     const lldb::TargetSP &target_sp,
>                      std::vector<std::string> &cpu_features);
>     
>     //------------------------------------------------------------------
>
>Modified: lldb/trunk/include/lldb/Expression/IRMemoryMap.h
>URL: 
>http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRM
>emoryMap.h?rev=179539&r1=179538&r2=179539&view=diff
>==========================================================================
>====
>--- lldb/trunk/include/lldb/Expression/IRMemoryMap.h (original)
>+++ lldb/trunk/include/lldb/Expression/IRMemoryMap.h Mon Apr 15 12:12:47
>2013
>@@ -37,7 +37,6 @@ namespace lldb_private
> class IRMemoryMap
> {
> public:
>-    IRMemoryMap (lldb::ProcessSP process_sp);
>     IRMemoryMap (lldb::TargetSP target_sp);
>     ~IRMemoryMap ();
>     
>@@ -64,9 +63,12 @@ public:
>     lldb::ByteOrder GetByteOrder();
>     uint32_t GetAddressByteSize();
>     
>+    // This function can return NULL.
>     ExecutionContextScope *GetBestExecutionContextScope();
> 
> protected:
>+    // This function should only be used if you know you are using the
>JIT.
>+    // Any other cases should use GetBestExecutionContextScope().
>     lldb::ProcessWP GetProcessWP ()
>     {
>         return m_process_wp;
>
>Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
>URL: 
>http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpr
>essionParser.cpp?rev=179539&r1=179538&r2=179539&view=diff
>==========================================================================
>====
>--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
>+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Mon Apr 15
>12:12:47 2013
>@@ -503,7 +503,7 @@ ClangExpressionParser::PrepareForExecuti
>     
>     m_execution_unit.reset(new IRExecutionUnit(module_ap, // handed off
>here
>                                                function_name,
>-                                               exe_ctx.GetProcessSP(),
>+                                               exe_ctx.GetTargetSP(),
>                  
>m_compiler->getTargetOpts().Features));
>         
>     ClangExpressionDeclMap *decl_map = m_expr.DeclMap(); // result can
>be NULL
>
>Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
>URL: 
>http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecuti
>onUnit.cpp?rev=179539&r1=179538&r2=179539&view=diff
>==========================================================================
>====
>--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
>+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Mon Apr 15 12:12:47
>2013
>@@ -27,9 +27,9 @@ using namespace lldb_private;
> 
> IRExecutionUnit::IRExecutionUnit (std::auto_ptr<llvm::Module> &module_ap,
>                                   ConstString &name,
>-                                  lldb::ProcessSP process_sp,
>+                                  const lldb::TargetSP &target_sp,
>                                   std::vector<std::string>
>&cpu_features) :
>-    IRMemoryMap(process_sp),
>+    IRMemoryMap(target_sp),
>     m_module_ap(module_ap),
>     m_module(m_module_ap.get()),
>     m_cpu_features(cpu_features),
>
>Modified: lldb/trunk/source/Expression/IRMemoryMap.cpp
>URL: 
>http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRMemoryM
>ap.cpp?rev=179539&r1=179538&r2=179539&view=diff
>==========================================================================
>====
>--- lldb/trunk/source/Expression/IRMemoryMap.cpp (original)
>+++ lldb/trunk/source/Expression/IRMemoryMap.cpp Mon Apr 15 12:12:47 2013
>@@ -18,16 +18,11 @@
> 
> using namespace lldb_private;
> 
>-IRMemoryMap::IRMemoryMap (lldb::ProcessSP process_sp) :
>-    m_process_wp(process_sp),
>-    m_target_wp(process_sp->GetTarget().shared_from_this())
>-{
>-}
>-
> IRMemoryMap::IRMemoryMap (lldb::TargetSP target_sp) :
>-    m_process_wp(),
>     m_target_wp(target_sp)
> {
>+    if (target_sp)
>+        m_process_wp = target_sp->GetProcessSP();
> }
> 
> IRMemoryMap::~IRMemoryMap ()
>
>Modified: lldb/trunk/source/Expression/Materializer.cpp
>URL: 
>http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materiali
>zer.cpp?rev=179539&r1=179538&r2=179539&view=diff
>==========================================================================
>====
>--- lldb/trunk/source/Expression/Materializer.cpp (original)
>+++ lldb/trunk/source/Expression/Materializer.cpp Mon Apr 15 12:12:47 2013
>@@ -340,7 +340,12 @@ public:
>                         m_variable_sp->GetName().AsCString());
>         }
>         
>-        lldb::ValueObjectSP valobj_sp =
>ValueObjectVariable::Create(frame_sp.get(), m_variable_sp);
>+        ExecutionContextScope *scope = frame_sp.get();
>+        
>+        if (!scope)
>+            scope = map.GetBestExecutionContextScope();
>+        
>+        lldb::ValueObjectSP valobj_sp =
>ValueObjectVariable::Create(scope, m_variable_sp);
>         
>         if (!valobj_sp)
>         {
>@@ -458,7 +463,12 @@ public:
>         
>         if (m_temporary_allocation != LLDB_INVALID_ADDRESS)
>         {
>-            lldb::ValueObjectSP valobj_sp =
>ValueObjectVariable::Create(frame_sp.get(), m_variable_sp);
>+            ExecutionContextScope *scope = frame_sp.get();
>+            
>+            if (!scope)
>+                scope = map.GetBestExecutionContextScope();
>+            
>+            lldb::ValueObjectSP valobj_sp =
>ValueObjectVariable::Create(scope, m_variable_sp);
>             
>             if (!valobj_sp)
>             {
>@@ -665,6 +675,17 @@ Materializer::Materializer () :
> Materializer::Dematerializer
> Materializer::Materialize (lldb::StackFrameSP &frame_sp,
>lldb::ClangExpressionVariableSP &result_sp, IRMemoryMap &map,
>lldb::addr_t process_address, Error &error)
> {
>+    ExecutionContextScope *exe_scope = frame_sp.get();
>+    
>+    if (!exe_scope)
>+        exe_scope = map.GetBestExecutionContextScope();
>+    
>+    if (!exe_scope)
>+    {
>+        error.SetErrorToGenericError();
>+        error.SetErrorString("Couldn't dematerialize: target doesn't
>exist");
>+    }
>+    
>     for (EntityUP &entity_up : m_entities)
>     {
>         entity_up->Materialize(frame_sp, map, process_address, error);
>@@ -683,10 +704,12 @@ Materializer::Dematerializer::Dematerial
> {
>     lldb::StackFrameSP frame_sp = m_frame_wp.lock();
>     
>-    if (!frame_sp)
>+    ExecutionContextScope *exe_scope =
>m_map.GetBestExecutionContextScope();
>+    
>+    if (!exe_scope)
>     {
>         error.SetErrorToGenericError();
>-        error.SetErrorString("Couldn't dematerialize: frame is gone");
>+        error.SetErrorString("Couldn't dematerialize: target is gone");
>     }
>     else
>     {
>
>
>_______________________________________________
>lldb-commits mailing list
>lldb-commits at cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list