]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: improve the annotation of debugCallV2 for arm64
authoreric fang <eric.fang@arm.com>
Wed, 27 Apr 2022 02:42:01 +0000 (02:42 +0000)
committerEric Fang <eric.fang@arm.com>
Wed, 4 May 2022 03:08:40 +0000 (03:08 +0000)
This CL improves the annotation documentation of the debugCallV2 function
for arm64.

Change-Id: Icc2b52063cf4fe779071039d6a3bca1951108eb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/402514
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/runtime/asm_arm64.s

index 956910f6ce7642ab467da1ee930598acdbd26761..8310c2ca10853e3285d02c64966322854b74d2ae 100644 (file)
@@ -1272,9 +1272,12 @@ GLOBL    debugCallFrameTooLarge<>(SB), RODATA, $20       // Size duplicated below
 // If the goroutine is in any other state, it's not safe to inject a call.
 //
 // This function communicates back to the debugger by setting R20 and
-// invoking BRK to raise a breakpoint signal. See the comments in the
-// implementation for the protocol the debugger is expected to
-// follow. InjectDebugCall in the runtime tests demonstrates this protocol.
+// invoking BRK to raise a breakpoint signal. Note that the signal PC of
+// the signal triggered by the BRK instruction is the PC where the signal
+// is trapped, not the next PC, so to resume execution, the debugger needs
+// to set the signal PC to PC+4. See the comments in the implementation for
+// the protocol the debugger is expected to follow. InjectDebugCall in the
+// runtime tests demonstrates this protocol.
 //
 // The debugger must ensure that any pointers passed to the function
 // obey escape analysis requirements. Specifically, it must not pass
@@ -1332,13 +1335,14 @@ good:
        // Once the frame is allocated, this will set R20 to 0 and
        // invoke BRK. The debugger should write the argument
        // frame for the call at SP+8, set up argument registers,
-       // set the lr as the signal PC + 4, set the PC to the function
+       // set the LR as the signal PC + 4, set the PC to the function
        // to call, set R26 to point to the closure (if a closure call),
        // and resume execution.
        //
        // If the function returns, this will set R20 to 1 and invoke
        // BRK. The debugger can then inspect any return value saved
-       // on the stack at SP+8 and in registers and resume execution again.
+       // on the stack at SP+8 and in registers. To resume execution,
+       // the debugger should restore the LR from (SP).
        //
        // If the function panics, this will set R20 to 2 and invoke BRK.
        // The interface{} value of the panic will be at SP+8. The debugger