diff options
Diffstat (limited to 'source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp')
-rw-r--r-- | source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp | 77 |
1 files changed, 12 insertions, 65 deletions
diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 9b3c57501117..83c9247f4682 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -614,84 +614,31 @@ PlatformFreeBSD::GetStatus (Stream &strm) size_t PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site) { - ArchSpec arch = target.GetArchitecture(); - const uint8_t *trap_opcode = NULL; - size_t trap_opcode_size = 0; - - switch (arch.GetMachine()) + switch (target.GetArchitecture().GetMachine()) { - default: - assert(false && "Unhandled architecture in PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode()"); - break; - case llvm::Triple::aarch64: - { - static const uint8_t g_aarch64_opcode[] = { 0x00, 0x00, 0x20, 0xd4 }; - trap_opcode = g_aarch64_opcode; - trap_opcode_size = sizeof(g_aarch64_opcode); - } - break; - // TODO: support big-endian arm and thumb trap codes. case llvm::Triple::arm: { - static const uint8_t g_arm_breakpoint_opcode[] = { 0xfe, 0xde, 0xff, 0xe7 }; - static const uint8_t g_thumb_breakpoint_opcode[] = { 0x01, 0xde }; - - lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0)); + lldb::BreakpointLocationSP bp_loc_sp(bp_site->GetOwnerAtIndex(0)); AddressClass addr_class = eAddressClassUnknown; if (bp_loc_sp) - addr_class = bp_loc_sp->GetAddress ().GetAddressClass (); + { + addr_class = bp_loc_sp->GetAddress().GetAddressClass(); + if (addr_class == eAddressClassUnknown && (bp_loc_sp->GetAddress().GetFileAddress() & 1)) + addr_class = eAddressClassCodeAlternateISA; + } - if (addr_class == eAddressClassCodeAlternateISA - || (addr_class == eAddressClassUnknown && (bp_site->GetLoadAddress() & 1))) + if (addr_class == eAddressClassCodeAlternateISA) { // TODO: Enable when FreeBSD supports thumb breakpoints. // FreeBSD kernel as of 10.x, does not support thumb breakpoints - trap_opcode = g_thumb_breakpoint_opcode; - trap_opcode_size = 0; - } - else - { - trap_opcode = g_arm_breakpoint_opcode; - trap_opcode_size = sizeof(g_arm_breakpoint_opcode); + return 0; } } - break; - case llvm::Triple::mips64: - { - static const uint8_t g_hex_opcode[] = { 0x00, 0x00, 0x00, 0x0d }; - trap_opcode = g_hex_opcode; - trap_opcode_size = sizeof(g_hex_opcode); - } - break; - case llvm::Triple::mips64el: - { - static const uint8_t g_hex_opcode[] = { 0x0d, 0x00, 0x00, 0x00 }; - trap_opcode = g_hex_opcode; - trap_opcode_size = sizeof(g_hex_opcode); - } - break; - case llvm::Triple::ppc: - case llvm::Triple::ppc64: - { - static const uint8_t g_ppc_opcode[] = { 0x7f, 0xe0, 0x00, 0x08 }; - trap_opcode = g_ppc_opcode; - trap_opcode_size = sizeof(g_ppc_opcode); - } - break; - case llvm::Triple::x86: - case llvm::Triple::x86_64: - { - static const uint8_t g_i386_opcode[] = { 0xCC }; - trap_opcode = g_i386_opcode; - trap_opcode_size = sizeof(g_i386_opcode); - } - break; + LLVM_FALLTHROUGH; + default: + return Platform::GetSoftwareBreakpointTrapOpcode(target, bp_site); } - - if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size)) - return trap_opcode_size; - return 0; } |