Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: degraded debug info for incoming parameters with regabi enabled #45945

Closed
thanm opened this issue May 4, 2021 · 3 comments
Closed
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented May 4, 2021

What version of Go are you using (go version)?

Using 1.17 / tip

$ go version
go version devel go1.17-138d2c9b88 Tue May 4 03:22:47 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

Compile this program:

https://play.golang.org/p/rKyJWXA7hGK

then bring it up under a debugger (gdb or delve), set a breakpoint in main.ABC, and examine the values of the incoming parameters.

What did you expect to see?

Debugger can print values for live params that are live (e.g. all except "s"). E.g.

(gdb) p p1
$1 = 1
(gdb) p s
$2 = <optimized out>
(gdb) p p2
$3 = 2
(gdb) p p3
$4 = 3
(gdb) p p4
$5 = 4
(gdb) p f1
$6 = 1
(gdb) p f2
$7 = 2
(gdb) p f3
$8 = 3
(gdb) p f4
$9 = 4
(gdb) p b
$10 = {x = 99, y = {0 <repeats 256 times>}}
(gdb) 

What did you see instead?

In 1.17, we get no debug locations for any of the parameters except "b"; all others are "optimized out". This is a fairly large degradation in debug info quality.

Looking at what is happening in the compiler, the problems are primarily due to new code paths that implement the new register ABI; if you build the same program with GOEXPERIMENT=noregabi, the debugging experience for incoming parameters is about the same as 1.16.

@thanm thanm added this to the Go1.17 milestone May 4, 2021
@thanm thanm self-assigned this May 4, 2021
@gopherbot
Copy link

Change https://golang.org/cl/316890 mentions this issue: cmd/compile: establish regabi name/value mapping for small in-params

gopherbot pushed a commit that referenced this issue May 4, 2021
When the expand_calls phase in the SSA backend lowers prolog OpArg
values into OpArgIntReg/OpArgFloatReg values, we don't always record
the assocation between the new lowered value and the parameter name.

This patch handles the simple case where a given parameter fits into
exactly one register; in this scenario it makes sense to manufacture a
new pseudo-slot for the value that points to the param, and install
the slot/value mapping in the NamedValues table for the function. More
work will be needed to deal with params that span multiple registers;
that will need to be addressed in a subsequent patch.

This change improves the parameter error rate "optargorder" benchmark
by about 7-8% (when run on the optargorder binary).

Updates #45945.

Change-Id: Ic9adbe20b6f91145d49651348818f0f5cba92b18
Reviewed-on: https://go-review.googlesource.com/c/go/+/316890
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@thanm
Copy link
Contributor Author

thanm commented May 12, 2021

With https://golang.org/cl/316890, we're now getting the same debugging experience on tip as 1.16 for the example cited in this issue. There is still work to do to improve things for composite parameters, however. I'm going to hold this issue open for a bit longer in case there are short-term / limited things we can do go improve the situation.

@mknyszek mknyszek modified the milestones: Go1.17, Go1.18 Aug 18, 2021
@mknyszek
Copy link
Contributor

Since there hasn't been any movement here since May and @thanm's last comment was about leaving this open for short-term things to improve the situation, I'm going to assume there weren't and close the issue. :)

@thanm feel free to reopen or move to backlog and/or Go 1.19.

@rsc rsc unassigned thanm Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants