[Lldb-commits] [lldb] r206836 - Give the clang functions names. This is only for logging.

Jim Ingham jingham at apple.com
Mon Apr 21 18:42:22 PDT 2014


Author: jingham
Date: Mon Apr 21 20:42:22 2014
New Revision: 206836

URL: http://llvm.org/viewvc/llvm-project?rev=206836&view=rev
Log:
Give the clang functions names.  This is only for logging.

Modified:
    lldb/trunk/include/lldb/Expression/ClangFunction.h
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Mon Apr 21 20:42:22 2014
@@ -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.

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Mon Apr 21 20:42:22 2014
@@ -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::GetThreadPlanToCallFuncti
     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 (Exe
     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());
         }
     }
     

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Mon Apr 21 20:42:22 2014
@@ -129,7 +129,8 @@ AppleObjCRuntime::GetObjectDescription (
     ClangFunction func (*exe_ctx.GetBestExecutionContextScope(),
                         return_clang_type, 
                         *function_address, 
-                        arg_value_list);
+                        arg_value_list,
+                        "objc-object-description");
 
     StreamString error_stream;
     

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Apr 21 20:42:22 2014
@@ -1773,7 +1773,8 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
         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::UpdateISAToDescripto
         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;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Mon Apr 21 20:42:22 2014
@@ -790,7 +790,8 @@ AppleObjCTrampolineHandler::SetupDispatc
             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);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp Mon Apr 21 20:42:22 2014
@@ -216,7 +216,8 @@ AppleGetItemInfoHandler::SetupGetItemInf
             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);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp Mon Apr 21 20:42:22 2014
@@ -220,7 +220,8 @@ AppleGetPendingItemsHandler::SetupGetPen
             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);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp Mon Apr 21 20:42:22 2014
@@ -228,7 +228,8 @@ AppleGetQueuesHandler::SetupGetQueuesFun
             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);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp?rev=206836&r1=206835&r2=206836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp Mon Apr 21 20:42:22 2014
@@ -218,9 +218,10 @@ AppleGetThreadItemInfoHandler::SetupGetT
             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);





More information about the lldb-commits mailing list