Skip to content

cmd/dlv: use goversion.ParseProducer for DW_AT_producer - #4307

Merged
derekparker merged 1 commit into
go-delve:masterfrom
croepha:go-build-custom-version
Apr 23, 2026
Merged

derekparker merged 1 commit into
go-delve:masterfrom
croepha:go-build-custom-version

Conversation

@croepha

@croepha croepha commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

For some reason, a prefix is added to the raw go version. It may be caused by how I built go. This simply removes the prefix.

Actually uses goversion.ParseProducer

@aarzilli

Copy link
Copy Markdown
Member

It may be caused by how I built go

How do you build go?

@aarzilli

Copy link
Copy Markdown
Member

Looking around, the version string is generated by findgoversion in src/cmd/dist/build.go and the only way it could start with like that is a malformed VERSION file. You could also be talking about the version string in DW_AT_producer, which always starts with Go cmd/compile, but that's already taken care of by goversion.ParseProducer.

@croepha

croepha commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

it is DW_AT_producer, I'm hitting this branch:

if !d.isRecording() && !d.IsRunning() {
out.TargetGoVersion = d.target.Selected.BinInfo().Producer()
}

Then here we call goversion.Parse instead of goversion.ParseProducer

func (t *Term) goVersion() *goversion.GoVersion {
if t.goVersionCache != nil {
return t.goVersionCache
}
vers := t.client.GetVersion()
v, _ := goversion.Parse(vers.TargetGoVersion)
t.goVersionCache = &v
return t.goVersionCache
}

@croepha
croepha force-pushed the go-build-custom-version branch from b26393a to 7305756 Compare April 15, 2026 12:55
@croepha croepha changed the title cmd/dlv: support custom go builds cmd/dlv: use goversion.ParseProducer for DW_AT_producer Apr 15, 2026
@croepha

croepha commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

I rebooted the PR, with a patch to use ParseProducer instead of Parse

@aarzilli aarzilli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@croepha

croepha commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

Do you know how to get this failing test to pass? its complaining about credits...

@aarzilli

Copy link
Copy Markdown
Member

Don't worry about it.

@derekparker derekparker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekparker
derekparker merged commit c9ed7c0 into go-delve:master Apr 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants