Skip to content

Conversation

@twoolie
Copy link

@twoolie twoolie commented Mar 12, 2014

This is a hack. for some unknown reason, GDB is outputting lines which are clearly stdout from the debugged program, but are not @ prefixed. This means that lines that happen to start with mi2 control characters are being passed into mi2 parsing functions that themselves do very little validation before substringing everywhere.

That being said, it works, and it should protect against a whole class of invalid parsing (as described in #639).

Bei Zhang and others added 2 commits March 8, 2014 13:27
…interpreted as such.

** This is a hack **. for some unknown reason, GDB is outputting lines which are clearly stdout from the debugged program, but are not @ prefixed. This means that lines that happen to start with mi2 control characters are being passed into mi2 parsing functions that themselves do very little validation before `substring`ing everywhere.
@mtoader
Copy link
Member

mtoader commented Mar 15, 2014

@dlsniper can you check the validity of this ? I have no idea how the debugger works now.

@dlsniper
Copy link
Member

Without an actual line of output that replicates the problem I'm not sure about this either. The current parser does have its weak spots caused by gdb/mi being very inconsistent in output. I'll have a look over it more closely tomorrow.

@twoolie
Copy link
Author

twoolie commented Mar 16, 2014

If it helps, when I get home I will post a short go program that triggers
this behavior, and explain how this patch fixes it.

@mtoader
Copy link
Member

mtoader commented Mar 16, 2014

Thank you, @twoolie. That would help @dlsniper validate this.

@twoolie
Copy link
Author

twoolie commented Mar 17, 2014

@dlsniper, here are the representative programs.

This is the simplest program that triggers the = prefix bug:
screenshot from 2014-03-17 10 51 05

And here's the stacktrace that it produces:
screenshot from 2014-03-17 10 53 04

Here's a showcase for #647 that is built upon in my patch.
screenshot from 2014-03-17 10 53 51

And here's the stacktrace that shows the error.
screenshot from 2014-03-17 10 55 30

@dlsniper
Copy link
Member

This can be merged as well as far as I can see, sorry for the long time it took me to get back on this.

mtoader added a commit that referenced this pull request Mar 27, 2014
Fixes #639: Debugger Failure when encountering "=" prefixed output
@mtoader mtoader merged commit 6c91384 into go-lang-plugin-org:master Mar 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants