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: debug info for inlined funcs are sometimes lost #26206

Open
hyangah opened this Issue Jul 3, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@hyangah
Contributor

hyangah commented Jul 3, 2018

with go version devel +23ce272bb1 Mon Jul 2 17:50:00 2018 +0000 linux/amd64

$ cat main.go
package main

import "fmt"

func main() {
        x := &X{Foo: 10}
        y := InlineThis(x, "bar")
        fmt.Printf("Y = %+v\n", y)
}

type X struct {
        Foo int
}

func InlineThis(x *X, s string) int {
        y := x.Foo + len(s)
        return y
}

With go1.11, I expected debug info for the InlineThis would be present in the (default) optimized binary,
but it doesn't.

With --gcflags="-N", I could see some trace of InlineThis in the binary.

 <1><732df>: Abbrev Number: 3 (DW_TAG_subprogram)
    <732e0>   DW_AT_name        : main.InlineThis
    <732f0>   DW_AT_inline      : 1     (inlined)
    <732f1>   DW_AT_external    : 1

@heschik

@heschik

This comment has been minimized.

Contributor

heschik commented Jul 3, 2018

Peculiar. Running with -d dwarfinl=2:

assembling DWARF inlined routine info for "".main
PutDefaultFunc(go.info."".main)
putscope(go.info."".main,0): vars:
[snip]

It looks to me like the inline call table is completely missing the call to InlineThis. @thanm might be able to help.

@randall77

This comment has been minimized.

Contributor

randall77 commented Jul 3, 2018

InlineThis gets inlined and completely optimized away (to a single y:=13). I'm not sure where you would hang a reference to the now-gone function.

@dr2chase

@heschik heschik added the Debugging label Jul 10, 2018

@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Jul 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment