Bug 1451292 - Better payload for arm64 breakpoint instruction. r=sstangl
authorLars T Hansen <lhansen@mozilla.com>
Wed, 04 Apr 2018 15:48:48 +0200
changeset 777885 236c11a47aa76a80072cef75cbd4971a55419413
parent 777884 e72d2ab40d64f67d61207a31093b38e09a7c92c1
child 777886 3c92c9b3f4db5550d2ede28138b1039bc4e93539
push id105320
push userbmo:dharvey@mozilla.com
push dateThu, 05 Apr 2018 13:17:43 +0000
Bug 1451292 - Better payload for arm64 breakpoint instruction. r=sstangl At least some non-zero payloads confuse GDB and make it iloop on the breakpoint instruction rather than break to the command line as it should. There seems to be no reason not to use a zero payload.
--- a/js/src/jit/arm64/MacroAssembler-arm64.cpp
+++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp
@@ -232,18 +232,19 @@ MacroAssemblerCompat::profilerEnterFrame
         storePtr(AsRegister(framePtr), Address(scratch, JitActivation::offsetOfLastProfilingFrame()));
     storePtr(ImmPtr(nullptr), Address(scratch, JitActivation::offsetOfLastProfilingCallSite()));
-    static int code = 0xA77;
-    Brk((code++) & 0xffff);
+    // Note, other payloads are possible, but GDB is known to misinterpret them
+    // sometimes and iloop on the breakpoint instead of stopping properly.
+    Brk(0);
 // Either `any` is valid or `sixtyfour` is valid.  Return a 32-bit ARMRegister
 // in the first case and an ARMRegister of the desired size in the latter case.
 static inline ARMRegister
 SelectGPReg(AnyRegister any, Register64 sixtyfour, unsigned size = 64)