Added a little bit of logging to ClangFunction to
authorSean Callanan <scallanan@apple.com>
Wed, 6 Mar 2013 19:57:25 +0000 (19:57 +0000)
committerSean Callanan <scallanan@apple.com>
Wed, 6 Mar 2013 19:57:25 +0000 (19:57 +0000)
make it more obvious what's going on.

llvm-svn: 176575

lldb/source/Expression/ClangFunction.cpp

index d749b14..794e035 100644 (file)
@@ -407,6 +407,11 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx,
                                             lldb::addr_t *this_arg,
                                             lldb::addr_t *cmd_arg)
 {
+    lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
+    
+    if (log)
+        log->Printf("-- [ClangFunction::GetThreadPlanToCallFunction] Creating thread plan to call function --");
+    
     // FIXME: Use the errors Stream for better error reporting.
     Thread *thread = exe_ctx.GetThreadPtr();
     if (thread == NULL)
@@ -439,6 +444,12 @@ ClangFunction::FetchFunctionResults (ExecutionContext &exe_ctx, lldb::addr_t arg
     // FIXME: How does clang tell us there's no return value?  We need to handle that case.
     // FIXME: Create our ThreadPlanCallFunction with the return ClangASTType, and then use GetReturnValueObject
     // to fetch the value.  That way we can fetch any values we need.
+    
+    lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
+    
+    if (log)
+        log->Printf("-- [ClangFunction::FetchFunctionResults] Fetching function results --");
+    
     Process *process = exe_ctx.GetProcessPtr();
     
     if (process == NULL)
@@ -516,7 +527,12 @@ ClangFunction::ExecuteFunction (
         Stream &errors,
         lldb::addr_t *this_arg)
 {
-    lldb::ThreadPlanSP call_plan_sp (ClangFunction::GetThreadPlanToCallFunction (exe_ctx, 
+    lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
+
+    if (log)
+        log->Printf("== [ClangFunction::ExecuteFunction] Executing function ==");
+    
+    lldb::ThreadPlanSP call_plan_sp (ClangFunction::GetThreadPlanToCallFunction (exe_ctx,
                                                                                  function_address, 
                                                                                  void_arg, 
                                                                                  errors, 
@@ -540,6 +556,18 @@ ClangFunction::ExecuteFunction (
                                                                       timeout_usec,
                                                                       errors);
     
+    if (log)
+    {
+        if (results != eExecutionCompleted)
+        {
+            log->Printf("== [ClangFunction::ExecuteFunction] Execution completed abnormally ==");
+        }
+        else
+        {
+            log->Printf("== [ClangFunction::ExecuteFunction] Execution completed normally ==");
+        }
+    }
+    
     if (exe_ctx.GetProcessPtr())
         exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);