Live data from Hacker News

A cross-platform debugger for Go

blog.mailgun.com

11–20 of 65 posts

Re: A cross-platform debugger for Go

#11
post #10

While I totally applaud this effort, how does it not lie? It inserts code into the actual source claiming it is on a line in the original file, but it is in a different line in the compiled version. That seems like it could be a problem at some point, and despite the serious utility in this, I'm not 100% convinced it is the right tool for the job.

Go has special comments for that: "//line filename:line"

Thanks, I didn't know that. The go/token docs don't say much about it. Do you know if there is better documentation somewhere?

Re: A cross-platform debugger for Go

#13

While I totally applaud this effort, how does it not lie? It inserts code into the actual source claiming it is on a line in the original file, but it is in a different line in the compiled version. That seems like it could be a problem at some point, and despite the serious utility in this, I'm not 100% convinced it is the right tool for the job.

Author here. I agree that this could cause surprises. Are there specific cases you have in mind? Two cases I have thought of are stack traces and logging that inspects the stack. In the former case, if you get a stack trace while debugging it will not mean much because the lines do not match those of your code. In the latter case, logging statements may print the wrong things if they depend on being called a certain…

[deleted]

Re: A cross-platform debugger for Go

#15
This looks really great. When I saw how Go does coverage testing using the same approach I felt that the code generation approach would work for a debugger. I'm glad someone did it - and from the few moments of playing with it it seems to be working great. I'm adding this to my toolkit for sure.

Re: A cross-platform debugger for Go

#17
I wrote a similar instrumenting debugger for JavaScript awhile back, but haven't maintained it: https://github.com/tlrobinson/xebug

At one point even I implemented the V8 debugger protocol so you could use the Web Inspector, and an HTTP proxy that would automatically instrument JavaScript files (using synchronous XMLHttpRequests to block execution...), but I don't think I ever posted that code :(

Re: A cross-platform debugger for Go

#18
post #13

Earlier quoted context omitted.

Author here. I agree that this could cause surprises. Are there specific cases you have in mind? Two cases I have thought of are stack traces and logging that inspects the stack. In the former case, if you get a stack trace while debugging it will not mean much because the lines do not match those of your code. In the latter case, logging statements may print the wrong things if they depend on being called a certain…

[deleted]

> Another is that you may inadvertently corrupt or change the behavior of the code in an unintentional way if you modify it incorrectly

I'm concerned about this, too. One of my next high priorities for godebug is to download many open source projects and search for behavior differences caused by the debugger. I would also like to generate new programs and test them as well.

> But, you get the easy 80% with this for sure. I'm just prodding you to work on the other 20%.

I will. I'm excited about the project and want to make it as useful as I can.

Re: A cross-platform debugger for Go

#20
post #13

Earlier quoted context omitted.

Author here. I agree that this could cause surprises. Are there specific cases you have in mind? Two cases I have thought of are stack traces and logging that inspects the stack. In the former case, if you get a stack trace while debugging it will not mean much because the lines do not match those of your code. In the latter case, logging statements may print the wrong things if they depend on being called a certain…

[deleted]

A compiler transforms source code. It doesn't have access to all programs either, yet we trust them most of the time.
Post reply on HN