[Lldb-commits] [lldb] r113012 - in /lldb/trunk/source/Plugins/Process/gdb-remote: GDBRemoteCommunication.cpp ProcessGDBRemoteLog.cpp ProcessGDBRemoteLog.h

Greg Clayton gclayton at apple.com
Fri Sep 3 14:14:27 PDT 2010


Author: gclayton
Date: Fri Sep  3 16:14:27 2010
New Revision: 113012

URL: http://llvm.org/viewvc/llvm-project?rev=113012&view=rev
Log:
Added some extra logging to track asynchronous packet activity.


Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=113012&r1=113011&r2=113012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Sep  3 16:14:27 2010
@@ -194,6 +194,7 @@
 )
 {
     Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
+    Log *async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC);
     if (log)
         log->Printf ("GDBRemoteCommunication::%s ()", __FUNCTION__);
 
@@ -226,6 +227,9 @@
                 case 'S':
                     if (m_async_signal != -1)
                     {
+                        if (async_log) 
+                            async_log->Printf ("async: send signo = %s", Host::GetSignalAsCString (m_async_signal));
+
                         // Save off the async signal we are supposed to send
                         const int async_signal = m_async_signal;
                         // Clear the async signal member so we don't end up
@@ -235,6 +239,9 @@
                         uint8_t signo = response.GetHexU8(255);
                         if (signo == async_signal)
                         {
+                            if (async_log) 
+                                async_log->Printf ("async: stopped with signal %s, we are done running", Host::GetSignalAsCString (signo));
+
                             // We already stopped with a signal that we wanted
                             // to stop with, so we are done
                             response.SetFilePos (0);
@@ -251,8 +258,16 @@
                                                             "C%2.2x",
                                                             async_signal);
 
+                            if (async_log) 
+                                async_log->Printf ("async: stopped with signal %s, resume with %s", 
+                                                   Host::GetSignalAsCString (signo),
+                                                   Host::GetSignalAsCString (async_signal));
+
                             if (SendPacket(signal_packet, signal_packet_len) == 0)
                             {
+                                if (async_log) 
+                                    async_log->Printf ("async: error: failed to resume with %s", 
+                                                       Host::GetSignalAsCString (async_signal));
                                 state = eStateInvalid;
                                 break;
                             }
@@ -262,6 +277,10 @@
                     }
                     else if (m_async_packet_predicate.GetValue())
                     {
+                        if (async_log) 
+                            async_log->Printf ("async: send async packet: %s", 
+                                               m_async_packet.c_str());
+
                         // We are supposed to send an asynchronous packet while
                         // we are running. 
                         m_async_response.Clear();
@@ -277,6 +296,10 @@
                         // packet know that the packet has been sent.
                         m_async_packet_predicate.SetValue(false, eBroadcastAlways);
 
+                        if (async_log) 
+                            async_log->Printf ("async: resume after async response received: %s", 
+                                               m_async_response.GetStringRef().c_str());
+
                         // Continue again
                         if (SendPacket("c", 1) == 0)
                         {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=113012&r1=113011&r2=113012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Fri Sep  3 16:14:27 2010
@@ -59,7 +59,9 @@
             const char *arg = args.GetArgumentAtIndex(i);
 
             if      (::strcasecmp (arg, "all")        == 0   ) flag_bits |= GDBR_LOG_ALL;
+            else if (::strcasecmp (arg, "async")      == 0   ) flag_bits |= GDBR_LOG_ASYNC;
             else if (::strcasestr (arg, "break")      == arg ) flag_bits |= GDBR_LOG_BREAKPOINTS;
+            else if (::strcasestr (arg, "comm")       == arg ) flag_bits |= GDBR_LOG_COMM;
             else if (::strcasecmp (arg, "default")    == 0   ) flag_bits |= GDBR_LOG_DEFAULT;
             else if (::strcasecmp (arg, "packets")    == 0   ) flag_bits |= GDBR_LOG_PACKETS;
             else if (::strcasecmp (arg, "memory")     == 0   ) flag_bits |= GDBR_LOG_MEMORY;
@@ -93,7 +95,9 @@
 {
     strm->Printf("Logging categories for '%s':\n"
         "\tall - turn on all available logging categories\n"
+        "\tasync - log asynchronous activity\n"
         "\tbreak - log breakpoints\n"
+        "\tcommunication - log communication activity\n"
         "\tdefault - enable the default set of logging categories for liblldb\n"
         "\tpackets - log gdb remote packets\n"
         "\tmemory - log memory reads and writes\n"

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h?rev=113012&r1=113011&r2=113012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h Fri Sep  3 16:14:27 2010
@@ -28,6 +28,7 @@
 #define GDBR_LOG_WATCHPOINTS              (1u << 8)
 #define GDBR_LOG_STEP                     (1u << 9)
 #define GDBR_LOG_COMM                     (1u << 10)
+#define GDBR_LOG_ASYNC                    (1u << 11)
 #define GDBR_LOG_ALL                      (UINT32_MAX)
 #define GDBR_LOG_DEFAULT                  GDBR_LOG_PACKETS
 





More information about the lldb-commits mailing list