[Lldb-commits] [lldb] r113396 - in /lldb/trunk/source/Expression: ClangFunction.cpp IRDynamicChecks.cpp IRForTarget.cpp

Sean Callanan scallanan at apple.com
Wed Sep 8 13:04:08 PDT 2010


Author: spyffe
Date: Wed Sep  8 15:04:08 2010
New Revision: 113396

URL: http://llvm.org/viewvc/llvm-project?rev=113396&view=rev
Log:
Fixed an expression parser bug that prevented
certain functions from being resolved correctly.

Some functions (particularly varargs functions)
are BitCast before being called, and the problem
was that a CallInst where getCalledValue()
returned a BitCast ConstantExpr was not being
relocated at all.

This problem should now be resolved for the case
of BitCast.

Modified:
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/IRDynamicChecks.cpp
    lldb/trunk/source/Expression/IRForTarget.cpp

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=113396&r1=113395&r2=113396&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Wed Sep  8 15:04:08 2010
@@ -460,8 +460,14 @@
     if (call_plan_sp == NULL)
         return eExecutionSetupError;
     
+//#define SINGLE_STEP_EXPRESSIONS
+    
+#ifdef SINGLE_STEP_EXPRESSIONS
+    return eExecutionInterrupted;
+#else
     call_plan_sp->SetPrivate(true);
     exe_ctx.thread->QueueThreadPlan(call_plan_sp, true);
+#endif
     
     // We need to call the function synchronously, so spin waiting for it to return.
     // If we get interrupted while executing, we're going to lose our context, and

Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=113396&r1=113395&r2=113396&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original)
+++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Wed Sep  8 15:04:08 2010
@@ -343,6 +343,18 @@
     if (!vpc.Instrument())
         return false;
     
+    if (log)
+    {
+        std::string s;
+        raw_string_ostream oss(s);
+        
+        M.print(oss, NULL);
+        
+        oss.flush();
+        
+        log->Printf("Module after dynamic checks: \n%s", s.c_str());
+    }
+    
     return true;    
 }
 

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=113396&r1=113395&r2=113396&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Wed Sep  8 15:04:08 2010
@@ -579,7 +579,23 @@
     Function *fun = C->getCalledFunction();
     
     if (fun == NULL)
-        return true;
+    {
+        Value *val = C->getCalledValue();
+        
+        ConstantExpr *const_expr = dyn_cast<ConstantExpr>(val);
+        
+        if (const_expr && const_expr->getOpcode() == Instruction::BitCast)
+        {
+            fun = dyn_cast<Function>(const_expr->getOperand(0));
+            
+            if (!fun)
+                return true;
+        }
+        else
+        {
+            return true;
+        }
+    }
     
     clang::NamedDecl *fun_decl = DeclForGlobalValue(M, fun);
     uint64_t fun_addr;





More information about the lldb-commits mailing list