[Lldb-commits] [PATCH 2/2] elf-core: Run-time reg context selection
Ed Maste
emaste at freebsd.org
Mon Jul 22 09:46:21 PDT 2013
Choose the type of RegisterContextCore... based on getOS() at run-time,
instead of via compile-time #ifdef-ery.
---
source/Plugins/Process/elf-core/ThreadElfCore.cpp | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index 6ac12fe..0afb9d7 100644
--- a/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -95,11 +95,20 @@ ThreadElfCore::CreateRegisterContextForFrame (StackFrame *frame)
switch (arch.GetMachine())
{
case llvm::Triple::x86_64:
-#ifdef __FreeBSD__
- m_thread_reg_ctx_sp.reset(new RegisterContextCoreFreeBSD_x86_64 (*this, gpregset_data, m_fpregset_data));
-#else
- m_thread_reg_ctx_sp.reset(new RegisterContextCoreLinux_x86_64 (*this, gpregset_data, m_fpregset_data));
-#endif
+ switch (arch.GetTriple().getOS())
+ {
+ case llvm::Triple::FreeBSD:
+ m_thread_reg_ctx_sp.reset(new RegisterContextCoreFreeBSD_x86_64 (*this, gpregset_data, m_fpregset_data));
+ break;
+ case llvm::Triple::Linux:
+ m_thread_reg_ctx_sp.reset(new RegisterContextCoreLinux_x86_64 (*this, gpregset_data, m_fpregset_data));
+ break;
+ default:
+ if (log)
+ log->Printf ("elf-core::%s:: OS(%d) not supported",
+ __FUNCTION__, arch.GetTriple().getOS());
+ break;
+ }
break;
default:
if (log)
--
1.7.11.5
More information about the lldb-commits
mailing list