Added a quicker lookup in the SectionLoadList when looking things up by
section by using a DenseMap.
Fixed some logging calls to get the log shared pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124926 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 769849d..6442e21 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -90,7 +90,9 @@
size_t
GDBRemoteCommunication::SendAck ()
{
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: +");
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
+ if (log)
+ log->Printf ("send packet: +");
ConnectionStatus status = eConnectionStatusSuccess;
char ack_char = '+';
return Write (&ack_char, 1, status, NULL) == 1;
@@ -99,7 +101,9 @@
size_t
GDBRemoteCommunication::SendNack ()
{
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: -");
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
+ if (log)
+ log->Printf ("send packet: -");
ConnectionStatus status = eConnectionStatusSuccess;
char nack_char = '-';
return Write (&nack_char, 1, status, NULL) == 1;
@@ -440,7 +444,9 @@
packet.PutChar('#');
packet.PutHex8(CalculcateChecksum (payload, payload_length));
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: %s", packet.GetData());
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
+ if (log)
+ log->Printf ("send packet: %s", packet.GetData());
ConnectionStatus status = eConnectionStatusSuccess;
size_t bytes_written = Write (packet.GetData(), packet.GetSize(), status, NULL);
if (bytes_written == packet.GetSize())
@@ -453,7 +459,9 @@
}
else
{
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "error: failed to send packet: %s", packet.GetData());
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
+ if (log)
+ log->Printf ("error: failed to send packet: %s", packet.GetData());
}
return bytes_written;
}
@@ -614,7 +622,9 @@
if (event_bytes)
{
const char * packet_data = (const char *)event_bytes->GetBytes();
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "read packet: %s", packet_data);
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
+ if (log)
+ log->Printf ("read packet: %s", packet_data);
const size_t packet_size = event_bytes->GetByteSize();
if (packet_data && packet_size > 0)
{
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 2da0de9..41296d9 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -631,7 +631,9 @@
void
ProcessGDBRemote::DidLaunchOrAttach ()
{
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PROCESS, "ProcessGDBRemote::DidLaunch()");
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
+ if (log)
+ log->Printf ("ProcessGDBRemote::DidLaunch()");
if (GetID() == LLDB_INVALID_PROCESS_ID)
{
m_dynamic_loader_ap.reset();
@@ -704,10 +706,7 @@
// Clear out and clean up from any current state
Clear();
ArchSpec arch_spec = GetTarget().GetArchitecture();
-
- //LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
-
-
+
if (attach_pid != LLDB_INVALID_PROCESS_ID)
{
char host_port[128];
@@ -782,7 +781,6 @@
// HACK: require arch be set correctly at the target level until we can
// figure out a good way to determine the arch of what we are attaching to
- //LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
if (process_name && process_name[0])
{
ArchSpec arch_spec = GetTarget().GetArchitecture();
@@ -860,7 +858,9 @@
ProcessGDBRemote::DoResume ()
{
Error error;
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PROCESS, "ProcessGDBRemote::Resume()");
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
+ if (log)
+ log->Printf ("ProcessGDBRemote::Resume()");
Listener listener ("gdb-remote.resume-packet-sent");
if (listener.StartListeningForEvents (&m_gdb_comm, GDBRemoteCommunication::eBroadcastBitRunPacketSent))
@@ -1446,7 +1446,9 @@
size_t bytes_available = m_stdout_data.size();
if (bytes_available > 0)
{
- ProcessGDBRemoteLog::LogIf (GDBR_LOG_PROCESS, "ProcessGDBRemote::%s (&%p[%u]) ...", __FUNCTION__, buf, buf_size);
+ LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
+ if (log)
+ log->Printf ("ProcessGDBRemote::%s (&%p[%u]) ...", __FUNCTION__, buf, buf_size);
if (bytes_available > buf_size)
{
memcpy(buf, m_stdout_data.c_str(), buf_size);
@@ -1709,25 +1711,6 @@
return error;
}
-//void
-//ProcessGDBRemote::STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len)
-//{
-// ProcessGDBRemote *process = (ProcessGDBRemote *)baton;
-// process->AppendSTDOUT(static_cast<const char *>(src), src_len);
-//}
-
-//void
-//ProcessGDBRemote::AppendSTDOUT (const char* s, size_t len)
-//{
-// ProcessGDBRemoteLog::LogIf (GDBR_LOG_PROCESS, "ProcessGDBRemote::%s (<%d> %s) ...", __FUNCTION__, len, s);
-// Mutex::Locker locker(m_stdio_mutex);
-// m_stdout_data.append(s, len);
-//
-// // FIXME: Make a real data object for this and put it out.
-// BroadcastEventIfUnique (eBroadcastBitSTDOUT);
-//}
-
-
Error
ProcessGDBRemote::StartDebugserverProcess
(
@@ -2231,7 +2214,6 @@
bool done = false;
while (!done)
{
- log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
if (listener.WaitForEvent (NULL, event_sp))
@@ -2250,7 +2232,6 @@
{
const char *continue_cstr = (const char *)continue_packet->GetBytes ();
const size_t continue_cstr_len = continue_packet->GetByteSize ();
- log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr);
@@ -2289,14 +2270,12 @@
break;
case eBroadcastBitAsyncThreadShouldExit:
- log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
done = true;
break;
default:
- log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
done = true;
@@ -2305,7 +2284,6 @@
}
else
{
- log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
done = true;
@@ -2313,7 +2291,6 @@
}
}
- log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, arg, process->GetID());