func generatePtracePair(arch1, arch2, archName string) error {
	def1, err := ptraceDef(arch1)
	if err != nil {
		return err
	}
	def2, err := ptraceDef(arch2)
	if err != nil {
		return err
	}
	f, err := os.Create(fmt.Sprintf("zptrace_%s_linux.go", archName))
	if err != nil {
		return err
	}
	buf := bufio.NewWriter(f)
	fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtracePair(%q, %q). DO NOT EDIT.\n", arch1, arch2)
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "// +build linux\n")
	fmt.Fprintf(buf, "// +build %s %s\n", arch1, arch2)
	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")
	writeOnePtrace(buf, arch1, def1)
	fmt.Fprintf(buf, "\n")
	writeOnePtrace(buf, arch2, def2)
	if err := buf.Flush(); err != nil {
		return err
	}
	if err := f.Close(); err != nil {
		return err
	}
	return nil
}
// generatePtracePair takes a pair of GOARCH values that can run each
// other's binaries, such as 386 and amd64. It extracts the PtraceRegs
// type for each one. It writes a new file defining the types
// PtraceRegsArch1 and PtraceRegsArch2 and the corresponding functions
// Ptrace{Get,Set}Regs{arch1,arch2}. This permits debugging the other
// binary on a native system. 'archName' is the combined name of 'arch1'
// and 'arch2', which is used in the file name.
generatePtracePair takes a pair of GOARCH values that can run each
other's binaries, such as 386 and amd64. It extracts the PtraceRegs
type for each one. It writes a new file defining the types
PtraceRegsArch1 and PtraceRegsArch2 and the corresponding functions
Ptrace{Get,Set}Regs{arch1,arch2}. This permits debugging the other
binary on a native system. 'archName' is the combined name of 'arch1'
and 'arch2', which is used in the file name.
// generatePtracePair takes a pair of GOARCH values that can run each // other ' s binaries such as 386 and amd64 . It extracts the PtraceRegs // type for each one . It writes a new file defining the types // PtraceRegsArch1 and PtraceRegsArch2 and the corresponding functions // Ptrace { Get Set } Regs { arch1 arch2 } . This permits debugging the other // binary on a native system . ' archName ' is the combined name of ' arch1 ' // and ' arch2 ' which is used in the file name .
func generatePtracePair(arch1, arch2, archName string) error {
	def1, err := ptraceDef(arch1)
	if err != nil {
		return err
	}
	def2, err := ptraceDef(arch2)
	if err != nil {
		return err
	}
	f, err := os.Create(fmt.Sprintf("zptrace_%s_linux.go", archName))
	if err != nil {
		return err
	}
	buf := bufio.NewWriter(f)
	fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtracePair(%q, %q). DO NOT EDIT.\n", arch1, arch2)
	fmt.Fprintf(buf, "\n")
	fmt.Fprintf(buf, "// +build linux\n")
	fmt.Fprintf(buf, "// +build %s %s\n", arch1, arch2)
	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")
	writeOnePtrace(buf, arch1, def1)
	fmt.Fprintf(buf, "\n")
	writeOnePtrace(buf, arch2, def2)
	if err := buf.Flush(); err != nil {
		return err
	}
	if err := f.Close(); err != nil {
		return err
	}
	return nil
}
func generatePtracePair ( arch1 , arch2 , archName string ) error { def1 , err := ptraceDef ( arch1 ) if err != nil { return err } def2 , err := ptraceDef ( arch2 ) if err != nil { return err } f , err := os . Create ( fmt . Sprintf ( " " , archName ) ) if err != nil { return err } buf := bufio . NewWriter ( f ) fmt . Fprintf ( buf , " \n " , arch1 , arch2 ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " , arch1 , arch2 ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " ) fmt . Fprintf ( buf , " \n " , `import "unsafe"` ) fmt . Fprintf ( buf , " \n " ) writeOnePtrace ( buf , arch1 , def1 ) fmt . Fprintf ( buf , " \n " ) writeOnePtrace ( buf , arch2 , def2 ) if err := buf . Flush ( ) ; err != nil { return err } if err := f . Close ( ) ; err != nil { return err } return nil }
generatePtracePair takes a pair of GOARCH values that can run each
other's binaries, such as 386 and amd64.
generatePtracePair takes a pair of GOARCH values that can run each other ' s binaries such as 386 and amd64 .