Skip to content

runtime/debug: add SetCrashOutput options #67182

Closed
@adonovan

Description

@adonovan

The debug.SetCrashOutput function was added for go1.23, but has not yet been released. After discussion with @aclements, we agree that support for JSON-formatted crash output containing all the information of runtime.CallersFrames is a desirable feature, since it frees the consumer of the crash from having to be a process of the same executable as the producer of the crash (in order to make sense of the PCs), and from having to think about relative address mappings--and no doubt for other reasons as well.

We propose to change the signature of SetCrashOutput so that it has a second parameter of type CrashOptions, which is defined as an initially empty struct. (We expect to add JSON bool in future, but neither of has time to implement it before the go1.23 freeze.)

package debug // "runtime/debug"

type CrashOptions struct{} // for future expansion

func SetCrashOutput(f *os.File, opts CrashOptions)

This change may break clients that depend on unreleased go1.23 features, such as x/telemetry. As a tactical matter, I suggest we add a variadic parameter ...CrashOptions, update x/telemetry, and then remove the ..., all within a few hours. [Edit: doesn't work; clients will need to use typeswitch during the transition.]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions