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

Open
thanm opened this issue May 4, 2021 · 1 comment
Open
Assignees
Milestone

Comments

@thanm
Copy link
Member

@thanm 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

@gopherbot gopherbot commented May 4, 2021

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants