From 2afc5966673cde0551e0e8d7571c8a9d921ac380 Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Thu, 21 Aug 2014 16:42:31 +0000 Subject: [PATCH] Add software breakpoint support for Linux aarch64. See http://reviews.llvm.org/D4969 for details. Change by Paul Osmialowski. llvm-svn: 216188 --- lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp | 7 +++++++ .../Plugins/Process/Linux/NativeProcessLinux.cpp | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index a717c85a1eda..74d4ca16a9f7 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -421,6 +421,13 @@ PlatformLinux::GetSoftwareBreakpointTrapOpcode (Target &target, assert(false && "CPU type not supported!"); 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; case llvm::Triple::x86: case llvm::Triple::x86_64: { diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 2cd0a1388830..f004a8e85398 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2921,10 +2921,15 @@ NativeProcessLinux::GetSoftwareBreakpointSize (NativeRegisterContextSP context_s { // FIXME put this behind a breakpoint protocol class that can be // set per architecture. Need ARM, MIPS support here. + static const uint8_t g_aarch64_opcode[] = { 0x00, 0x00, 0x20, 0xd4 }; static const uint8_t g_i386_opcode [] = { 0xCC }; switch (m_arch.GetMachine ()) { + case llvm::Triple::aarch64: + actual_opcode_size = static_cast (sizeof(g_aarch64_opcode)); + return Error (); + case llvm::Triple::x86: case llvm::Triple::x86_64: actual_opcode_size = static_cast (sizeof(g_i386_opcode)); @@ -2950,10 +2955,16 @@ NativeProcessLinux::GetSoftwareBreakpointTrapOpcode (size_t trap_opcode_size_hin { // FIXME put this behind a breakpoint protocol class that can be // set per architecture. Need ARM, MIPS support here. + static const uint8_t g_aarch64_opcode[] = { 0x00, 0x00, 0x20, 0xd4 }; static const uint8_t g_i386_opcode [] = { 0xCC }; switch (m_arch.GetMachine ()) { + case llvm::Triple::aarch64: + trap_opcode_bytes = g_aarch64_opcode; + actual_opcode_size = sizeof(g_aarch64_opcode); + return Error (); + case llvm::Triple::x86: case llvm::Triple::x86_64: trap_opcode_bytes = g_i386_opcode;