{"record":{"id":"86c2c63aed34793a","repo":"go-delve/delve","slug":"cannot-write-a-breakpoint-to-a-core-file","errorCode":null,"errorMessage":"cannot write a breakpoint to a core file","messagePattern":"cannot write a breakpoint to a core file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/core.go","lineNumber":247,"sourceCode":"\t})\n\t_, err = addTarget(p, p.pid, currentThread, exePath, proc.StopAttached, \"\")\n\treturn grp, err\n}\n\n// BinInfo will return the binary info.\nfunc (p *process) BinInfo() *proc.BinaryInfo {\n\treturn p.bi\n}\n\n// EntryPoint will return the entry point address for this core file.\nfunc (p *process) EntryPoint() (uint64, error) {\n\treturn p.entryPoint, nil\n}\n\n// WriteBreakpoint is a noop function since you\n// cannot write breakpoints into core files.\nfunc (p *process) WriteBreakpoint(*proc.Breakpoint) error {\n\treturn errors.New(\"cannot write a breakpoint to a core file\")\n}\n\n// Recorded returns whether this is a live or recorded process. Always returns true for core files.\nfunc (p *process) Recorded() (bool, string) { return true, \"\" }\n\n// Restart will only return an error for core files, as they are not executing.\nfunc (p *process) Restart(*proc.ContinueOnceContext, string) (proc.Thread, error) {\n\treturn nil, ErrContinueCore\n}\n\n// ChangeDirection will only return an error as you cannot continue a core process.\nfunc (p *process) ChangeDirection(proc.Direction) error { return ErrContinueCore }\n\n// GetDirection will always return forward.\nfunc (p *process) GetDirection() proc.Direction { return proc.Forward }\n\n// When does not apply to core files, it is to support the Mozilla 'rr' backend.\nfunc (p *process) When() (string, error) { return \"\", nil }","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/core.go#L229-L265","documentation":"WriteBreakpoint on the core-file process (pkg/proc/core/core.go:247) unconditionally returns the error 'cannot write a breakpoint to a core file'. Core dumps are static memory images, so INT3-style patching of code bytes is impossible. It exists so the process satisfies the proc.ProcessInternal interface.","triggerScenarios":"Calling WriteBreakpoint on a target from OpenCore, directly or through debugger.SetBreakpoint when attaching to a core with 'dlv core'.","commonSituations":"Trying to set a breakpoint at a crash site in a core session; automation that always sets breakpoints before analysis; IDE sessions pointed at a core dump where continue/breakpoints are meaningless.","solutions":["Do not set breakpoints on core dumps; inspect the captured state directly (stack, goroutines, variables).","Use the core's snapshot location: the crash state is already 'stopped at' the faulting point.","To use breakpoints, run the program live (dlv debug/exec/attach) with the same inputs.","If you need conditional post-mortem inspection, use recorded replay (dlv replay) which supports stepping forward."],"exampleFix":"// before\n_, err := dbg.SetBreakpoint(bp) // -> cannot write a breakpoint to a core file\n\n// after\nif coreSession {\n    // inspect existing state instead of setting breakpoints\n    frames, _ := dbg.Stacktrace(goroutineID, 20)\n} else {\n    dbg.SetBreakpoint(bp)\n}","handlingStrategy":"validation","validationCode":"if isCoreTarget(tg) { return errors.New(\"breakpoints unsupported on core dumps\") }","typeGuard":"func canSetBreakpoints(tg *proc.TargetGroup) bool { return !isCoreTarget(tg) }","tryCatchPattern":"err := dbg.SetBreakpoint(bp)\nif err != nil && strings.Contains(err.Error(), \"cannot write a breakpoint to a core file\") {\n    log.Println(\"core dump: inspect the already-stopped crash state instead\")\n}","preventionTips":["Do not run breakpoint-setting workflows against core targets.","Remember the core is already stopped at the crash point.","Use breakpoints only in live (dlv exec/attach) or replay sessions.","Branch your debugger client code on the target kind early."],"tags":["core-dump","breakpoints","go","delve"],"backgroundTag":"core-file-not-executable","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}