github.com/cnboonhan/delve@v0.0.0-20230908061759-363f2388c2fb/pkg/proc/pe.go (about)

     1  package proc
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  const (
     8  	_IMAGE_FILE_MACHINE_UNKNOWN   = 0x0
     9  	_IMAGE_FILE_MACHINE_AM33      = 0x1d3
    10  	_IMAGE_FILE_MACHINE_AMD64     = 0x8664
    11  	_IMAGE_FILE_MACHINE_ARM       = 0x1c0
    12  	_IMAGE_FILE_MACHINE_ARMNT     = 0x1c4
    13  	_IMAGE_FILE_MACHINE_ARM64     = 0xaa64
    14  	_IMAGE_FILE_MACHINE_EBC       = 0xebc
    15  	_IMAGE_FILE_MACHINE_I386      = 0x14c
    16  	_IMAGE_FILE_MACHINE_IA64      = 0x200
    17  	_IMAGE_FILE_MACHINE_M32R      = 0x9041
    18  	_IMAGE_FILE_MACHINE_MIPS16    = 0x266
    19  	_IMAGE_FILE_MACHINE_MIPSFPU   = 0x366
    20  	_IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
    21  	_IMAGE_FILE_MACHINE_POWERPC   = 0x1f0
    22  	_IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1
    23  	_IMAGE_FILE_MACHINE_R4000     = 0x166
    24  	_IMAGE_FILE_MACHINE_SH3       = 0x1a2
    25  	_IMAGE_FILE_MACHINE_SH3DSP    = 0x1a3
    26  	_IMAGE_FILE_MACHINE_SH4       = 0x1a6
    27  	_IMAGE_FILE_MACHINE_SH5       = 0x1a8
    28  	_IMAGE_FILE_MACHINE_THUMB     = 0x1c2
    29  	_IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
    30  )
    31  
    32  type _PEMachine uint16
    33  
    34  // PEMachineString map pe machine to name, See $GOROOT/src/debug/pe/pe.go for detail
    35  var _PEMachineString = map[_PEMachine]string{
    36  	_IMAGE_FILE_MACHINE_UNKNOWN:   "unknown",
    37  	_IMAGE_FILE_MACHINE_AM33:      "am33",
    38  	_IMAGE_FILE_MACHINE_AMD64:     "amd64",
    39  	_IMAGE_FILE_MACHINE_ARM:       "arm",
    40  	_IMAGE_FILE_MACHINE_ARMNT:     "armnt",
    41  	_IMAGE_FILE_MACHINE_ARM64:     "arm64",
    42  	_IMAGE_FILE_MACHINE_EBC:       "ebc",
    43  	_IMAGE_FILE_MACHINE_I386:      "i386",
    44  	_IMAGE_FILE_MACHINE_IA64:      "ia64",
    45  	_IMAGE_FILE_MACHINE_M32R:      "m32r",
    46  	_IMAGE_FILE_MACHINE_MIPS16:    "mips16",
    47  	_IMAGE_FILE_MACHINE_MIPSFPU:   "mipsfpu",
    48  	_IMAGE_FILE_MACHINE_MIPSFPU16: "mipsfpu16",
    49  	_IMAGE_FILE_MACHINE_POWERPC:   "powerpc",
    50  	_IMAGE_FILE_MACHINE_POWERPCFP: "powerpcfp",
    51  	_IMAGE_FILE_MACHINE_R4000:     "r4000",
    52  	_IMAGE_FILE_MACHINE_SH3:       "sh3",
    53  	_IMAGE_FILE_MACHINE_SH3DSP:    "sh3dsp",
    54  	_IMAGE_FILE_MACHINE_SH4:       "sh4",
    55  	_IMAGE_FILE_MACHINE_SH5:       "sh5",
    56  	_IMAGE_FILE_MACHINE_THUMB:     "thumb",
    57  	_IMAGE_FILE_MACHINE_WCEMIPSV2: "wcemipsv2",
    58  }
    59  
    60  func (m _PEMachine) String() string {
    61  	str, ok := _PEMachineString[m]
    62  	if ok {
    63  		return str
    64  	}
    65  	return fmt.Sprintf("unknown image file machine code %d\n", uint16(m))
    66  }