Add thumb breakpoint for FreeBSD (currently disabled)

Patch by Tom Rix, with additional changes to sync whitespace/style with
PlatformLinux.cpp.

It is currently disabled pending kernel support.

Differential Revision:	http://reviews.llvm.org/D9170

llvm-svn: 238420
This commit is contained in:
Ed Maste 2015-05-28 13:06:09 +00:00
parent e08537f3ea
commit 3d3c60117f
1 changed files with 24 additions and 3 deletions

View File

@ -21,6 +21,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/BreakpointSite.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Debugger.h"
@ -630,11 +631,31 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite
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_opcode[] = { 0xfe, 0xde, 0xff, 0xe7 };
trap_opcode = g_arm_opcode;
trap_opcode_size = sizeof(g_arm_opcode);
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));
AddressClass addr_class = eAddressClassUnknown;
if (bp_loc_sp)
addr_class = bp_loc_sp->GetAddress ().GetAddressClass ();
if (addr_class == eAddressClassCodeAlternateISA
|| (addr_class == eAddressClassUnknown && (bp_site->GetLoadAddress() & 1)))
{
// 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);
}
}
break;
case llvm::Triple::mips64: