用Delve调试:执行功能

用Delve调试:执行功能

问题描述:

I setup a breakpoint in my Go code with runtime.Breakpoint(), save the file (my editor, Atom with go-plus installed, runs go install . on save). Then I run Delve in terminal with dlv debug, and type continue after it starts.

When the breakpoint kicks in, I want to test a couple of things (basically to print reader's data via a bytes.Buffer). But, I get the following error

buf := new(bytes.Buffer): "1:5: expected 'EOF', found ':='"

and in general cannot do much more than print values.

Is it really not possible to do this sort of thing? I am used to Python's pdb where setting variables or calling functions is not a problem and I would expect Delve is capable of the same.

So, what am I doing wrong?

我使用 runtime.Breakpoint() code>在Go代码中设置了一个断点,并保存了 文件(我的编辑器,具有已安装go-plus 的Atom,运行 go install。保存)。 然后,我在终端中使用 dlv debug code>运行Delve,并在启动后键入 continue code>。 p>

当断点出现时,我要 测试几件事(基本上是通过 bytes.Buffer code> 打印阅读器的数据 但是,出现以下错误 p>

  buf:= new(bytes.Buffer):“ 1:5:预期为'EOF',找到了':='” 
   pre> 
 
 

,并且通常不能做比打印值更多的事情。 p>

真的不能做这种事情吗? 我已经习惯了Python的 pdb code>,其中设置变量或调用函数不是问题,我希望Delve能够做到这一点。 p>

那么,我在做什么错了? p> div>

Not possible yet. Right now (2018-NOV) work is in progress on Delve, but unfinished.

Go runtime was changed recently to allow this kind of call. Delve have a Github issue tracking the progress of such feature, but is still experimental and incomplete.