Give the clang functions names. This is only for logging.

llvm-svn: 206836
This commit is contained in:
Jim Ingham 2014-04-22 01:42:22 +00:00
parent fd95f8961e
commit 23ef27cd46
9 changed files with 34 additions and 19 deletions

View File

@ -88,7 +88,8 @@ public:
ClangFunction (ExecutionContextScope &exe_scope,
Function &function_ptr,
ClangASTContext *ast_context,
const ValueList &arg_value_list);
const ValueList &arg_value_list,
const char *name);
//------------------------------------------------------------------
/// Constructor
@ -114,7 +115,8 @@ public:
ClangFunction (ExecutionContextScope &exe_scope,
const ClangASTType &return_type,
const Address& function_address,
const ValueList &arg_value_list);
const ValueList &arg_value_list,
const char *name);
//------------------------------------------------------------------
/// Destructor
@ -412,6 +414,7 @@ private:
std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function.
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
lldb::ModuleWP m_jit_module_wp;
std::string m_name; ///< The name of this clang function - for debugging purposes.
Function *m_function_ptr; ///< The function we're going to call. May be NULL if we don't have debug info for the function.
Address m_function_addr; ///< If we don't have the FunctionSP, we at least need the address & return type.

View File

@ -54,11 +54,13 @@ ClangFunction::ClangFunction
ExecutionContextScope &exe_scope,
const ClangASTType &return_type,
const Address& functionAddress,
const ValueList &arg_value_list
const ValueList &arg_value_list,
const char *name
) :
m_parser(),
m_execution_unit_sp(),
m_jit_module_wp(),
m_name (name ? name : "<unknown>"),
m_function_ptr (NULL),
m_function_addr (functionAddress),
m_function_return_type(return_type),
@ -79,8 +81,10 @@ ClangFunction::ClangFunction
ExecutionContextScope &exe_scope,
Function &function,
ClangASTContext *ast_context,
const ValueList &arg_value_list
const ValueList &arg_value_list,
const char *name
) :
m_name (name ? name : "<unknown>"),
m_function_ptr (&function),
m_function_addr (),
m_function_return_type (),
@ -427,7 +431,7 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx,
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
if (log)
log->Printf("-- [ClangFunction::GetThreadPlanToCallFunction] Creating thread plan to call function --");
log->Printf("-- [ClangFunction::GetThreadPlanToCallFunction] Creating thread plan to call function \"%s\" --", m_name.c_str());
// FIXME: Use the errors Stream for better error reporting.
Thread *thread = exe_ctx.GetThreadPtr();
@ -464,7 +468,7 @@ ClangFunction::FetchFunctionResults (ExecutionContext &exe_ctx, lldb::addr_t arg
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
if (log)
log->Printf("-- [ClangFunction::FetchFunctionResults] Fetching function results --");
log->Printf("-- [ClangFunction::FetchFunctionResults] Fetching function results for \"%s\"--", m_name.c_str());
Process *process = exe_ctx.GetProcessPtr();
@ -535,7 +539,7 @@ ClangFunction::ExecuteFunction(
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
if (log)
log->Printf("== [ClangFunction::ExecuteFunction] Executing function ==");
log->Printf("== [ClangFunction::ExecuteFunction] Executing function \"%s\" ==", m_name.c_str());
lldb::ThreadPlanSP call_plan_sp (GetThreadPlanToCallFunction (exe_ctx,
args_addr,
@ -558,11 +562,11 @@ ClangFunction::ExecuteFunction(
{
if (return_value != eExecutionCompleted)
{
log->Printf("== [ClangFunction::ExecuteFunction] Execution completed abnormally ==");
log->Printf("== [ClangFunction::ExecuteFunction] Execution of \"%s\" completed abnormally ==", m_name.c_str());
}
else
{
log->Printf("== [ClangFunction::ExecuteFunction] Execution completed normally ==");
log->Printf("== [ClangFunction::ExecuteFunction] Execution of \"%s\" completed normally ==", m_name.c_str());
}
}

View File

@ -129,7 +129,8 @@ AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, ExecutionCon
ClangFunction func (*exe_ctx.GetBestExecutionContextScope(),
return_clang_type,
*function_address,
arg_value_list);
arg_value_list,
"objc-object-description");
StreamString error_stream;

View File

@ -1773,7 +1773,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table
m_get_class_info_function.reset(new ClangFunction (*m_process,
clang_uint32_t_type,
function_address,
arguments));
arguments,
"objc-v2-isa-to-descriptor"));
if (m_get_class_info_function.get() == NULL)
return false;
@ -2022,7 +2023,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache()
m_get_shared_cache_class_info_function.reset(new ClangFunction (*m_process,
clang_uint32_t_type,
function_address,
arguments));
arguments,
"objc-isa-to-descriptor-shared-cache"));
if (m_get_shared_cache_class_info_function.get() == NULL)
return false;

View File

@ -790,7 +790,8 @@ AppleObjCTrampolineHandler::SetupDispatchFunction (Thread &thread, ValueList &di
m_impl_function.reset(new ClangFunction (thread,
clang_void_ptr_type,
impl_code_address,
dispatch_values));
dispatch_values,
"objc-dispatch-lookup"));
errors.Clear();
unsigned num_errors = m_impl_function->CompileFunction(errors);

View File

@ -216,7 +216,8 @@ AppleGetItemInfoHandler::SetupGetItemInfoFunction (Thread &thread, ValueList &ge
m_get_item_info_function.reset(new ClangFunction (thread,
get_item_info_return_type,
impl_code_address,
get_item_info_arglist));
get_item_info_arglist,
"queue-bt-item-info"));
errors.Clear();
unsigned num_errors = m_get_item_info_function->CompileFunction(errors);

View File

@ -220,7 +220,8 @@ AppleGetPendingItemsHandler::SetupGetPendingItemsFunction (Thread &thread, Value
m_get_pending_items_function.reset(new ClangFunction (thread,
get_pending_items_return_type,
impl_code_address,
get_pending_items_arglist));
get_pending_items_arglist,
"queue-pending-items"));
errors.Clear();
unsigned num_errors = m_get_pending_items_function->CompileFunction(errors);

View File

@ -228,7 +228,8 @@ AppleGetQueuesHandler::SetupGetQueuesFunction (Thread &thread, ValueList &get_qu
m_get_queues_function.reset(new ClangFunction (thread,
get_queues_return_type,
impl_code_address,
get_queues_arglist));
get_queues_arglist,
"queue-fetch-queues"));
errors.Clear();
unsigned num_errors = m_get_queues_function->CompileFunction(errors);

View File

@ -218,9 +218,10 @@ AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction (Thread &thread, V
ClangASTContext *clang_ast_context = thread.GetProcess()->GetTarget().GetScratchClangASTContext();
ClangASTType get_thread_item_info_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
m_get_thread_item_info_function.reset(new ClangFunction (thread,
get_thread_item_info_return_type,
impl_code_address,
get_thread_item_info_arglist));
get_thread_item_info_return_type,
impl_code_address,
get_thread_item_info_arglist,
"queue-thread-item-info"));
errors.Clear();
unsigned num_errors = m_get_thread_item_info_function->CompileFunction(errors);