aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/Plugins/Process/POSIX/POSIXThread.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/Plugins/Process/POSIX/POSIXThread.cpp b/source/Plugins/Process/POSIX/POSIXThread.cpp
index 0f3e7bec2..a5cccee3b 100644
--- a/source/Plugins/Process/POSIX/POSIXThread.cpp
+++ b/source/Plugins/Process/POSIX/POSIXThread.cpp
@@ -145,14 +145,18 @@ POSIXThread::GetRegisterContext()
break;
case ArchSpec::eCore_x86_64_x86_64:
-// TODO: Use target OS/architecture detection rather than ifdefs so that
-// lldb built on FreeBSD can debug on Linux and vice-versa.
-#ifdef __linux__
- m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));
-#endif
-#ifdef __FreeBSD__
- m_reg_context_sp.reset(new RegisterContextFreeBSD_x86_64(*this, 0));
-#endif
+ switch (arch.GetTriple().getOS())
+ {
+ case llvm::Triple::FreeBSD:
+ m_reg_context_sp.reset(new RegisterContextFreeBSD_x86_64(*this, 0));
+ break;
+ case llvm::Triple::Linux:
+ m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));
+ break;
+ default:
+ assert(false && "OS not supported");
+ break;
+ }
break;
}
}