Added some extra logging to track asynchronous packet activity.

llvm-svn: 113012
This commit is contained in:
Greg Clayton 2010-09-03 21:14:27 +00:00
parent 9bb67f4d1a
commit ef3cf2b954
3 changed files with 28 additions and 0 deletions

View File

@ -194,6 +194,7 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
)
{
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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
"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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
}
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 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
// 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)
{

View File

@ -59,7 +59,9 @@ ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, A
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 @@ ProcessGDBRemoteLog::ListLogCategories (Stream *strm)
{
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"

View File

@ -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