Skip to content

Commit 4a0ec7d

Browse files
committed
[JSC][armv7] Use udf for break/breakpoint in offlineasm/masm
https://bugs.webkit.org/show_bug.cgi?id=263322 Reviewed by Yusuke Suzuki. `bkpt` behaves very badly under gdb on armv7; it hangs [1] rather than traps. To workaround, use `udf #0` instead; the encodings and semantics are very similar. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=22645 * Source/JavaScriptCore/assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::udf): * Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::breakpoint): * Source/JavaScriptCore/offlineasm/arm.rb: Canonical link: https://commits.webkit.org/269481@main
1 parent 129b13b commit 4a0ec7d

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Source/JavaScriptCore/assembler/ARMv7Assembler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ class ARMv7Assembler {
571571
OP_BKPT = 0xBE00,
572572
OP_IT = 0xBF00,
573573
OP_NOP_T1 = 0xBF00,
574+
OP_UDF = 0xDE00
574575
} OpcodeID;
575576

576577
typedef enum {
@@ -1008,6 +1009,11 @@ class ARMv7Assembler {
10081009
m_formatter.oneWordOp8Imm8(OP_BKPT, imm);
10091010
}
10101011

1012+
void udf(uint8_t imm = 0)
1013+
{
1014+
m_formatter.oneWordOp8Imm8(OP_UDF, imm);
1015+
}
1016+
10111017
static bool isBkpt(void* address)
10121018
{
10131019
unsigned short expected = OP_BKPT;

Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,7 @@ class MacroAssemblerARMv7 : public AbstractMacroAssembler<Assembler> {
26792679

26802680
void breakpoint(uint8_t imm = 0)
26812681
{
2682-
m_assembler.bkpt(imm);
2682+
m_assembler.udf(imm);
26832683
}
26842684

26852685
static bool isBreakpoint(void* address) { return ARMv7Assembler::isBkpt(address); }

Source/JavaScriptCore/llint/LowLevelInterpreter.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2753,7 +2753,7 @@ macro notSupported()
27532753
# smallest instructions exist, we should pick the one that is most
27542754
# likely result in execution being halted. Currently that is the break
27552755
# instruction on all architectures we're interested in. (Break is int3
2756-
# on Intel, which is 1 byte, and bkpt on ARMv7, which is 2 bytes.)
2756+
# on Intel, which is 1 byte, and udf on ARMv7, which is 2 bytes.)
27572757
break
27582758
end
27592759
end

Source/JavaScriptCore/offlineasm/arm.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ def lowerARMCommon
833833
$asm.puts "blx #{operands[0].armOperand}"
834834
end
835835
when "break"
836-
$asm.puts "bkpt #0"
836+
$asm.puts "udf #0"
837837
when "ret"
838838
$asm.puts "bx lr"
839839
when "cieq", "cpeq", "cbeq"

0 commit comments

Comments
 (0)