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: missing variables in debug_info for inlined subroutines #24460

Closed
aarzilli opened this issue Mar 20, 2018 · 3 comments
Closed

cmd/compile: missing variables in debug_info for inlined subroutines #24460

aarzilli opened this issue Mar 20, 2018 · 3 comments
Labels
Debugging FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@aarzilli
Copy link
Contributor

go version devel +ae10914 Tue Mar 20 09:44:50 2018 +0000 linux/amd64

If I compile the following:

package main

import "fmt"

func inlineThis(a int) int {
	z := a * a
	return z + a/a
}

func initialize(a, b *int) {
	*a = 3
	*b = 4
}

func main() {
	var a, b int
	initialize(&a, &b)
	a = inlineThis(a)
	b = inlineThis(b)
	fmt.Printf("%d %d\n", a, b)
}

with -gcflags='-N' the DIE for main.inlineThis is:

 <1><63404>: Abbrev Number: 3 (DW_TAG_subprogram)
    <63405>   DW_AT_name        : main.inlineThis
    <63415>   DW_AT_inline      : 1     (inlined)
    <63416>   DW_AT_external    : 1
 <2><63417>: Abbrev Number: 0

which doesn't have any local variables/parameters and neither do the corresponding DW_TAG_inlined_subroutine entries.

while with 1.10 I got:

 <1><649a0>: Abbrev Number: 3 (DW_TAG_subprogram)
    <649a1>   DW_AT_name        : main.inlineThis
    <649b1>   DW_AT_inline      : 1     (inlined)
    <649b2>   DW_AT_external    : 1
 <2><649b3>: Abbrev Number: 16 (DW_TAG_formal_parameter)
    <649b4>   DW_AT_name        : a
    <649b6>   DW_AT_variable_parameter: 0
    <649b7>   DW_AT_type        : <0x220d>
 <2><649bb>: Abbrev Number: 11 (DW_TAG_variable)
    <649bc>   DW_AT_name        : z
    <649be>   DW_AT_decl_line   : 6
    <649bf>   DW_AT_type        : <0x220d>
 <2><649c3>: Abbrev Number: 0

Bisect says b3cb740 is the first bad commit. However that commit seems pretty tame, I'm not sure what's going on.

cc @heschik @thanm

@thanm
Copy link
Contributor

thanm commented Mar 20, 2018

I'll take a look.

@thanm
Copy link
Contributor

thanm commented Mar 20, 2018

b3cb740 does indeed look like the bad commit. I am testing a fix.

I wish it were easier to write regression tests in this arena...

@ALTree ALTree changed the title cmd/compile: Missing variables in debug_info for inlined subroutines [debugging] cmd/compile: missing variables in debug_info for inlined subroutines Mar 20, 2018
@ALTree ALTree added this to the Go1.11 milestone Mar 20, 2018
@ALTree ALTree added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 20, 2018
@gopherbot
Copy link

Change https://golang.org/cl/101676 mentions this issue: cmd/compile: fix regression in DWARF inlined routine variable tracking

@golang golang locked and limited conversation to collaborators Mar 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debugging FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants