Closed Bug 1451292 Opened 2 years ago Closed 2 years ago

GDB on ARM64 goes into infinite loop when hitting breakpoint instruction


(Core :: JavaScript Engine: JIT, enhancement)

Not set



Tracking Status
firefox61 --- fixed


(Reporter: decoder, Assigned: lth)



(1 file)

On ARM64, I noticed that GDB just spins forever when it hits a breakpoint instruction. Our MacroAssembler emits breakpoint instructions for assertions, so we need to change this behavior on ARM64 to emit a NULL-deref instead to allow automated testing with GDB to work properly.
Maybe slightly relevant, since symptoms are the same, even though the bug is reported for 32-bit ARM:
This appears to be caused by the payload that we put into the Brk instruction, we can only assume this means something special to gdb.  The instruction can carry a 16-bit immediate.  MacroAssembler::breakpoint() starts with the code equal to 0xA77; it increments this code after emitting the instruction; and then the payload in the instruction is set to (code & 0xFFFF).  When I change the code to zero, gdb stops as it's supposed to.

The current behavior dates back to the initial import of the arm64 support, nearly three years ago.

I did find the ability to have a code useful for some debugging work, but now that the back-end is up and running we can probably just pin it to zero.  Should there be a need to emit a different code the underlying instruction emitter that takes an explicit code will still be available.
Choose a breakpoint payload that makes gdb stop properly.
Attachment #8964919 - Flags: review?(sstangl)
Attachment #8964919 - Flags: review?(sstangl) → review+
Pushed by
Better payload for arm64 breakpoint instruction.  r=sstangl
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.