{"record":{"id":"5141425e130c62b6","repo":"golang/go","slug":"no-line-information-for-pc-x","errorCode":null,"errorMessage":"no line information for PC=%#x","messagePattern":"no line information for PC=%#x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cmd/pprof/pprof.go","lineNumber":287,"sourceCode":"\taddr -= f.offset\n\tfile, line, fn := f.pcln.PCToLine(addr)\n\tif fn != nil {\n\t\tframe := []driver.Frame{\n\t\t\t{\n\t\t\t\tFunc: fn.Name,\n\t\t\t\tFile: file,\n\t\t\t\tLine: line,\n\t\t\t},\n\t\t}\n\t\treturn frame, nil\n\t}\n\n\tframes := f.dwarfSourceLine(addr)\n\tif frames != nil {\n\t\treturn frames, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"no line information for PC=%#x\", addr)\n}\n\n// dwarfSourceLine tries to get file/line information using DWARF.\n// This is for C functions that appear in the profile.\n// Returns nil if there is no information available.\nfunc (f *file) dwarfSourceLine(addr uint64) []driver.Frame {\n\tif f.dwarf == nil && !f.triedDwarf {\n\t\t// Ignore any error--we don't care exactly why there\n\t\t// is no DWARF info.\n\t\tf.dwarf, _ = f.file.DWARF()\n\t\tf.triedDwarf = true\n\t}\n\n\tif f.dwarf != nil {\n\t\tr := f.dwarf.Reader()\n\t\tunit, err := r.SeekPC(addr)\n\t\tif err == nil {\n\t\t\tif frames := f.dwarfSourceLineEntry(r, unit, addr); frames != nil {","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/pprof/pprof.go#L269-L305","documentation":"The pprof tool could not find line-number information (source file and line number) for a given program counter (PC) address. The tool first tries symbol table line info, then DWARF debug info (`dwarfSourceLine`), and if both fail it returns this error. This means neither the symbol table nor DWARF sections contain mapping for the specific instruction address, which happens when the code was compiled without debug info, stripped, or the address is in a runtime/assembly section without line mapping.","triggerScenarios":"Fires in the `file.SourceLine` method at pprof.go:287 when both the primary line lookup and `f.dwarfSourceLine(addr)` return nil. The DWARF data is lazily loaded at line 280-284. This occurs during symbolization of profile samples when pprof tries to annotate a PC address with its source location.","commonSituations":"Profiling a binary built with `-ldflags='-s -w'` (stripped, no DWARF info). Profiling a binary compiled without optimization-inlining-safe debug info (Go's runtime assembly functions often lack line info). The PC address falls in dynamically generated code (JIT, reflect, cgo trampolines). Using a system Go installation where the .go source files or debug info are not accessible. Profiling C/C++ code via pprof where the binary was stripped.","solutions":["Rebuild the target binary with debug info: remove `-ldflags='-s -w'` from the build command and use `go build` without stripping flags.","Ensure the binary being profiled is the same binary that generated the profile (address mismatch causes all lookups to fail).","If profiling on a different machine, ensure the same binary (with debug info) is available locally for pprof to read.","For runtime/assembly addresses, this is expected — some Go runtime functions genuinely lack line info; suppress with `-ignore` flags.","If DWARF is present but corrupted, rebuild from scratch: `go clean -cache && go build`."],"exampleFix":"# Before: stripped binary, no debug info\ngo build -ldflags='-s -w' -o myapp\npprof myapp cpu.prof  # no line info\n\n# After: build with full debug info\ngo build -o myapp\npprof myapp cpu.prof  # line info available","handlingStrategy":"validation","validationCode":"// Verify the binary has DWARF debug info before profiling\nfile, err := objfile.Open(binaryPath)\nif err != nil {\n    return fmt.Errorf(\"cannot open binary: %w\", err)\n}\ndwarf, err := file.DWARF()\nif err != nil || dwarf == nil {\n    fmt.Println(\"Warning: binary lacks DWARF info; source lines will be unavailable\")\n    fmt.Println(\"Rebuild without -ldflags='-s -w'\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never strip binaries with -ldflags='-s -w' if you intend to profile them.","Keep the exact binary that produced the profile for symbolization.","Build with full debug info for profiling builds: `go build -gcflags='all=-N -l'`.","Expect some runtime/assembly PCs to lack line info — this is normal."],"tags":["pprof","dwarf","debug-info","symbolization","stripped-binary","profiling"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}