[Lldb-commits] [PATCH] D16853: Use BKPT instead of UDF for arm/thumb breakpoints

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 3 06:46:49 PST 2016


tberghammer created this revision.
tberghammer added reviewers: clayborg, omjavaid.
tberghammer added a subscriber: lldb-commits.
Herald added subscribers: rengolin, aemerson.

Use BKPT instead of UDF for arm/thumb breakpoints

The UDF instruction is deprecated in armv7 and in case of thumb2 instructions set it don't work well together with the IT instruction.

http://reviews.llvm.org/D16853

Files:
  source/Plugins/Platform/Linux/PlatformLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1294,8 +1294,10 @@
             break;
         }
 
-        // Otherwise, report step over
-        MonitorTrace(thread);
+        if (m_arch.GetMachine() == llvm::Triple::arm)
+            MonitorBreakpoint(thread); // Arm linux reports trace for breakpoint hits
+        else
+            MonitorTrace(thread); // Report the trace
         break;
     }
 
@@ -2289,13 +2291,11 @@
     // 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 };
-    // 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_arm_breakpoint_opcode[] = { 0x70, 0x00, 0x20, 0xe1 };
     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[] = { 0x01, 0xde };
+    static const uint8_t g_thumb_breakpoint_opcode[] = { 0x00, 0xbe };
 
     switch (m_arch.GetMachine ())
     {
Index: source/Plugins/Platform/Linux/PlatformLinux.cpp
===================================================================
--- source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -560,10 +560,8 @@
         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 };
+            static const uint8_t g_arm_breakpoint_opcode[] = { 0x70, 0x00, 0x20, 0xe1 };
+            static const uint8_t g_thumb_breakpoint_opcode[] = { 0x00, 0xbe };
 
             lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0));
             AddressClass addr_class = eAddressClassUnknown;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16853.46782.patch
Type: text/x-patch
Size: 2418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160203/f905633e/attachment.bin>


More information about the lldb-commits mailing list