Add a logging mode that takes a callback and flush'es to that callback.
Also add SB API's to set this callback, and to enable the log channels.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151018 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index f98ca35..8150cb0 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -81,16 +81,23 @@
SBDebugger
SBDebugger::Create()
{
- return SBDebugger::Create(false);
+ return SBDebugger::Create(false, NULL, NULL);
}
SBDebugger
SBDebugger::Create(bool source_init_files)
{
+ return SBDebugger::Create (source_init_files, NULL, NULL);
+}
+
+SBDebugger
+SBDebugger::Create(bool source_init_files, lldb::LogOutputCallback callback, void *baton)
+
+{
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBDebugger debugger;
- debugger.reset(Debugger::CreateInstance());
+ debugger.reset(Debugger::CreateInstance(callback, baton));
if (log)
{
@@ -1200,3 +1207,16 @@
return synth_chosen;
}
+bool
+SBDebugger::EnableLog (const char *channel, const char **categories)
+{
+ if (m_opaque_sp)
+ {
+ uint32_t log_options = LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_THREAD_NAME;
+ StreamString errors;
+ return m_opaque_sp->EnableLog (channel, categories, NULL, log_options, errors);
+
+ }
+ else
+ return false;
+}