Author: jmolenda Date: Mon Oct 27 22:43:54 2014 New Revision: 220762 URL: http://llvm.org/viewvc/llvm-project?rev=220762&view=rev Log: Add breakpoint instruction byte sequences for arm to PlatformLinux::GetSoftwareBreakpointTrapOpcode.
Patch by Stephane Sezer. http://reviews.llvm.org/D5923 Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp 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=220762&r1=220761&r2=220762&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original) +++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Mon Oct 27 22:43:54 2014 @@ -21,6 +21,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" @@ -534,6 +535,33 @@ PlatformLinux::GetSoftwareBreakpointTrap trap_opcode_size = sizeof(g_hex_opcode); } break; + case llvm::Triple::arm: + { + // The ARM reference recommends the use of 0xe7fddefe and 0xdefe + // but the linux kernel does otherwise. + static const uint8_t g_arm_breakpoint_opcode[] = { 0xf0, 0x01, 0xf0, 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_loc_sp->GetAddress().GetOffset() & 1)) + { + trap_opcode = g_thumb_breakpoint_opcode; + trap_opcode_size = sizeof(g_thumb_breakpoint_opcode); + } + else + { + trap_opcode = g_arm_breakpoint_opcode; + trap_opcode_size = sizeof(g_arm_breakpoint_opcode); + } + } + break; } if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size)) _______________________________________________ lldb-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
