使用Golang调试App Engine — 一定有更好的方法吗?

huangapple go评论74阅读模式
英文:

Debugging App engine with golang -- There has to be a better way?

问题

我正在(慢慢地)使用Go语言开发一个App Engine应用程序。虽然我喜欢这个过程中的许多部分(与Google服务的良好集成以及Go语言本身),但我对于App Engine缺乏调试工具感到有些惊讶。

我知道你可以将日志记录到控制台(在我看来这是最基本的调试方式),但是所有尝试更高级的调试方法(例如在本地实例上附加gdb)都失败了(App Engine的构建工具似乎会剥离调试信息)。

我不相信我是唯一一个注意到这个问题的人,所以我想知道其他人在App Engine中是如何进行开发和调试的?

英文:

I"m (slowly) working on a app-engine app using the go language -- While I like many parts of the experience (the nice integration with google services and the go language itself) but I'm a bit suprised at the lack of debug facilities especially with app engine.

I know that you can log to the console (The lowest form of debugging IMHO) but all attempts at anything more clever (attaching gdb on the local instance) fails. (the build tools for app engine specifically seem to strip debug info)

I can't believe I'm the only one who has observed this so I'm wondering what other folks are doing to develop/debug in app engine?

答案1

得分: 3

目前还没有比context.Errorf()和相关函数更好的方法。Python在1.8.3版本的SDK中刚刚获得了pdb支持。我还没有听说过任何类似的针对Go语言的调试器支持。或许可以在App Engine Go邮件列表上询问一下这个问题是否有解决方案。

英文:

There is not currently a better way than context.Errorf() and friends. Python just got pdb support in the 1.8.3 SDK. I have not heard of any similar debugger support for go. It is perhaps worth asking on the app engine go list about this.

答案2

得分: 2

我刚刚在这个博客中阅读了关于你的话题:

http://joshua.themarshians.com/hardcore-google-unit-testing.html

我不能给你一个例子,但也许这会有所帮助。

英文:

I just red about your topic in this blog:

http://joshua.themarshians.com/hardcore-google-unit-testing.html

I can't give you an example but maybe it will help.

答案3

得分: 0

已经有一个更新,我想添加一下当前的情况。

好消息是,现在go工具不再剥离调试符号,所以如果你在本地机器上运行,现在可以使用gdb进行调试支持!

这是一个有点复杂的过程,可以进一步自动化(欢迎提出建议)。

简而言之:

  1. 寻找_app_go进程
  2. 切换到它所在的目录
  3. 使用"-pid"命令将gdb附加到该进程
  4. 告诉gdb源代码的目录

嘭——调试。

英文:

it's been an update and I thought to add what is the current state of affair.

The good news is the go tools now no longer strip debug symbols so if you are running on your local machine you can now get gdb support!

It's a bit of a process and ripe for some more automation (suggestions welcome)

in short:

  1. look for the _app_go process
  2. cd to the directory that it's running from
  3. Attach to the process with the '-pid' command to gdb
  4. Tell gdb the directory of source

Boom -- debugging.

huangapple
  • 本文由 发表于 2013年8月11日 13:31:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/18169071.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定