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

Comments

Projects
None yet
4 participants
@aarzilli
Copy link
Contributor

commented Mar 20, 2018

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

This comment has been minimized.

Copy link
Member

commented Mar 20, 2018

I'll take a look.

@thanm

This comment has been minimized.

Copy link
Member

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 the Debugging label Mar 20, 2018

@ALTree ALTree added this to the Go1.11 milestone Mar 20, 2018

@ALTree ALTree added the NeedsFix label Mar 20, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Mar 20, 2018

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

@gopherbot gopherbot closed this in f45c07e Mar 20, 2018

@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.
You can’t perform that action at this time.