Skip to content

Commit 06f0d9f

Browse files
qmuntaljproberts
authored andcommitted
runtime: fix runtime.Breakpoint() on windows/arm64
Fixes golang#53837 Change-Id: I4219fe35aac1a88aae2905998fbb1d7db87bbfb2 Reviewed-on: https://go-review.googlesource.com/c/go/+/418734 Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Alessandro Arzilli <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Alessandro Arzilli <[email protected]>
1 parent 5137e24 commit 06f0d9f

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/runtime/asm_arm64.s

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,18 @@ nocgo:
107107
DATA runtime·mainPC+0(SB)/8,$runtime·main<ABIInternal>(SB)
108108
GLOBL runtime·mainPC(SB),RODATA,$8
109109

110+
// Windows ARM64 needs an immediate 0xf000 argument.
111+
// See go.dev/issues/53837.
112+
#define BREAK \
113+
#ifdef GOOS_windows \
114+
BRK $0xf000 \
115+
#else \
116+
BRK \
117+
#endif \
118+
119+
110120
TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
111-
BRK
121+
BREAK
112122
RET
113123

114124
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
@@ -1325,7 +1335,7 @@ TEXT runtime·debugCallV2<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-0
13251335
// Set R20 to 8 and invoke BRK. The debugger should get the
13261336
// reason a call can't be injected from SP+8 and resume execution.
13271337
MOVD $8, R20
1328-
BRK
1338+
BREAK
13291339
JMP restore
13301340

13311341
good:
@@ -1374,7 +1384,7 @@ good:
13741384
MOVD $20, R0
13751385
MOVD R0, 16(RSP) // length of debugCallFrameTooLarge string
13761386
MOVD $8, R20
1377-
BRK
1387+
BREAK
13781388
JMP restore
13791389

13801390
restore:
@@ -1383,7 +1393,7 @@ restore:
13831393
// Set R20 to 16 and invoke BRK. The debugger should restore
13841394
// all registers except for PC and RSP and resume execution.
13851395
MOVD $16, R20
1386-
BRK
1396+
BREAK
13871397
// We must not modify flags after this point.
13881398

13891399
// Restore pointer-containing registers, which may have been
@@ -1414,9 +1424,9 @@ restore:
14141424
TEXT NAME(SB),WRAPPER,$MAXSIZE-0; \
14151425
NO_LOCAL_POINTERS; \
14161426
MOVD $0, R20; \
1417-
BRK; \
1427+
BREAK; \
14181428
MOVD $1, R20; \
1419-
BRK; \
1429+
BREAK; \
14201430
RET
14211431
DEBUG_CALL_FN(debugCall32<>, 32)
14221432
DEBUG_CALL_FN(debugCall64<>, 64)
@@ -1439,7 +1449,7 @@ TEXT runtime·debugCallPanicked(SB),NOSPLIT,$16-16
14391449
MOVD val_data+8(FP), R0
14401450
MOVD R0, 16(RSP)
14411451
MOVD $2, R20
1442-
BRK
1452+
BREAK
14431453
RET
14441454

14451455
// Note: these functions use a special calling convention to save generated code space.

0 commit comments

Comments
 (0)