Skip to content

gdb: Wrong values for local variables  #8256

@gopherbot

Description

@gopherbot

by andreas.nusser:

What does 'go version' print?
Tried with 
.)go version go1.3 linux/amd64
and
.)go version devel +e0ad7e329637 Thu Jun 19 22:19:56 2014 -0700 linux/amd64

As gdb I'm using "GNU gdb (GDB) 7.6.2 (Debian 7.6.2-1.1+b1)"

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Write a short test program similar to the one attached. (You can find it here too:
http://play.golang.org./p/Y5b-t2iobd)
2. Compile it with go build -gcflags "-N -l" to prevent inlining
3. Run the resulting binary with gdb and observe as gdb reports wrong values for the
local variables. It even doesn't report the changed value of "z" in line 13.

What happened?
 - Instead of the values of the variables, gdb shows garbage.

What should have happened instead?
 - gdb should show the correct values.

Thanks for your help!
Andreas

Attachments:

  1. gdb_fail.go (276 bytes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions