[Lldb-commits] [lldb] r260969 - Revert "Use BKPT instead of UDF for arm/thumb breakpoints"

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 16 07:14:36 PST 2016


Author: tberghammer
Date: Tue Feb 16 09:14:36 2016
New Revision: 260969

URL: http://llvm.org/viewvc/llvm-project?rev=260969&view=rev
Log:
Revert "Use BKPT instead of UDF for arm/thumb breakpoints"

This reverts commit 293c18e067d663e0fe93e6f3d800c2a4bfada2b0.

The BKPT instruction generates SIGBUS instead of SIGTRAP in the Linux
kernel on Nexus 6 - 5.1.1 (kernel version 3.10.40). Revert the CL
until we can figure out how can we hanble the SIGBUS or how to get
back a SIGTRAP using the BKPT instruction.

Modified:
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.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=260969&r1=260968&r2=260969&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Tue Feb 16 09:14:36 2016
@@ -560,8 +560,10 @@ PlatformLinux::GetSoftwareBreakpointTrap
         break;
     case llvm::Triple::arm:
         {
-            static const uint8_t g_arm_breakpoint_opcode[] = { 0x70, 0xbe, 0x20, 0xe1 };
-            static const uint8_t g_thumb_breakpoint_opcode[] = { 0x70, 0xbe };
+            // 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;

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=260969&r1=260968&r2=260969&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Tue Feb 16 09:14:36 2016
@@ -1294,10 +1294,8 @@ NativeProcessLinux::MonitorSIGTRAP(const
             break;
         }
 
-        if (m_arch.GetMachine() == llvm::Triple::arm)
-            MonitorBreakpoint(thread); // Arm linux reports trace for breakpoint hits
-        else
-            MonitorTrace(thread); // Report the trace
+        // Otherwise, report step over
+        MonitorTrace(thread);
         break;
     }
 
@@ -2291,11 +2289,13 @@ NativeProcessLinux::GetSoftwareBreakpoin
     // FIXME put this behind a breakpoint protocol class that can be set per
     // architecture.  Need MIPS support here.
     static const uint8_t g_aarch64_opcode[] = { 0x00, 0x00, 0x20, 0xd4 };
-    static const uint8_t g_arm_breakpoint_opcode[] = { 0x70, 0xbe, 0x20, 0xe1 };
+    // 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_i386_opcode [] = { 0xCC };
     static const uint8_t g_mips64_opcode[] = { 0x00, 0x00, 0x00, 0x0d };
     static const uint8_t g_mips64el_opcode[] = { 0x0d, 0x00, 0x00, 0x00 };
-    static const uint8_t g_thumb_breakpoint_opcode[] = { 0x70, 0xbe };
+    static const uint8_t g_thumb_breakpoint_opcode[] = { 0x01, 0xde };
 
     switch (m_arch.GetMachine ())
     {




More information about the lldb-commits mailing list