[Lldb-commits] [lldb] r143371 - in /lldb/trunk: include/lldb/Expression/IRForTarget.h source/Expression/IRDynamicChecks.cpp source/Expression/IRForTarget.cpp
Sean Callanan
scallanan at apple.com
Mon Oct 31 15:11:40 PDT 2011
Author: spyffe
Date: Mon Oct 31 17:11:40 2011
New Revision: 143371
URL: http://llvm.org/viewvc/llvm-project?rev=143371&view=rev
Log:
The IRDynamicChecks subsystem was not properly
detecting Objective-C method calls because the
"lldb.call.realName" metadata was no longer
being correctly installed. I fixed this problem.
Modified:
lldb/trunk/include/lldb/Expression/IRForTarget.h
lldb/trunk/source/Expression/IRDynamicChecks.cpp
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=143371&r1=143370&r2=143371&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Mon Oct 31 17:11:40 2011
@@ -233,6 +233,11 @@
BuildFunctionPointer (llvm::Type *type,
uint64_t ptr);
+ void
+ RegisterFunctionMetadata (llvm::LLVMContext &context,
+ llvm::Value *function_ptr,
+ const char *name);
+
//------------------------------------------------------------------
/// The top-level pass implementation
///
Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=143371&r1=143370&r2=143371&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original)
+++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Mon Oct 31 17:11:40 2011
@@ -435,7 +435,7 @@
arg_array[0] = bit_cast;
arg_array[1] = selector;
- ArrayRef<llvm::Value*> args(arg_array, 1);
+ ArrayRef<llvm::Value*> args(arg_array, 2);
CallInst::Create(m_objc_object_check_func,
args,
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=143371&r1=143370&r2=143371&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Mon Oct 31 17:11:40 2011
@@ -291,6 +291,36 @@
return ConstantExpr::getIntToPtr(fun_addr_int, fun_ptr_ty);
}
+void
+IRForTarget::RegisterFunctionMetadata(LLVMContext &context,
+ llvm::Value *function_ptr,
+ const char *name)
+{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ for (Value::use_iterator i = function_ptr->use_begin(), e = function_ptr->use_end();
+ i != e;
+ ++i)
+ {
+ Value *user = *i;
+
+ if (Instruction *user_inst = dyn_cast<Instruction>(user))
+ {
+ Constant *name_array = ConstantArray::get(context, StringRef(name));
+
+ ArrayRef<Value *> md_values(name_array);
+
+ MDNode *metadata = MDNode::get(context, md_values);
+
+ user_inst->setMetadata("lldb.call.realName", metadata);
+ }
+ else
+ {
+ RegisterFunctionMetadata (context, user, name);
+ }
+ }
+}
+
bool
IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module,
llvm::Function &llvm_function)
@@ -326,6 +356,8 @@
Constant *value = BuildFunctionPointer(fun->getFunctionType(), addr);
+ RegisterFunctionMetadata (llvm_module.getContext(), fun, name.AsCString());
+
if (value_ptr)
*value_ptr = value;
More information about the lldb-commits
mailing list