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

thanm opened this issue May 4, 2021 · 3 comments


Copy link

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


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


What did you do?

Compile this program:

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>}}

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
Copy link

@gopherbot gopherbot commented May 4, 2021

Change 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
Trust: Than McIntosh <>
Run-TryBot: Than McIntosh <>
Reviewed-by: David Chase <>
Reviewed-by: Cherry Zhang <>
TryBot-Result: Go Bot <>
Copy link
Contributor Author

@thanm thanm commented May 12, 2021

With, 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
Copy link

@mknyszek mknyszek commented Nov 10, 2021

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

No branches or pull requests

3 participants