You might have assumed that you are done dealing with the syscall standard Go package, but you are mistaken! In this section, we will work with syscall.PtraceRegs, which is a structure that holds information about the state of the registers.
You will now learn how to print the values of all of the following registers on your screen using the Go code of ptraceRegs.go, which will be presented in four parts. The star of the ptraceRegs.go utility is the syscall.PtraceGetRegs() function - there are also the syscall.PtraceSetRegs(), syscall.PtraceAttach(), syscall.PtracePeekData(), and syscall.PtracePokeData() functions that can help you to work with registers, but these functions will not be used in ptraceRegs.go.
The first part of the ptraceRegs.go utility follows:
package main import ( "fmt" "os" "os/exec" ...