delve icon indicating copy to clipboard operation
delve copied to clipboard

Unable to evaluate expression: cannot use b.String as argument b in function strings.(*Builder).String: stack object passed to escaping pointer: b

Open 1Mark opened this issue 3 years ago • 4 comments
trafficstars

Unable to evaluate expression: cannot use b.String as argument b in function strings.(*Builder).String: stack object passed to escaping pointer: b

image

  1. What version of Delve are you using (dlv version)? 1.9.1
  2. What version of Go are you using? (go version)? 1.19.2
  3. What operating system and processor architecture are you using?
goos: linux
goarch: amd64
pkg: iteration
cpu: Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz
  1. What did you do? Ran call b.String() or call b.Len()
  2. What did you expect to see? the value returned
  3. What did you see instead? Unable to evaluate expression: cannot use b.String as argument b in function strings.(*Builder).String: stack object passed to escaping pointer: b

1Mark avatar Oct 25 '22 15:10 1Mark

This is by design at the moment, we don't know which arguments escape so all arguments must be heap allocated. The command line client has a -unsafe option but I don't think that applies to vscode-go.

aarzilli avatar Oct 28 '22 12:10 aarzilli

I met this problem :-(

OrdinaryYZH avatar Nov 02 '22 03:11 OrdinaryYZH

any workarounds?

douniwan5788 avatar Jan 23 '25 16:01 douniwan5788

I just ran into this. For me a functional work around was to use the internal buf of Builder (eg. string(b.buf))

greghart avatar Jun 05 '25 19:06 greghart