{"record":{"id":"531bac18c3b75168","repo":"go-delve/delve","slug":"unknown-cpu-register-type-conversion-to-q","errorCode":null,"errorMessage":"unknown CPU register type conversion to %q","messagePattern":"unknown CPU register type conversion to %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/variables.go","lineNumber":2244,"sourceCode":"\t\t\tchild = newConstant(constant.MakeFloat64(float64(x)), v.bi, v.mem)\n\t\t\tchild.Kind = reflect.Float32\n\t\t\tn = 4\n\t\tcase \"float64\":\n\t\t\ta := binary.LittleEndian.Uint64(v.reg.Bytes[i:])\n\t\t\tx := *(*float64)(unsafe.Pointer(&a))\n\t\t\tchild = newConstant(constant.MakeFloat64(x), v.bi, v.mem)\n\t\t\tchild.Kind = reflect.Float64\n\t\t\tn = 8\n\t\tdefault:\n\t\t\tif n == 0 {\n\t\t\t\tfor _, pfx := range []string{\"uint\", \"int\"} {\n\t\t\t\t\tif strings.HasPrefix(newtyp, pfx) {\n\t\t\t\t\t\tn, _ = strconv.Atoi(newtyp[len(pfx):])\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif n == 0 || bits.OnesCount64(uint64(n)) != 1 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unknown CPU register type conversion to %q\", newtyp)\n\t\t\t\t}\n\t\t\t\tn = n / 8\n\t\t\t}\n\t\t\tchild = newConstant(constant.MakeString(fmt.Sprintf(\"%x\", v.reg.Bytes[i:][:n])), v.bi, v.mem)\n\t\t}\n\t\tv.Children = append(v.Children, *child)\n\t}\n\n\tv.loaded = true\n\tv.Kind = reflect.Array\n\tv.Len = int64(len(v.Children))\n\tv.Base = fakeAddressUnresolv\n\tv.DwarfType = fakeArrayType(uint64(len(v.Children)), &godwarf.VoidType{CommonType: godwarf.CommonType{ByteSize: int64(n)}})\n\tv.RealType = v.DwarfType\n\treturn v, nil\n}\n\nfunc isCgoType(bi *BinaryInfo, typ godwarf.Type) bool {","sourceCodeStart":2226,"sourceCodeEnd":2262,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/variables.go#L2226-L2262","documentation":"When converting a CPU register's bytes to a typed value (e.g. in disassembly/register views), Delve accepts a requested type like 'uint64'/'int32' and derives the byte count n; n must be nonzero and a power of two. Otherwise it refuses with this error.","triggerScenarios":"Requesting a register type conversion to a name that has no recognized 'uintN'/'intN'/'floatN' prefix, or one whose parsed width is not a power of two (e.g. 'uint24', 'int0', arbitrary strings).","commonSituations":"Typo'd register type names in custom tooling/scripting against delve internals; passing C-style types like 'long' or 'size_t' that aren't uintN/intN forms.","solutions":["Use a standard width type name: uint8/16/32/64, int8/16/32/64, float32/64","Remove zero or non-power-of-two widths (e.g. 'uint24' -> 'uint32')","Check casing/spelling: the prefix match is exact (e.g. 'uint64', not 'UINT64')","If you need unusual widths, read raw bytes and decode manually in your tool"],"exampleFix":"// before\nconv := convertReg(reg, \"uint24\")   // error: unknown CPU register type conversion to \"uint24\"\n// after\nconv := convertReg(reg, \"uint32\")\n","handlingStrategy":"validation","validationCode":"// Validate conversion target before requesting it\nvar n int\nfor _, pfx := range []string{\"uint\", \"int\", \"float\"} {\n    if strings.HasPrefix(typ, pfx) { n, _ = strconv.Atoi(typ[len(pfx):]) }\n}\nvalid := n > 0 && bits.OnesCount64(uint64(n)) == 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use uintN/intN/floatN names with power-of-two widths","Avoid platform-alias type names (long, size_t) in register conversions","Add client-side validation mirroring the library's rules"],"tags":["delve","registers","types","conversion"],"backgroundTag":"unsupported-type-conversion","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}