#ifndef lldb_Host_HostNativeThread_h_
#define lldb_Host_HostNativeThread_h_
+#include "HostNativeThreadForward.h"
+
#if defined(_WIN32)
#include "lldb/Host/windows/HostThreadWindows.h"
-namespace lldb_private
-{
-typedef HostThreadWindows HostNativeThread;
-}
#elif defined(__linux__)
#include "lldb/Host/linux/HostThreadLinux.h"
-namespace lldb_private
-{
-typedef HostThreadLinux HostNativeThread;
-}
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "lldb/Host/freebsd/HostThreadFreeBSD.h"
-namespace lldb_private
-{
-typedef HostThreadFreeBSD HostNativeThread;
-}
#elif defined(__APPLE__)
#include "lldb/Host/macosx/HostThreadMacOSX.h"
-namespace lldb_private
-{
-typedef HostThreadMacOSX HostNativeThread;
-}
#endif
#endif
--- /dev/null
+//===-- HostNativeThreadForward.h -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostNativeThreadForward_h_
+#define lldb_Host_HostNativeThreadForward_h_
+
+namespace lldb_private
+{
+#if defined(_WIN32)
+class HostThreadWindows;
+typedef HostThreadWindows HostNativeThread;
+#elif defined(__linux__)
+class HostThreadLinux;
+typedef HostThreadLinux HostNativeThread;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+class HostThreadFreeBSD;
+typedef HostThreadFreeBSD HostNativeThread;
+#elif defined(__APPLE__)
+class HostThreadMacOSX;
+typedef HostThreadMacOSX HostNativeThread;
+#endif
+}
+
+#endif
#define lldb_Host_HostThread_h_
#include "lldb/Core/Error.h"
+#include "lldb/Host/HostNativeThreadForward.h"
#include "lldb/lldb-types.h"
#include <memory>
lldb::thread_t Release();
bool IsJoinable() const;
- HostNativeThreadBase &GetNativeThread();
- const HostNativeThreadBase &GetNativeThread() const;
+ HostNativeThread &GetNativeThread();
+ const HostNativeThread &GetNativeThread() const;
lldb::thread_result_t GetResult() const;
bool EqualsThread(lldb::thread_t thread) const;
#include "lldb/Core/Log.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/HostNativeThread.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ThreadLauncher.h"
-#if !defined(_WIN32)
-#include "lldb/Host/HostNativeThread.h"
-#endif
-
using namespace lldb;
using namespace lldb_private;
error_ptr->SetErrorString("ThreadDetach is not supported on this platform");
#else
HostThread host_thread(thread);
- error = ((HostThreadPosix &)host_thread.GetNativeThread()).Detach();
+ error = host_thread.GetNativeThread().Detach();
if (error_ptr)
error_ptr->SetError(error);
host_thread.Release();
return m_native_thread->IsJoinable();
}
-HostNativeThreadBase &
+HostNativeThread &
HostThread::GetNativeThread()
{
- return *m_native_thread;
+ return static_cast<HostNativeThread &>(*m_native_thread);
}
-const HostNativeThreadBase &
+const HostNativeThread &
HostThread::GetNativeThread() const
{
- return *m_native_thread;
+ return static_cast<const HostNativeThread &>(*m_native_thread);
}
lldb::thread_result_t
m_process = HostProcess(info.hProcess);
((HostProcessWindows &)m_process.GetNativeProcess()).SetOwnsHandle(false);
m_main_thread = HostThread(info.hThread);
- ((HostThreadWindows &)m_main_thread.GetNativeThread()).SetOwnsHandle(false);
+ m_main_thread.GetNativeThread().SetOwnsHandle(false);
m_image_file = info.hFile;
lldb::addr_t load_addr = reinterpret_cast<lldb::addr_t>(info.lpBaseOfImage);
module->SetLoadAddress(GetTarget(), image_base, false, load_addr_changed);
DebuggerThreadSP debugger = m_session_data->m_debugger;
- const HostThreadWindows &wmain_thread = static_cast<const HostThreadWindows &>(debugger->GetMainThread().GetNativeThread());
+ const HostThreadWindows &wmain_thread = debugger->GetMainThread().GetNativeThread();
m_session_data->m_new_threads[wmain_thread.GetThreadId()] = debugger->GetMainThread();
}
void
ProcessWindows::OnCreateThread(const HostThread &new_thread)
{
- const HostThreadWindows &wnew_thread = static_cast<const HostThreadWindows &>(new_thread.GetNativeThread());
+ const HostThreadWindows &wnew_thread = new_thread.GetNativeThread();
m_session_data->m_new_threads[wnew_thread.GetThreadId()] = new_thread;
}
{
// A thread may have started and exited before the debugger stopped allowing a refresh.
// Just remove it from the new threads list in that case.
- const HostThreadWindows &wexited_thread = static_cast<const HostThreadWindows &>(exited_thread.GetNativeThread());
+ const HostThreadWindows &wexited_thread = exited_thread.GetNativeThread();
auto iter = m_session_data->m_new_threads.find(wexited_thread.GetThreadId());
if (iter != m_session_data->m_new_threads.end())
m_session_data->m_new_threads.erase(iter);
using namespace lldb_private;
TargetThreadWindows::TargetThreadWindows(ProcessWindows &process, const HostThread &thread)
- : Thread(process, ((HostThreadWindows &)thread.GetNativeThread()).GetThreadId())
+ : Thread(process, thread.GetNativeThread().GetThreadId())
, m_host_thread(thread)
{
}