Hi everyone,

I wonder how can I single step into runtime code (presumably in Visual 
Studio Code). I don't think this problem ties to any specific version of 
Go, but for context I'm using 1.18.3 on Intel Mac.

What I want to do: given the source code, I want to track how map 
assignment happens thru the call chain.
```
package main

func main() {
    m := make(map[int]int)
    m[1] = 100
}
```
Current approach: I'm using Delve (version 1.9.0) and set a breakpoint on 
line 5 "m[1] = 100" statement. Then I can use step-instruction 
<https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#step-instruction>
 to 
navigate thru the assembly level code like
```
        map-example.go:4        0x105a979       8401                   
 test byte ptr [rcx], al
        map-example.go:4        0x105a97b       89410c                  mov 
dword ptr [rcx+0xc], eax
        map-example.go:4        0x105a97e       488d9c24c8000000        lea 
rbx, ptr [rsp+0xc8]
        map-example.go:4        0x105a986       48899c24a8000000        mov 
qword ptr [rsp+0xa8], rbx
        map-example.go:5        0x105a98e       488d05ab580000          lea 
rax, ptr [rip+0x58ab]
=>      map-example.go:5        0x105a995       b901000000              mov 
ecx, 0x1
        map-example.go:5        0x105a99a       e86142fbff             
 call $runtime.mapassign_fast64
        map-example.go:5        0x105a99f       48898424b0000000        mov 
qword ptr [rsp+0xb0], rax
        map-example.go:5        0x105a9a7       8400                   
 test byte ptr [rax], al
        map-example.go:5        0x105a9a9       48c70064000000          mov 
qword ptr [rax], 0x64
        map-example.go:6        0x105a9b0       488bac24f8000000        mov 
rbp, qword ptr [rsp+0xf8]
```
I've tried step 
<https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#step>
 function 
but I think it skips the built-in function and jumps to next line directly. 

Question: is there any other way to debug/track the runtime code other than 
assembly level.

Thanks for your time and I appreciate your help!

Best,
Chris

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/896ebff4-4145-4a05-b24d-94889677636dn%40googlegroups.com.

Reply via email to