Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

The debugger doesn't show pointer values (like 0xf800000040) #1989

Closed
willfaught opened this issue Oct 11, 2018 · 7 comments
Closed

The debugger doesn't show pointer values (like 0xf800000040) #1989

willfaught opened this issue Oct 11, 2018 · 7 comments

Comments

@willfaught
Copy link

willfaught commented Oct 11, 2018

So it seems like you can't tell if two pointers point to the same thing.

screen shot 2018-10-10 at 6 25 33 pm

Latest version of macOS High Sierra (10.13.6 (17G65)), VSCode (1.28.0), and vscode-go (0.6.91).

@eternal-flame-AD
Copy link
Contributor

I usually watch uintptr(x) to obtain the pointer value. Probably a hack but I think that helps in your case:)

@ramya-rao-a
Copy link
Contributor

@willfaught Can you provide a small sample code and elaborate on what you would expect vs what actually is being shown?

@vscodebot
Copy link

vscodebot bot commented Oct 27, 2018

This issue has been closed automatically because it needs more information and has not had recent activity. Thank you for your contributions.

@willfaught
Copy link
Author

@ramya-rao-a Sure:

func TestX(t *testing.T) {
	var i, j int
	var p = &i
	var q = &j
	t.Logf("%#v %#v", p, q)
}

When run, you see output like:

=== RUN   TestX
--- PASS: TestX (0.00s)
    foofile_test.go:9: (*int)(0xc000018150) (*int)(0xc000018158)
PASS
ok  	foopackage	0.010s

When debugging TestX, you see these local variables:

screen shot 2018-10-29 at 7 50 20 pm

The pointer addresses for p and q aren't shown there, so you can't tell if they're equal and thus point to the same thing:

p: <*int>
q: <*int>

Instead, you should see something like:

p: 0xc000018150 <*int>
q: 0xc000018158 <*int>

There should also be a way to drill down into them to view the values they point to, like you can for the *testing.T in that same screen shot.

@ramya-rao-a
Copy link
Contributor

Thanks for the details @willfaught

This should be do-able as long as delve passes a different type for pointers.

PRs are most welcome to fix this.
Code Pointers:

@willfaught
Copy link
Author

@ramya-rao-a Great, thank you!

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Dec 13, 2018

This feature is now available in the latest version of the Go extension (0.8.0)
Thanks @brycekahle!

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants