Skip to content

cmd/compile: DWARF information for local variables missing #14744

@aarzilli

Description

@aarzilli

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +dbe54d2 Thu Mar 10 07:01:34 2016 +0000 linux/amd64
  2. What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/a/n/go/"
GORACE=""
GOROOT="/usr/local/go-tip"
GOTOOLDIR="/usr/local/go-tip/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build814262766=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

  1. What did you do?
    Compiled this program with go build -gcflags='-N -l' then checked the output of objdump --dwarf ./testvariables.
  2. What did you expect to see?

I expected main.foobar to have all its local variables like it did on <=1.6

  1. What did you see instead?

Only few local variables survive:

 <1><7b>: Abbrev Number: 2 (DW_TAG_subprogram)
    <7c>   DW_AT_name        : main.foobar
    <88>   DW_AT_low_pc      : 0x4010e0
    <90>   DW_AT_high_pc     : 0x4025c0
    <98>   DW_AT_external    : 1
 <2><99>: Abbrev Number: 4 (DW_TAG_variable)
    <9a>   DW_AT_name        : i32
    <9e>   DW_AT_location    : 5 byte block: 9c 11 c0 77 22     (DW_OP_call_frame_cfa; DW_OP_consts: -1088; DW_OP_plus)
    <a4>   DW_AT_type        : <0x2910a>
 <2><ac>: Abbrev Number: 4 (DW_TAG_variable)
    <ad>   DW_AT_name        : a4
    <b0>   DW_AT_location    : 5 byte block: 9c 11 b0 78 22     (DW_OP_call_frame_cfa; DW_OP_consts: -976; DW_OP_plus)
    <b6>   DW_AT_type        : <0x29257>
 <2><be>: Abbrev Number: 4 (DW_TAG_variable)
    <bf>   DW_AT_name        : a11
    <c3>   DW_AT_location    : 5 byte block: 9c 11 b0 7b 22     (DW_OP_call_frame_cfa; DW_OP_consts: -592; DW_OP_plus)
    <c9>   DW_AT_type        : <0x291eb>
 <2><d1>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <d2>   DW_AT_name        : baz
    <d6>   DW_AT_location    : 1 byte block: 9c         (DW_OP_call_frame_cfa)
    <d8>   DW_AT_type        : <0x22781>
 <2><e0>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <e1>   DW_AT_name        : bar
    <e5>   DW_AT_location    : 4 byte block: 9c 11 10 22        (DW_OP_call_frame_cfa; DW_OP_consts: 16; DW_OP_plus)
    <ea>   DW_AT_type        : <0x22aeb>
 <2><f2>: Abbrev Number: 0
 <1><f3>: Abbrev Number: 2 (DW_TAG_subprogram)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions