Fixed a problem where expressions would attempt to
allocate memory in a process that did not support
expression execution.  Also improved detection of
whether or not a process can execute expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140202 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionParser.cpp b/source/Expression/ClangExpressionParser.cpp
index 921dc00..3549196 100644
--- a/source/Expression/ClangExpressionParser.cpp
+++ b/source/Expression/ClangExpressionParser.cpp
@@ -496,8 +496,32 @@
             return err;
         }
         
-        if (m_expr.NeedsValidation() && exe_ctx.process && exe_ctx.process->GetDynamicCheckers())
+        if (execution_policy != eExecutionPolicyNever &&
+            m_expr.NeedsValidation() && 
+            exe_ctx.process)
         {
+            if (!exe_ctx.process->GetDynamicCheckers())
+            {                
+                DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions();
+                
+                StreamString install_errors;
+                
+                if (!dynamic_checkers->Install(install_errors, exe_ctx))
+                {
+                    if (install_errors.GetString().empty())
+                        err.SetErrorString ("couldn't install checkers, unknown error");
+                    else
+                        err.SetErrorString (install_errors.GetString().c_str());
+                    
+                    return err;
+                }
+                
+                exe_ctx.process->SetDynamicCheckers(dynamic_checkers);
+                
+                if (log)
+                    log->Printf("== [ClangUserExpression::Evaluate] Finished installing dynamic checkers ==");
+            }
+            
             IRDynamicChecks ir_dynamic_checks(*exe_ctx.process->GetDynamicCheckers(), function_name.c_str());
         
             if (!ir_dynamic_checks.runOnModule(*module))