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: malformed DWARF ranges (child not contained in parent) #33188

Open
thanm opened this issue Jul 19, 2019 · 0 comments

Comments

@thanm
Copy link
Member

commented Jul 19, 2019

What version of Go are you using (go version)?

$ go version
go version devel +79bb1a3653 Thu Jul 18 10:16:59 2019 -0400 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
linux/amd64

What did you do?

Build this program:

package main

import "C"
import "log"

func main() {
	log.Printf("foo")
}

in the usual way, e.g. "go build main.go". Then run

llvm-dwarfdump -verify -verbose main

to check the resulting dwarf.

What did you expect to see?

Clean run

What did you see instead?

A number of errors of the form: "error: DIE address ranges are not contained in its parent's ranges:"

Here is one instance:

0x00006511: DW_TAG_inlined_subroutine
              DW_AT_abstract_origin	(0x00000000000014b8 "runtime.add")
              DW_AT_ranges	(0x00001370
                 [0x0000000000004984, 0x0000000000004988)
                 [0x00000000000049f9, 0x00000000000049fe))
              DW_AT_call_file	("/ssd2/go/src/runtime/chan.go")
              DW_AT_call_line	(121)

which is contained in this DIE:

0x000064e4: DW_TAG_inlined_subroutine
              DW_AT_abstract_origin	(0x0000000000001696 "runtime.chanbuf")
              DW_AT_low_pc	(0x000000000000497c)
              DW_AT_high_pc	(0x0000000000004984)
              DW_AT_call_file	("/ssd2/go/src/runtime/chan.go")
              DW_AT_call_line	(484)

so definitely an inconsistency. Note that the top-level parent is:

0x0000640e: DW_TAG_subprogram
              DW_AT_name	("runtime.chanrecv")
              DW_AT_low_pc	(0x00000000000048a0)
              DW_AT_high_pc	(0x0000000000004f52)
              DW_AT_frame_base	(DW_OP_call_frame_cfa)
              DW_AT_decl_file	("/ssd2/go/src/runtime/chan.go")
              DW_AT_external	(0x01)

There is nothing in the DWARF spec as far as I know that mandates this sort of address range nesting consistency, but I think it would probably be nice if a given inlined subroutines ranges were completely nested inside the parent DIE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.