diff options
author | Greg Clayton <gclayton@apple.com> | 2010-06-11 03:25:34 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-06-11 03:25:34 +0000 |
commit | 41f923275eb15ac0b2fc9442f272fd6e4ed8f12a (patch) | |
tree | 51ee99af424e6a63af024889f2550151c3d5957e /lldb/source/Plugins/Process/gdb-remote | |
parent | 9af2d4a6141c4bad8a9e53912469b5ff13079464 (diff) | |
download | bcm5719-llvm-41f923275eb15ac0b2fc9442f272fd6e4ed8f12a.tar.gz bcm5719-llvm-41f923275eb15ac0b2fc9442f272fd6e4ed8f12a.zip |
Made lldb_private::ArchSpec more generic so that it can take a mach-o cpu
type and sub-type, or an ELF e_machine value. Also added a generic CPU type
to the arch spec class so we can have a single arch definition that the LLDB
core code can use. Previously a lot of places in the code were using the
mach-o definitions from a macosx header file.
Switches over to using "llvm/Support/MachO.h" for the llvm::MachO::XXX for the
CPU types and sub types for mach-o ArchSpecs. Added "llvm/Support/ELF.h" so
we can use the "llvm::ELF::XXX" defines for the ELF ArchSpecs.
Got rid of all CPU_TYPE_ and CPU_SUBTYPE_ defines that were previously being
used in LLDB.
llvm-svn: 105806
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index e8b194e26de..8bf90c2c22b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -875,31 +875,32 @@ ProcessGDBRemote::GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site) static const uint8_t g_ppc_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 }; static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC }; - switch (m_arch_spec.GetCPUType()) + ArchSpec::CPU arch_cpu = m_arch_spec.GetGenericCPUType(); + switch (arch_cpu) { - case CPU_TYPE_ARM: - // TODO: fill this in for ARM. We need to dig up the symbol for - // the address in the breakpoint locaiton and figure out if it is - // an ARM or Thumb breakpoint. - trap_opcode = g_arm_breakpoint_opcode; - trap_opcode_size = sizeof(g_arm_breakpoint_opcode); - break; - - case CPU_TYPE_POWERPC: - case CPU_TYPE_POWERPC64: - trap_opcode = g_ppc_breakpoint_opcode; - trap_opcode_size = sizeof(g_ppc_breakpoint_opcode); - break; - - case CPU_TYPE_I386: - case CPU_TYPE_X86_64: - trap_opcode = g_i386_breakpoint_opcode; - trap_opcode_size = sizeof(g_i386_breakpoint_opcode); - break; - - default: - assert(!"Unhandled architecture in ProcessGDBRemote::GetSoftwareBreakpointTrapOpcode()"); - return 0; + case ArchSpec::eCPU_i386: + case ArchSpec::eCPU_x86_64: + trap_opcode = g_i386_breakpoint_opcode; + trap_opcode_size = sizeof(g_i386_breakpoint_opcode); + break; + + case ArchSpec::eCPU_arm: + // TODO: fill this in for ARM. We need to dig up the symbol for + // the address in the breakpoint locaiton and figure out if it is + // an ARM or Thumb breakpoint. + trap_opcode = g_arm_breakpoint_opcode; + trap_opcode_size = sizeof(g_arm_breakpoint_opcode); + break; + + case ArchSpec::eCPU_ppc: + case ArchSpec::eCPU_ppc64: + trap_opcode = g_ppc_breakpoint_opcode; + trap_opcode_size = sizeof(g_ppc_breakpoint_opcode); + break; + + default: + assert(!"Unhandled architecture in ProcessMacOSX::GetSoftwareBreakpointTrapOpcode()"); + break; } if (trap_opcode && trap_opcode_size) @@ -1719,16 +1720,19 @@ ProcessGDBRemote::StartDebugserverProcess // We don't need to do this for ARM, and we really shouldn't now that we // have multiple CPU subtypes and no posix_spawnattr call that allows us // to set which CPU subtype to launch... - cpu_type_t cpu = inferior_arch.GetCPUType(); - if (cpu != 0 && cpu != CPU_TYPE_ANY && cpu != LLDB_INVALID_CPUTYPE) + if (inferior_arch.GetType() == eArchTypeMachO) { - size_t ocount = 0; - error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX); - if (error.Fail() || log) - error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount); + cpu_type_t cpu = inferior_arch.GetCPUType(); + if (cpu != 0 && cpu != UINT32_MAX && cpu != LLDB_INVALID_CPUTYPE) + { + size_t ocount = 0; + error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX); + if (error.Fail() || log) + error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount); - if (error.Fail() != 0 || ocount != 1) - return error; + if (error.Fail() != 0 || ocount != 1) + return error; + } } #endif @@ -2175,9 +2179,11 @@ lldb_private::unw_addr_space_t ProcessGDBRemote::GetLibUnwindAddressSpace () { unw_targettype_t target_type = UNW_TARGET_UNSPECIFIED; - if (m_target.GetArchitecture().GetCPUType() == CPU_TYPE_I386) + + ArchSpec::CPU arch_cpu = m_target.GetArchitecture().GetGenericCPUType(); + if (arch_cpu == ArchSpec::eCPU_i386) target_type = UNW_TARGET_I386; - if (m_target.GetArchitecture().GetCPUType() == CPU_TYPE_X86_64) + else if (arch_cpu == ArchSpec::eCPU_x86_64) target_type = UNW_TARGET_X86_64; if (m_libunwind_addr_space) |