summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp59
1 files changed, 29 insertions, 30 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 17829634767..9319d27d33b 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -36,6 +36,7 @@
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Terminal.h"
+#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
#include "lldb/Interpreter/OptionValueString.h"
@@ -620,24 +621,22 @@ Debugger::FindTargetWithProcess (Process *process)
return target_sp;
}
-Debugger::Debugger (lldb::LogOutputCallback log_callback, void *baton) :
- UserID (g_unique_id++),
- Properties(OptionValuePropertiesSP(new OptionValueProperties())),
- m_input_file_sp (new StreamFile (stdin, false)),
- m_output_file_sp (new StreamFile (stdout, false)),
- m_error_file_sp (new StreamFile (stderr, false)),
- m_terminal_state (),
- m_target_list (*this),
- m_platform_list (),
- m_listener ("lldb.Debugger"),
- m_source_manager_ap(),
- m_source_file_cache(),
- m_command_interpreter_ap (new CommandInterpreter (*this, eScriptLanguageDefault, false)),
- m_input_reader_stack (),
- m_instance_name (),
- m_loaded_plugins (),
- m_event_handler_thread (LLDB_INVALID_HOST_THREAD),
- m_io_handler_thread (LLDB_INVALID_HOST_THREAD)
+Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
+ : UserID(g_unique_id++)
+ , Properties(OptionValuePropertiesSP(new OptionValueProperties()))
+ , m_input_file_sp(new StreamFile(stdin, false))
+ , m_output_file_sp(new StreamFile(stdout, false))
+ , m_error_file_sp(new StreamFile(stderr, false))
+ , m_terminal_state()
+ , m_target_list(*this)
+ , m_platform_list()
+ , m_listener("lldb.Debugger")
+ , m_source_manager_ap()
+ , m_source_file_cache()
+ , m_command_interpreter_ap(new CommandInterpreter(*this, eScriptLanguageDefault, false))
+ , m_input_reader_stack()
+ , m_instance_name()
+ , m_loaded_plugins()
{
char instance_cstr[256];
snprintf(instance_cstr, sizeof(instance_cstr), "debugger_%d", (int)GetID());
@@ -3337,19 +3336,19 @@ Debugger::EventHandlerThread (lldb::thread_arg_t arg)
bool
Debugger::StartEventHandlerThread()
{
- if (!IS_VALID_LLDB_HOST_THREAD(m_event_handler_thread))
- m_event_handler_thread = Host::ThreadCreate("lldb.debugger.event-handler", EventHandlerThread, this, NULL);
- return IS_VALID_LLDB_HOST_THREAD(m_event_handler_thread);
+ if (m_event_handler_thread.GetState() != eThreadStateRunning)
+ m_event_handler_thread = ThreadLauncher::LaunchThread("lldb.debugger.event-handler", EventHandlerThread, this, NULL);
+ return m_event_handler_thread.GetState() == eThreadStateRunning;
}
void
Debugger::StopEventHandlerThread()
{
- if (IS_VALID_LLDB_HOST_THREAD(m_event_handler_thread))
+ if (m_event_handler_thread.GetState() == eThreadStateRunning)
{
GetCommandInterpreter().BroadcastEvent(CommandInterpreter::eBroadcastBitQuitCommandReceived);
- Host::ThreadJoin(m_event_handler_thread, NULL, NULL);
- m_event_handler_thread = LLDB_INVALID_HOST_THREAD;
+ m_event_handler_thread.Join(nullptr);
+ m_event_handler_thread.Reset();
}
}
@@ -3366,20 +3365,20 @@ Debugger::IOHandlerThread (lldb::thread_arg_t arg)
bool
Debugger::StartIOHandlerThread()
{
- if (!IS_VALID_LLDB_HOST_THREAD(m_io_handler_thread))
- m_io_handler_thread = Host::ThreadCreate("lldb.debugger.io-handler", IOHandlerThread, this, NULL);
- return IS_VALID_LLDB_HOST_THREAD(m_io_handler_thread);
+ if (m_io_handler_thread.GetState() != eThreadStateRunning)
+ m_io_handler_thread = ThreadLauncher::LaunchThread("lldb.debugger.io-handler", IOHandlerThread, this, NULL);
+ return m_io_handler_thread.GetState() == eThreadStateRunning;
}
void
Debugger::StopIOHandlerThread()
{
- if (IS_VALID_LLDB_HOST_THREAD(m_io_handler_thread))
+ if (m_io_handler_thread.GetState() == eThreadStateRunning)
{
if (m_input_file_sp)
m_input_file_sp->GetFile().Close();
- Host::ThreadJoin(m_io_handler_thread, NULL, NULL);
- m_io_handler_thread = LLDB_INVALID_HOST_THREAD;
+ m_io_handler_thread.Join(nullptr);
+ m_io_handler_thread.Reset();
}
}
OpenPOWER on IntegriCloud