func generatePtraceRegSet(arch string) error {
	f, err := os.Create(fmt.Sprintf("zptrace_linux_%s.go", arch))
	if err != nil {
		return err
	}
	buf := bufio.NewWriter(f)
	fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtraceRegSet(%q). DO NOT EDIT.\n", arch)
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "package unix\n")
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "%s\n", `import "unsafe"`)
	fmt.Fprintf(buf, "\n")
	uarch := string(unicode.ToUpper(rune(arch[0]))) + arch[1:]
	fmt.Fprintf(buf, "// PtraceGetRegSet%s fetches the registers used by %s binaries.\n", uarch, arch)
	fmt.Fprintf(buf, "func PtraceGetRegSet%s(pid, addr int, regsout *PtraceRegs%s) error {\n", uarch, uarch)
	fmt.Fprintf(buf, "\tiovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))}\n")
	fmt.Fprintf(buf, "\treturn ptrace(PTRACE_GETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))\n")
	fmt.Fprintf(buf, "}\n")
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "// PtraceSetRegSet%s sets the registers used by %s binaries.\n", uarch, arch)
	fmt.Fprintf(buf, "func PtraceSetRegSet%s(pid, addr int, regs *PtraceRegs%s) error {\n", uarch, uarch)
	fmt.Fprintf(buf, "\tiovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))}\n")
	fmt.Fprintf(buf, "\treturn ptrace(PTRACE_SETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))\n")
	fmt.Fprintf(buf, "}\n")
	if err := buf.Flush(); err != nil {
		return err
	}
	if err := f.Close(); err != nil {
		return err
	}
	return nil
}
// generatePtraceRegSet takes a GOARCH value to generate a file zptrace_linux_{arch}.go
// containing functions PtraceGetRegSet{arch} and PtraceSetRegSet{arch}.
generatePtraceRegSet takes a GOARCH value to generate a file zptrace_linux_{arch}.go
containing functions PtraceGetRegSet{arch} and PtraceSetRegSet{arch}.
// generatePtraceRegSet takes a GOARCH value to generate a file zptrace_linux_ { arch } . go // containing functions PtraceGetRegSet { arch } and PtraceSetRegSet { arch } .
func generatePtraceRegSet(arch string) error {
	f, err := os.Create(fmt.Sprintf("zptrace_linux_%s.go", arch))
	if err != nil {
		return err
	}
	buf := bufio.NewWriter(f)
	fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtraceRegSet(%q). DO NOT EDIT.\n", arch)
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "package unix\n")
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "%s\n", `import "unsafe"`)
	fmt.Fprintf(buf, "\n")
	uarch := string(unicode.ToUpper(rune(arch[0]))) + arch[1:]
	fmt.Fprintf(buf, "// PtraceGetRegSet%s fetches the registers used by %s binaries.\n", uarch, arch)
	fmt.Fprintf(buf, "func PtraceGetRegSet%s(pid, addr int, regsout *PtraceRegs%s) error {\n", uarch, uarch)
	fmt.Fprintf(buf, "\tiovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))}\n")
	fmt.Fprintf(buf, "\treturn ptrace(PTRACE_GETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))\n")
	fmt.Fprintf(buf, "}\n")
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "// PtraceSetRegSet%s sets the registers used by %s binaries.\n", uarch, arch)
	fmt.Fprintf(buf, "func PtraceSetRegSet%s(pid, addr int, regs *PtraceRegs%s) error {\n", uarch, uarch)
	fmt.Fprintf(buf, "\tiovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))}\n")
	fmt.Fprintf(buf, "\treturn ptrace(PTRACE_SETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))\n")
	fmt.Fprintf(buf, "}\n")
	if err := buf.Flush(); err != nil {
		return err
	}
	if err := f.Close(); err != nil {
		return err
	}
	return nil
}
func generatePtraceRegSet ( arch string ) error { f , err := os . Create ( fmt . Sprintf ( " " , arch ) ) if err != nil { return err } buf := bufio . NewWriter ( f ) fmt . Fprintf ( buf , " \n " , arch ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " , `import "unsafe"` ) fmt . Fprintf ( buf , " \n " ) uarch := string ( unicode . ToUpper ( rune ( arch [ 0 ] ) ) ) + arch [ 1 : ] fmt . Fprintf ( buf , " \n " , uarch , arch ) fmt . Fprintf ( buf , " \n " , uarch , uarch ) fmt . Fprintf ( buf , " \t \n " ) fmt . Fprintf ( buf , " \t \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " , uarch , arch ) fmt . Fprintf ( buf , " \n " , uarch , uarch ) fmt . Fprintf ( buf , " \t \n " ) fmt . Fprintf ( buf , " \t \n " ) fmt . Fprintf ( buf , " \n " ) if err := buf . Flush ( ) ; err != nil { return err } if err := f . Close ( ) ; err != nil { return err } return nil }
generatePtraceRegSet takes a GOARCH value to generate a file zptrace_linux_{arch}.go
containing functions PtraceGetRegSet{arch} and PtraceSetRegSet{arch}.
generatePtraceRegSet takes a GOARCH value to generate a file zptrace_linux_ { arch } . go containing functions PtraceGetRegSet { arch } and PtraceSetRegSet { arch } .