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

debug/dwarf: incorrect runtime.newproc DIE in .zdebug_info #53802

Open
jschwinger233 opened this issue Jul 12, 2022 · 2 comments
Open

debug/dwarf: incorrect runtime.newproc DIE in .zdebug_info #53802

jschwinger233 opened this issue Jul 12, 2022 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jschwinger233
Copy link

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

$ go version
go version go1.18.3 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
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/gray//bin"
GOCACHE="/home/gray/.cache/go-build"
GOENV="/home/gray/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/gray/pkg/mod"
GONOPROXY="git.insea.io"
GONOSUMDB="git.insea.io"
GOOS="linux"
GOPATH="/home/gray/"
GOPRIVATE="git.insea.io"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/gray/src/proving_grounds/go_hello_world/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2957214737=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Build a hello world:

package main

import "fmt"

func main() {
    fmt.Println("hello world")
}

Then check the runtime.newproc entry in .zdebug_info

$ objdump -Wi ./go_hello_world | grep 'runtime.newproc$' -A2
    <4196c>   DW_AT_name        : runtime.newproc
    <4197c>   DW_AT_low_pc      : 0x43a9a0
    <41984>   DW_AT_high_pc     : 0x43aa19
--
    <524a7>   DW_AT_name        : runtime.newproc
    <524b7>   DW_AT_low_pc      : 0x45cea0
    <524bf>   DW_AT_high_pc     : 0x45cecf

There are 2 different DIE for runtime.newproc, but only the first one is correct.

The second entry is actually for runtime.newproc.abi0, and we can tell it from the .symtab, but the dwarf emitter made mistakes:

$ nm ./go_hello_world | grep runtime.newproc
000000000043a9a0 T runtime.newproc
000000000043aaa0 T runtime.newproc1
000000000045cea0 T runtime.newproc.abi0
000000000043aa20 T runtime.newproc.func1
000000000054ef1c B runtime.newprocs

What did you expect to see?

I expected to see the only one entry for runtime.newproc.

What did you see instead?

I saw 2 different entries for runtime.newproc, in which one entry should have been runtime.newproc.abi0.

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 12, 2022
@mknyszek mknyszek added this to the Backlog milestone Jul 12, 2022
@mknyszek
Copy link
Contributor

CC @golang/compiler

@cherrymui
Copy link
Member

runtime.newproc.abi0 is a wrapper of runtime.newproc, and it immediately calls the latter. runtime.newproc.abi0 is the symbol name but user friendly name is the demangled runtime.newproc.

cc @thanm @aclements . Did we intentionally use the demangled name for DWARF?

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@mknyszek mknyszek moved this to Triage Backlog in Go Compiler / Runtime Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

4 participants