Skip to content

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

@thanm

Description

@thanm

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions