[Lldb-commits] [PATCH] Refactor POSIXThread::GetRegisterContext and use i386 register context
Ed Maste
emaste at freebsd.org
Thu Feb 13 07:33:42 PST 2014
Hi tfiala,
Issue discovered by Matthew Gardiner in http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-February/003311.html
http://llvm-reviews.chandlerc.com/D2765
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
@@ -157,48 +157,65 @@
reg_interface = new RegisterContextFreeBSD_mips64(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::FreeBSD:
- reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
+ reg_interface = new RegisterContextFreeBSD_i386(target_arch);
break;
case llvm::Triple::Linux:
- reg_interface = new RegisterContextLinux_x86_64(target_arch);
+ reg_interface = new RegisterContextLinux_i386(target_arch);
break;
default:
- assert(false && "OS not supported");
break;
}
+ }
- if (reg_interface)
+ case ArchSpec::eCore_x86_64_x86_64:
+ {
+ switch (target_arch.GetTriple().getOS())
{
- 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);
+ case llvm::Triple::FreeBSD:
+ reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
+ break;
+ case llvm::Triple::Linux:
+ reg_interface = new RegisterContextLinux_x86_64(target_arch);
+ break;
+ default:
+ break;
}
- break;
}
+ default:
+ break;
+ }
+ assert(reg_interface && "CPU type or OS 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);
+ }
+ 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);
+ }
default:
- assert(false && "CPU type not supported!");
break;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2765.1.patch
Type: text/x-patch
Size: 3768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140213/40f768a1/attachment.bin>
More information about the lldb-commits
mailing list