[Lldb-commits] [lldb] r204400 - Switch over to use the ArchSpec::GetMachine() instead of ArchSpec::GetCore() to keep the code more portable as we add new core types to ArchSpec.
Greg Clayton
gclayton at apple.com
Thu Mar 20 14:31:56 PDT 2014
Author: gclayton
Date: Thu Mar 20 16:31:55 2014
New Revision: 204400
URL: http://llvm.org/viewvc/llvm-project?rev=204400&view=rev
Log:
Switch over to use the ArchSpec::GetMachine() instead of ArchSpec::GetCore() to keep the code more portable as we add new core types to ArchSpec.
Modified:
lldb/trunk/source/Core/DataExtractor.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Thu Mar 20 16:31:55 2014
@@ -1823,13 +1823,10 @@ DataExtractor::Dump (Stream *s,
else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy))
{
llvm::APInt apint;
- switch (target_sp->GetArchitecture().GetCore())
+ switch (target_sp->GetArchitecture().GetMachine())
{
- 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:
- case ArchSpec::eCore_x86_64_x86_64h:
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
// clang will assert when contructing the apfloat if we use a 16 byte integer value
if (GetAPInt (*this, &offset, 10, apint))
{
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Thu Mar 20 16:31:55 2014
@@ -305,15 +305,13 @@ PlatformFreeBSD::GetSoftwareBreakpointTr
const uint8_t *trap_opcode = NULL;
size_t trap_opcode_size = 0;
- switch (arch.GetCore())
+ switch (arch.GetMachine())
{
default:
assert(false && "Unhandled architecture in PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode()");
break;
-
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_64_x86_64:
- case ArchSpec::eCore_x86_64_x86_64h:
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
{
static const uint8_t g_i386_opcode[] = { 0xCC };
trap_opcode = g_i386_opcode;
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Thu Mar 20 16:31:55 2014
@@ -382,22 +382,21 @@ PlatformLinux::GetSoftwareBreakpointTrap
const uint8_t *trap_opcode = NULL;
size_t trap_opcode_size = 0;
- switch (arch.GetCore())
+ switch (arch.GetMachine())
{
default:
assert(false && "CPU type not supported!");
break;
-
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_64_x86_64:
- case ArchSpec::eCore_x86_64_x86_64h:
+
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
{
static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
trap_opcode = g_i386_breakpoint_opcode;
trap_opcode_size = sizeof(g_i386_breakpoint_opcode);
}
break;
- case ArchSpec::eCore_hexagon_generic:
+ case llvm::Triple::hexagon:
return 0;
}
Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Thu Mar 20 16:31:55 2014
@@ -279,11 +279,10 @@ PlatformWindows::GetSoftwareBreakpointTr
const uint8_t *trap_opcode = NULL;
size_t trap_opcode_size = 0;
- switch (arch.GetCore())
+ switch (arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_64_x86_64:
- case ArchSpec::eCore_x86_64_x86_64h:
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
{
static const uint8_t g_i386_opcode[] = { 0xCC };
trap_opcode = g_i386_opcode;
@@ -291,7 +290,7 @@ PlatformWindows::GetSoftwareBreakpointTr
}
break;
- case ArchSpec::eCore_hexagon_generic:
+ case llvm::Triple::hexagon:
return 0;
default:
llvm_unreachable("Unhandled architecture in PlatformWindows::GetSoftwareBreakpointTrapOpcode()");
Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Thu Mar 20 16:31:55 2014
@@ -159,17 +159,15 @@ POSIXThread::GetRegisterContext()
switch (target_arch.GetTriple().getOS())
{
case llvm::Triple::FreeBSD:
- switch (target_arch.GetCore())
+ switch (target_arch.GetMachine())
{
- case ArchSpec::eCore_mips64:
+ case llvm::Triple::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:
+ case llvm::Triple::x86:
reg_interface = new RegisterContextFreeBSD_i386(target_arch);
break;
- case ArchSpec::eCore_x86_64_x86_64:
+ case llvm::Triple::X86_64:
reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
break;
default:
@@ -178,12 +176,10 @@ POSIXThread::GetRegisterContext()
break;
case llvm::Triple::Linux:
- switch (target_arch.GetCore())
+ switch (target_arch.GetMachine())
{
- 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:
+ case llvm::Triple::x86:
+ case llvm::Triple::X86_64:
if (Host::GetArchitecture().GetAddressByteSize() == 4)
{
// 32-bit hosts run with a RegisterContextLinux_i386 context.
@@ -206,19 +202,17 @@ POSIXThread::GetRegisterContext()
assert(reg_interface && "OS or CPU not supported!");
- switch (target_arch.GetCore())
+ switch (target_arch.GetMachine())
{
- case ArchSpec::eCore_mips64:
+ case llvm::Triple::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:
+ case llvm::Triple::x86:
+ case llvm::Triple::X86_64:
{
RegisterContextPOSIXProcessMonitor_x86_64 *reg_ctx = new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, reg_interface);
m_posix_thread = reg_ctx;
@@ -609,17 +603,15 @@ POSIXThread::GetRegisterIndexFromOffset(
unsigned reg = LLDB_INVALID_REGNUM;
ArchSpec arch = Host::GetArchitecture();
- switch (arch.GetCore())
+ switch (arch.GetMachine())
{
default:
llvm_unreachable("CPU type not supported!");
break;
- case ArchSpec::eCore_mips64:
- 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:
+ case llvm::Triple::mips64:
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
{
POSIXBreakpointProtocol* reg_ctx = GetPOSIXBreakpointProtocol();
reg = reg_ctx->GetRegisterIndexFromOffset(offset);
@@ -641,17 +633,15 @@ POSIXThread::GetRegisterName(unsigned re
const char * name = nullptr;
ArchSpec arch = Host::GetArchitecture();
- switch (arch.GetCore())
+ switch (arch.GetMachine())
{
default:
assert(false && "CPU type not supported!");
break;
- case ArchSpec::eCore_mips64:
- 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:
+ case llvm::Triple::mips64:
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
name = GetRegisterContext()->GetRegisterName(reg);
break;
}
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Thu Mar 20 16:31:55 2014
@@ -643,14 +643,14 @@ ProcessPOSIX::GetSoftwareBreakpointTrapO
const uint8_t *opcode = NULL;
size_t opcode_size = 0;
- switch (arch.GetCore())
+ switch (arch.GetMachine())
{
default:
assert(false && "CPU type not supported!");
break;
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_64_x86_64:
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
opcode = g_i386_opcode;
opcode_size = sizeof(g_i386_opcode);
break;
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp Thu Mar 20 16:31:55 2014
@@ -75,11 +75,9 @@ RegisterContextFreeBSD_i386::GetGPRSize(
const RegisterInfo *
RegisterContextFreeBSD_i386::GetRegisterInfo()
{
- switch (m_target_arch.GetCore())
+ switch (m_target_arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
+ case llvm::Triple::x86:
return g_register_infos_i386;
default:
assert(false && "Unhandled target architecture.");
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp Thu Mar 20 16:31:55 2014
@@ -110,13 +110,11 @@ RegisterContextFreeBSD_x86_64::GetGPRSiz
const RegisterInfo *
RegisterContextFreeBSD_x86_64::GetRegisterInfo()
{
- switch (m_target_arch.GetCore())
+ switch (m_target_arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
+ case llvm::Triple::x86:
return GetRegisterInfo_i386 (m_target_arch);
- case ArchSpec::eCore_x86_64_x86_64:
+ case llvm::Triple::x86_64:
return g_register_infos_x86_64;
default:
assert(false && "Unhandled target architecture.");
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Thu Mar 20 16:31:55 2014
@@ -113,11 +113,9 @@ RegisterContextLinux_i386::GetGPRSize()
const RegisterInfo *
RegisterContextLinux_i386::GetRegisterInfo()
{
- switch (m_target_arch.GetCore())
+ switch (m_target_arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
+ case llvm::Triple::x86:
return g_register_infos_i386;
default:
assert(false && "Unhandled target architecture.");
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp Thu Mar 20 16:31:55 2014
@@ -123,13 +123,11 @@ RegisterContextLinux_x86_64::GetGPRSize(
const RegisterInfo *
RegisterContextLinux_x86_64::GetRegisterInfo()
{
- switch (m_target_arch.GetCore())
+ switch (m_target_arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
+ case llvm::Triple::x86:
return GetRegisterInfo_i386 (m_target_arch);
- case ArchSpec::eCore_x86_64_x86_64:
+ case llvm::Triple::x86_64:
return g_register_infos_x86_64;
default:
assert(false && "Unhandled target architecture.");
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp?rev=204400&r1=204399&r2=204400&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp Thu Mar 20 16:31:55 2014
@@ -383,11 +383,9 @@ RegisterContextPOSIX_x86::RegisterContex
{
m_register_info_ap.reset(register_info);
- switch (register_info->m_target_arch.GetCore())
+ switch (register_info->m_target_arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
+ case llvm::Triple::x86:
m_reg_info.num_registers = k_num_registers_i386;
m_reg_info.num_gpr_registers = k_num_gpr_registers_i386;
m_reg_info.num_fpr_registers = k_num_fpr_registers_i386;
@@ -406,7 +404,7 @@ RegisterContextPOSIX_x86::RegisterContex
m_reg_info.first_dr = dr0_i386;
m_reg_info.gpr_flags = gpr_eflags_i386;
break;
- case ArchSpec::eCore_x86_64_x86_64:
+ case llvm::Triple::x86_64:
m_reg_info.num_registers = k_num_registers_x86_64;
m_reg_info.num_gpr_registers = k_num_gpr_registers_x86_64;
m_reg_info.num_fpr_registers = k_num_fpr_registers_x86_64;
@@ -536,13 +534,11 @@ RegisterContextPOSIX_x86::GetRegisterSet
{
if (IsRegisterSetAvailable(set))
{
- switch (m_register_info_ap->m_target_arch.GetCore())
+ switch (m_register_info_ap->m_target_arch.GetMachine())
{
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
+ case llvm::Triple::x86:
return &g_reg_sets_i386[set];
- case ArchSpec::eCore_x86_64_x86_64:
+ case llvm::Triple::x86_64:
return &g_reg_sets_x86_64[set];
default:
assert(false && "Unhandled target architecture.");
More information about the lldb-commits
mailing list