[Lldb-commits] [lldb] r166356 - /lldb/trunk/source/API/SBTarget.cpp

Sean Callanan scallanan at apple.com
Fri Oct 19 17:21:31 PDT 2012


Author: spyffe
Date: Fri Oct 19 19:21:31 2012
New Revision: 166356

URL: http://llvm.org/viewvc/llvm-project?rev=166356&view=rev
Log:
Improved logging for the SBTarget's launching
and attaching APIs.

Modified:
    lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=166356&r1=166355&r2=166356&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Oct 19 19:21:31 2012
@@ -710,7 +710,7 @@
     log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
     if (log)
     {
-        log->Printf ("SBTarget(%p)::Launch (...) => SBProceess(%p)", 
+        log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", 
                      target_sp.get(), process_sp.get());
     }
 
@@ -810,7 +810,7 @@
     log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
     if (log)
     {
-        log->Printf ("SBTarget(%p)::Launch (...) => SBProceess(%p)", 
+        log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", 
                      target_sp.get(), process_sp.get());
     }
     
@@ -820,9 +820,17 @@
 lldb::SBProcess
 SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
 {
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+    
     SBProcess sb_process;
     ProcessSP process_sp;
     TargetSP target_sp(GetSP());
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", target_sp.get());
+    }
+    
     if (target_sp)
     {
         Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -839,6 +847,11 @@
                     error.SetErrorString ("process attach is in progress");
                 else
                     error.SetErrorString ("a process is already being debugged");
+                if (log)
+                {
+                    log->Printf ("SBTarget(%p)::Attach (...) => error %s",
+                                 target_sp.get(), error.GetCString());
+                }
                 return sb_process;
             }            
         }
@@ -864,6 +877,11 @@
                     else
                     {
                         error.ref().SetErrorStringWithFormat("no process found with process ID %llu", attach_pid);
+                        if (log)
+                        {
+                            log->Printf ("SBTarget(%p)::Attach (...) => error %s",
+                                         target_sp.get(), error.GetCString());
+                        }
                         return sb_process;
                     }
                 }
@@ -887,6 +905,13 @@
     {
         error.SetErrorString ("SBTarget is invalid");
     }
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::Attach (...) => SBProcess(%p)",
+                     target_sp.get(), process_sp.get());
+    }
+    
     return sb_process;
 }
 
@@ -911,9 +936,17 @@
     SBError& error  // An error explaining what went wrong if attach fails
 )
 {
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
     SBProcess sb_process;
     ProcessSP process_sp;
     TargetSP target_sp(GetSP());
+
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%lld, error)...", target_sp.get(), pid);
+    }
+    
     if (target_sp)
     {
         Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -983,8 +1016,13 @@
     {
         error.SetErrorString ("SBTarget is invalid");
     }
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::AttachToProcessWithID (...) => SBProcess(%p)",
+                     target_sp.get(), process_sp.get());
+    }
     return sb_process;
-
 }
 
 lldb::SBProcess
@@ -996,9 +1034,17 @@
     SBError& error      // An error explaining what went wrong if attach fails
 )
 {
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+    
     SBProcess sb_process;
     ProcessSP process_sp;
     TargetSP target_sp(GetSP());
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", target_sp.get(), name, wait_for ? "true" : "false");
+    }
+    
     if (name && target_sp)
     {
         Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -1059,8 +1105,13 @@
     {
         error.SetErrorString ("SBTarget is invalid");
     }
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::AttachToPorcessWithName (...) => SBProcess(%p)",
+                     target_sp.get(), process_sp.get());
+    }
     return sb_process;
-
 }
 
 lldb::SBProcess
@@ -1072,9 +1123,17 @@
     SBError& error
 )
 {
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
     SBProcess sb_process;
     ProcessSP process_sp;
     TargetSP target_sp(GetSP());
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", target_sp.get(), url, plugin_name);
+    }
+    
     if (target_sp)
     {
         Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -1098,6 +1157,12 @@
     {
         error.SetErrorString ("SBTarget is invalid");
     }
+    
+    if (log)
+    {
+        log->Printf ("SBTarget(%p)::ConnectRemote (...) => SBProcess(%p)",
+                     target_sp.get(), process_sp.get());
+    }
     return sb_process;
 }
 





More information about the lldb-commits mailing list