diff options
-rw-r--r-- | lldb/include/lldb/Core/Log.h | 24 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectLog.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Core/Log.cpp | 85 |
3 files changed, 2 insertions, 119 deletions
diff --git a/lldb/include/lldb/Core/Log.h b/lldb/include/lldb/Core/Log.h index 58ce922acef..75cbac94d2c 100644 --- a/lldb/include/lldb/Core/Log.h +++ b/lldb/include/lldb/Core/Log.h @@ -101,30 +101,6 @@ public: ListAllLogChannels (Stream *strm); //------------------------------------------------------------------ - // Static accessors to STDOUT logging facilities. - //------------------------------------------------------------------ - static void - STDOUT (const char *format, ...); - - static lldb::StreamSP - GetStreamForSTDOUT (); - - static void - SetStreamForSTDOUT (lldb::StreamSP &stream_sp); - - //------------------------------------------------------------------ - // Static accessors to STDERR logging facilities. - //------------------------------------------------------------------ - static void - STDERR (const char *format, ...); - - static lldb::StreamSP - GetStreamForSTDERR (); - - static void - SetStreamForSTDERR (lldb::StreamSP &stream_sp); - - //------------------------------------------------------------------ // Member functions //------------------------------------------------------------------ Log (); diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 5616fb1a064..a63e2ed7890 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -27,6 +27,7 @@ #include "lldb/Core/Timer.h" #include "lldb/Core/Debugger.h" +#include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Symbol/LineTable.h" @@ -94,16 +95,7 @@ public: if (m_options.log_file.empty()) { - std::string log_file("<lldb.debugger>"); - LogStreamMap::iterator pos = m_log_streams.find(log_file); - if (pos == m_log_streams.end()) - { - log_stream_sp = Log::GetStreamForSTDOUT (); - if (log_stream_sp) - m_log_streams[log_file] = log_stream_sp; - } - else - log_stream_sp = pos->second; + log_stream_sp.reset(new StreamFile(interpreter.GetDebugger().GetOutputFileHandle())); } else { diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index 1be3c525ae0..7bbbf4f11c3 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -32,91 +32,6 @@ using namespace lldb; using namespace lldb_private; -static Stream * -StreamForSTDOUTAccess (bool set, StreamSP &stream_sp) -{ - // Since we are in a shared library and we can't have global - // constructors, we need to control access to this static variable - // through an accessor function to get and set the value. - static StreamSP g_stream_sp; - - if (set) - g_stream_sp = stream_sp; - else - stream_sp = g_stream_sp; - - return stream_sp.get(); -} - -StreamSP -Log::GetStreamForSTDOUT () -{ - StreamSP stream_sp; - StreamForSTDOUTAccess (false, stream_sp); - return stream_sp; -} - -void -Log::SetStreamForSTDOUT (StreamSP &stream_sp) -{ - StreamForSTDOUTAccess (true, stream_sp); -} - -void -Log::STDOUT (const char *format, ...) -{ - StreamSP stream_sp; - if (StreamForSTDOUTAccess(false, stream_sp)) - { - va_list args; - va_start (args, format); - stream_sp->PrintfVarArg(format, args); - va_end (args); - } -} - -static Stream * -StreamForSTDERRAccess (bool set, StreamSP &stream_sp) -{ - // Since we are in a shared library and we can't have global - // constructors, we need to control access to this static variable - // through an accessor function to get and set the value. - static StreamSP g_stream_sp; - - if (set) - g_stream_sp = stream_sp; - else - stream_sp = g_stream_sp; - return stream_sp.get(); -} - -StreamSP -Log::GetStreamForSTDERR () -{ - StreamSP stream_sp; - StreamForSTDERRAccess (false, stream_sp); - return stream_sp; -} - -void -Log::SetStreamForSTDERR (StreamSP &stream_sp) -{ - StreamForSTDERRAccess (true, stream_sp); -} - -void -Log::STDERR (const char *format, ...) -{ - StreamSP stream_sp; - if (StreamForSTDERRAccess(false, stream_sp)) - { - va_list args; - va_start (args, format); - stream_sp->PrintfVarArg(format, args); - va_end (args); - } -} - Log::Log () : m_stream_sp(), m_options(0), |