Skip to content

Instantly share code, notes, and snippets.

@dr2chase
Created June 15, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dr2chase/63fbe3d2275811ddde733438624c462e to your computer and use it in GitHub Desktop.
Save dr2chase/63fbe3d2275811ddde733438624c462e to your computer and use it in GitHub Desktop.
Expected output debugging duffsteptest.go
dlv debug
Type 'help' for list of commands.
(dlv) b main.foo
Breakpoint 1 set at 0x2058 for main.foo() ./code.go:14
(dlv) c
> main.foo() ./code.go:14 (hits goroutine(1):1 total:1) (PC: 0x2058)
9: // Expect to be stopped in fmt.Printf or runtime.duffzero
10: import "fmt"
11:
12: var v int = 99
13:
=> 14: func foo(x, y int) (z int) { // c goes here
15: fmt.Printf("x=%d, y=%d, z=%d\n", x, y, z) // s #1 goes here
16: z = x + y
17: return
18: }
19:
(dlv) s
> main.foo() ./code.go:15 (PC: 0x2087)
10: import "fmt"
11:
12: var v int = 99
13:
14: func foo(x, y int) (z int) { // c goes here
=> 15: fmt.Printf("x=%d, y=%d, z=%d\n", x, y, z) // s #1 goes here
16: z = x + y
17: return
18: }
19:
20: func main() {
(dlv) s
> runtime.duffzero() /Users/drchase/GoogleDrive/work/go/src/runtime/duff_amd64.s:99 (PC: 0x51b10)
94: MOVUPS X0,32(DI)
95: MOVUPS X0,48(DI)
96: ADDQ $64,DI
97:
98: MOVUPS X0,(DI)
=> 99: MOVUPS X0,16(DI)
100: MOVUPS X0,32(DI)
101: MOVUPS X0,48(DI)
102: ADDQ $64,DI
103:
104: RET
(dlv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment