[Lldb-commits] [PATCH] Refactor POSIXThread::GetRegisterContext and use i386 register context
Ed Maste
emaste at freebsd.org
Fri Feb 28 11:46:42 PST 2014
correct copy-and-pasteo
Hi tfiala,
http://llvm-reviews.chandlerc.com/D2765
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2765?vs=7432&id=7433#toc
Files:
source/Plugins/Process/POSIX/POSIXThread.cpp
Index: source/Plugins/Process/POSIX/POSIXThread.cpp
===================================================================
--- source/Plugins/Process/POSIX/POSIXThread.cpp
+++ source/Plugins/Process/POSIX/POSIXThread.cpp
@@ -156,40 +156,34 @@
RegisterInfoInterface *reg_interface = NULL;
const ArchSpec &target_arch = GetProcess()->GetTarget().GetArchitecture();
- switch (target_arch.GetCore())
+ switch (target_arch.GetTriple().getOS())
{
- case ArchSpec::eCore_mips64:
- {
- switch (target_arch.GetTriple().getOS())
+ case llvm::Triple::FreeBSD:
+ switch (target_arch.GetCore())
{
- case llvm::Triple::FreeBSD:
+ case ArchSpec::eCore_mips64:
reg_interface = new RegisterContextFreeBSD_mips64(target_arch);
break;
+ case ArchSpec::eCore_x86_32_i386:
+ case ArchSpec::eCore_x86_32_i486:
+ case ArchSpec::eCore_x86_32_i486sx:
+ reg_interface = new RegisterContextFreeBSD_i386(target_arch);
+ break;
+ case ArchSpec::eCore_x86_64_x86_64:
+ reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
+ break;
default:
- assert(false && "OS not supported");
break;
}
-
- if (reg_interface)
- {
- RegisterContextPOSIXProcessMonitor_mips64 *reg_ctx = new RegisterContextPOSIXProcessMonitor_mips64(*this, 0, reg_interface);
- m_posix_thread = reg_ctx;
- m_reg_context_sp.reset(reg_ctx);
- }
break;
- }
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
- case ArchSpec::eCore_x86_64_x86_64:
- {
- switch (target_arch.GetTriple().getOS())
+ case llvm::Triple::Linux:
+ switch (target_arch.GetCore())
{
- case llvm::Triple::FreeBSD:
- reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
- break;
- case llvm::Triple::Linux:
+ case ArchSpec::eCore_x86_32_i386:
+ case ArchSpec::eCore_x86_32_i486:
+ case ArchSpec::eCore_x86_32_i486sx:
+ case ArchSpec::eCore_x86_64_x86_64:
if (Host::GetArchitecture().GetAddressByteSize() == 4)
{
// 32-bit hosts run with a RegisterContextLinux_i386 context.
@@ -203,21 +197,35 @@
}
break;
default:
- assert(false && "OS not supported");
break;
}
- if (reg_interface)
+ default:
+ break;
+ }
+
+ assert(reg_interface && "OS or CPU not supported!");
+
+ switch (target_arch.GetCore())
+ {
+ case ArchSpec::eCore_mips64:
+ {
+ RegisterContextPOSIXProcessMonitor_mips64 *reg_ctx = new RegisterContextPOSIXProcessMonitor_mips64(*this, 0, reg_interface);
+ m_posix_thread = reg_ctx;
+ m_reg_context_sp.reset(reg_ctx);
+ break;
+ }
+ case ArchSpec::eCore_x86_32_i386:
+ case ArchSpec::eCore_x86_32_i486:
+ case ArchSpec::eCore_x86_32_i486sx:
+ case ArchSpec::eCore_x86_64_x86_64:
{
RegisterContextPOSIXProcessMonitor_x86_64 *reg_ctx = new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, reg_interface);
m_posix_thread = reg_ctx;
m_reg_context_sp.reset(reg_ctx);
+ break;
}
- break;
- }
-
default:
- assert(false && "CPU type not supported!");
break;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2765.4.patch
Type: text/x-patch
Size: 4367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140228/7592057d/attachment.bin>
More information about the lldb-commits
mailing list