diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
8 files changed, 71 insertions, 65 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index fd9cecaa397..edce0543579 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -171,7 +171,7 @@ GDBRemoteCommunication::CalculcateChecksum (const char *payload, size_t payload_ size_t GDBRemoteCommunication::SendAck () { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); ConnectionStatus status = eConnectionStatusSuccess; char ch = '+'; const size_t bytes_written = Write (&ch, 1, status, NULL); @@ -184,7 +184,7 @@ GDBRemoteCommunication::SendAck () size_t GDBRemoteCommunication::SendNack () { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); ConnectionStatus status = eConnectionStatusSuccess; char ch = '-'; const size_t bytes_written = Write (&ch, 1, status, NULL); @@ -213,7 +213,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le packet.PutChar('#'); packet.PutHex8(CalculcateChecksum (payload, payload_length)); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); ConnectionStatus status = eConnectionStatusSuccess; size_t bytes_written = Write (packet.GetData(), packet.GetSize(), status, NULL); if (log) @@ -223,7 +223,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le // logs all of the packet will set a boolean so that we don't dump this more // than once if (!m_history.DidDumpToLog ()) - m_history.Dump (log.get()); + m_history.Dump (log); log->Printf ("<%4zu> send packet: %.*s", bytes_written, (int)packet.GetSize(), packet.GetData()); } @@ -285,7 +285,7 @@ GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtrac uint8_t buffer[8192]; Error error; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS | GDBR_LOG_VERBOSE)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS | GDBR_LOG_VERBOSE)); // Check for a packet from our cache first without trying any reading... if (CheckForPacket (NULL, 0, packet)) @@ -340,7 +340,7 @@ GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, Stri // Put the packet data into the buffer in a thread safe fashion Mutex::Locker locker(m_bytes_mutex); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); if (src && src_len > 0) { @@ -457,7 +457,7 @@ GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, Stri // logs all of the packet will set a boolean so that we don't dump this more // than once if (!m_history.DidDumpToLog ()) - m_history.Dump (log.get()); + m_history.Dump (log); log->Printf ("<%4zu> read packet: %.*s", total_length, (int)(total_length), m_bytes.c_str()); } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index df89058d6a6..9351b93761b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -311,7 +311,7 @@ GDBRemoteCommunicationClient::SendPacketAndWaitForResponse ) { Mutex::Locker locker; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); size_t response_len = 0; if (GetSequenceMutex (locker)) { @@ -527,7 +527,7 @@ GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse ) { m_curr_tid = LLDB_INVALID_THREAD_ID; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (log) log->Printf ("GDBRemoteCommunicationClient::%s ()", __FUNCTION__); @@ -677,7 +677,7 @@ GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse } else if (m_async_packet_predicate.GetValue()) { - LogSP packet_log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); + Log * packet_log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS)); // We are supposed to send an asynchronous packet while // we are running. @@ -837,7 +837,7 @@ GDBRemoteCommunicationClient::SendInterrupt ) { timed_out = false; - LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)); if (IsRunning()) { @@ -2283,7 +2283,7 @@ GDBRemoteCommunicationClient::GetCurrentThreadIDs (std::vector<lldb::tid_t> &thr #if defined (LLDB_CONFIGURATION_DEBUG) // assert(!"ProcessGDBRemote::UpdateThreadList() failed due to not getting the sequence mutex"); #else - LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)); if (log) log->Printf("error: failed to get packet sequence mutex, not sending packet 'qfThreadInfo'"); #endif diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index e83ea40c91e..7f7361522a4 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -60,7 +60,7 @@ GDBRemoteCommunicationServer::~GDBRemoteCommunicationServer() //{ // GDBRemoteCommunicationServer *server = (GDBRemoteCommunicationServer*) arg; // -// LogSP log;// (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); +// Log *log;// (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); // if (log) // log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, arg, process->GetID()); // diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 08c9de74b15..bf3dc4d8636 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -248,13 +248,13 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE } else { - LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); #if LLDB_CONFIGURATION_DEBUG StreamString strm; gdb_comm.DumpHistory(strm); Host::SetCrashDescription (strm.GetData()); assert (!"Didn't get sequence mutex for read register."); #else + Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); if (log) { if (log->GetVerbose()) @@ -468,7 +468,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo * } else { - LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); if (log) { if (log->GetVerbose()) @@ -540,7 +540,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) } else { - LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); if (log) { if (log->GetVerbose()) @@ -673,7 +673,7 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data } else { - LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); if (log) { if (log->GetVerbose()) diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 07f4d7b70c1..05c39f97fb5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -578,7 +578,7 @@ ProcessGDBRemote::DoLaunch (Module *exe_module, const ProcessLaunchInfo &launch_ // ::LogSetBitMask (GDBR_LOG_DEFAULT); // ::LogSetOptions (LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD); // ::LogSetLogFile ("/dev/stdout"); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); ObjectFile * object_file = exe_module->GetObjectFile(); if (object_file) @@ -798,7 +798,7 @@ ProcessGDBRemote::ConnectToDebugserver (const char *connect_url) void ProcessGDBRemote::DidLaunchOrAttach () { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DidLaunch()"); if (GetID() != LLDB_INVALID_PROCESS_ID) @@ -1036,7 +1036,7 @@ Error ProcessGDBRemote::DoResume () { Error error; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::Resume()"); @@ -1293,7 +1293,7 @@ bool ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) { // locker will keep a mutex locked until it goes out of scope - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD)); if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf ("ProcessGDBRemote::%s (pid = %" PRIu64 ")", __FUNCTION__, GetID()); @@ -1680,7 +1680,7 @@ ProcessGDBRemote::InterruptIfRunning { Error error; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); bool paused_private_state_thread = false; const bool is_running = m_gdb_comm.IsRunning(); @@ -1749,7 +1749,7 @@ ProcessGDBRemote::InterruptIfRunning Error ProcessGDBRemote::WillDetach () { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::WillDetach()"); @@ -1767,7 +1767,7 @@ Error ProcessGDBRemote::DoDetach() { Error error; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DoDetach()"); @@ -1798,7 +1798,7 @@ Error ProcessGDBRemote::DoDestroy () { Error error; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DoDestroy()"); @@ -2177,7 +2177,7 @@ ProcessGDBRemote::EnableBreakpointSite (BreakpointSite *bp_site) Error error; assert (bp_site != NULL); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); user_id_t site_id = bp_site->GetID(); const addr_t addr = bp_site->GetLoadAddress(); if (log) @@ -2241,7 +2241,7 @@ ProcessGDBRemote::DisableBreakpointSite (BreakpointSite *bp_site) assert (bp_site != NULL); addr_t addr = bp_site->GetLoadAddress(); user_id_t site_id = bp_site->GetID(); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); if (log) log->Printf ("ProcessGDBRemote::DisableBreakpointSite (site_id = %" PRIu64 ") addr = 0x%8.8" PRIx64, site_id, (uint64_t)addr); @@ -2307,7 +2307,7 @@ ProcessGDBRemote::EnableWatchpoint (Watchpoint *wp, bool notify) { user_id_t watchID = wp->GetID(); addr_t addr = wp->GetLoadAddress(); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS)); if (log) log->Printf ("ProcessGDBRemote::EnableWatchpoint(watchID = %" PRIu64 ")", watchID); if (wp->IsEnabled()) @@ -2349,7 +2349,7 @@ ProcessGDBRemote::DisableWatchpoint (Watchpoint *wp, bool notify) { user_id_t watchID = wp->GetID(); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS)); addr_t addr = wp->GetLoadAddress(); @@ -2401,7 +2401,7 @@ Error ProcessGDBRemote::DoSignal (int signo) { Error error; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::DoSignal (signal = %d)", signo); @@ -2464,7 +2464,7 @@ ProcessGDBRemote::StartDebugserverProcess (const char *debugserver_url, const Pr m_stdio_communication.Clear(); - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); Args &debugserver_args = debugserver_launch_info.GetArguments(); char arg_cstr[PATH_MAX]; @@ -2553,7 +2553,7 @@ ProcessGDBRemote::StartDebugserverProcess (const char *debugserver_url, const Pr m_debugserver_pid = LLDB_INVALID_PROCESS_ID; if (error.Fail() || log) - error.PutToLog(log.get(), "Host::LaunchProcess (launch_info) => pid=%" PRIu64 ", path='%s'", m_debugserver_pid, debugserver_path); + error.PutToLog(log, "Host::LaunchProcess (launch_info) => pid=%" PRIu64 ", path='%s'", m_debugserver_pid, debugserver_path); } else { @@ -2588,7 +2588,7 @@ ProcessGDBRemote::MonitorDebugserverProcess // "debugserver_pid" argument passed in is the process ID for // debugserver that we are tracking... - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); ProcessGDBRemote *process = (ProcessGDBRemote *)callback_baton; @@ -2689,7 +2689,7 @@ ProcessGDBRemote::Initialize() bool ProcessGDBRemote::StartAsyncThread () { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); @@ -2724,7 +2724,7 @@ ProcessGDBRemote::StartAsyncThread () void ProcessGDBRemote::StopAsyncThread () { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); @@ -2757,7 +2757,7 @@ ProcessGDBRemote::AsyncThread (void *arg) { ProcessGDBRemote *process = (ProcessGDBRemote*) arg; - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64 ") thread starting...", __FUNCTION__, arg, process->GetID()); @@ -2990,7 +2990,7 @@ ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton, { // I don't think I have to do anything here, just make sure I notice the new thread when it starts to // run so I can stop it if that's what I want to do. - LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Hit New Thread Notification breakpoint."); return false; @@ -3000,7 +3000,7 @@ ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton, bool ProcessGDBRemote::StartNoticingNewThreads() { - LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (m_thread_create_bp_sp) { if (log && log->GetVerbose()) @@ -3032,7 +3032,7 @@ ProcessGDBRemote::StartNoticingNewThreads() bool ProcessGDBRemote::StopNoticingNewThreads() { - LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) log->Printf ("Disabling new thread notification breakpoint."); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp index cb764238683..2bb6826e223 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp @@ -22,39 +22,43 @@ using namespace lldb_private; // control access to our static g_log_sp by hiding it in a singleton function // that will construct the static g_lob_sp the first time this function is // called. -static LogSP & +static bool g_log_enabled = false; +static Log * g_log = NULL; +static Log * GetLog () { - static LogSP g_log_sp; - return g_log_sp; + if (!g_log_enabled) + return NULL; + return g_log; } -LogSP + +Log * ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask) { - LogSP log(GetLog ()); + Log *log(GetLog ()); if (log && mask) { uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) - return LogSP(); + return NULL; } return log; } -LogSP +Log * ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (uint32_t mask) { - LogSP log(GetLog ()); + Log *log(GetLog ()); if (log && log->GetMask().Get() & mask) return log; - return LogSP(); + return NULL; } void ProcessGDBRemoteLog::DisableLog (const char **categories, Stream *feedback_strm) { - LogSP log (GetLog ()); + Log *log (GetLog ()); if (log) { uint32_t flag_bits = 0; @@ -91,7 +95,7 @@ ProcessGDBRemoteLog::DisableLog (const char **categories, Stream *feedback_strm) } if (flag_bits == 0) - GetLog ().reset(); + g_log_enabled = false; else log->GetMask().Reset (flag_bits); } @@ -99,24 +103,25 @@ ProcessGDBRemoteLog::DisableLog (const char **categories, Stream *feedback_strm) return; } -LogSP +Log * ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const char **categories, Stream *feedback_strm) { // Try see if there already is a log - that way we can reuse its settings. // We could reuse the log in toto, but we don't know that the stream is the same. uint32_t flag_bits = 0; - LogSP log(GetLog ()); - if (log) - flag_bits = log->GetMask().Get(); + if (g_log) + flag_bits = g_log->GetMask().Get(); // Now make a new log with this stream if one was provided if (log_stream_sp) { - log.reset (new Log(log_stream_sp)); - GetLog () = log; + if (g_log) + g_log->SetStream(log_stream_sp); + else + g_log = new Log(log_stream_sp); } - if (log) + if (g_log) { bool got_unknown_category = false; for (size_t i=0; categories[i] != NULL; ++i) @@ -149,10 +154,11 @@ ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, c } if (flag_bits == 0) flag_bits = GDBR_LOG_DEFAULT; - log->GetMask().Reset(flag_bits); - log->GetOptions().Reset(log_options); + g_log->GetMask().Reset(flag_bits); + g_log->GetOptions().Reset(log_options); } - return log; + g_log_enabled = true; + return g_log; } void @@ -179,7 +185,7 @@ ProcessGDBRemoteLog::ListLogCategories (Stream *strm) void ProcessGDBRemoteLog::LogIf (uint32_t mask, const char *format, ...) { - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask)); + Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask)); if (log) { va_list args; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h index cf5e176a213..93734067f13 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h @@ -35,16 +35,16 @@ class ProcessGDBRemoteLog { public: - static lldb::LogSP + static lldb_private::Log * GetLogIfAllCategoriesSet(uint32_t mask = 0); - static lldb::LogSP + static lldb_private::Log * GetLogIfAnyCategoryIsSet (uint32_t mask); static void DisableLog (const char **categories, lldb_private::Stream *feedback_strm); - static lldb::LogSP + static lldb_private::Log * EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories, lldb_private::Stream *feedback_strm); static void diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 001cc60aea1..4ac3f687aba 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -95,7 +95,7 @@ ThreadGDBRemote::WillResume (StateType resume_state) ClearStackFrames(); int signo = GetResumeSignal(); - lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); + Log *log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); if (log) log->Printf ("Resuming thread: %4.4" PRIx64 " with state: %s.", GetID(), StateAsCString(resume_state)); |