
According to #1800 #1584 #1038, `dlv` should enable the user to dive into memory. User can print binary data in specific memory address range. But not support for sepecific variable name or structures temporarily.(Because I have no idea that modify `print` command.) Close #1584.
26 lines
308 B
Go
26 lines
308 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"unsafe"
|
|
)
|
|
|
|
func main() {
|
|
l := int(51)
|
|
bs := make([]byte, l)
|
|
for i := 0; i < l; i++ {
|
|
bs[i] = byte(i + int(10))
|
|
}
|
|
|
|
bsp := (*byte)(unsafe.Pointer(&bs[0]))
|
|
|
|
bspUintptr := uintptr(unsafe.Pointer(bsp))
|
|
|
|
fmt.Printf("%#x\n", bspUintptr)
|
|
_ = *bsp
|
|
|
|
bs[0] = 255
|
|
|
|
_ = *bsp
|
|
}
|