[Lldb-commits] [PATCH 2/2] elf-core: Run-time reg context selection

Malea, Daniel daniel.malea at intel.com
Mon Jul 22 12:01:26 PDT 2013


Hi Ed,

This patch and the one before it seem OK. No regressions detected when
running the test suite with Clang on Linux. Not sure how I would test
loading a FreeBSD core-file on Linux though...



Cheers,
Dan

On 2013-07-22 12:46 PM, "Ed Maste" <emaste at freebsd.org> wrote:

>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
>
>_______________________________________________
>lldb-commits mailing list
>lldb-commits at cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list