| Summary: | GDB MI parser in CDT/CDI is broken on Windows | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Stefan Bylund <steby> |
| Component: | cdt-debug-cdi-gdb | Assignee: | Project Inbox <cdt-debug-cdi-gdb-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | major | ||
| Priority: | P3 | CC: | cdtdoug, pawel.1.piech, steby |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=356082 | ||
| Whiteboard: | |||
| Attachments: | |||
|
Description
Stefan Bylund
Created attachment 202325 [details]
Simple test program for exemplifying the bug
Created attachment 202326 [details]
Patch for org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/RxThread.java
Created attachment 202327 [details]
Patch for org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/output/MIParser.java
What is the intend of changes in MIParser? Looks like bunch of refactoring, the only functionality change would be that in case of unrecognized line it would print id + buffer instead of just buffer, why just not to change 1 line there? The original version of the MIParser in CDI assumes that any starting digits in the GDB MI output is part of a GDB token (called 'id' in the MiParser). If the non-newline-terminated output from the debugged program contains digits at its start, those digits will be consumed by the MIParser and removed from the output of the debugged program. For example, if the output from the debugged program is "10 Hello World", then the string that is actually printed in the console is " Hello World", i.e. "10" has been 'stolen' by the MIParser. I discovered this behavior when I debugged this problem and developed the patches for both CDI and DSF. In my test program I had multiple non-newline-terminated printf() statements and to separate them more easily I had prepended each output string with a sequence number. This made me notice that the numbers disappeared in the CDI case while they remained in the DSF case. I then compared the MI parsers in DSF and CDI and noticed that this issue had been fixed in DSF. Since the MI parser in DSF is obviously based on the CDI version, I thought it was a good idea to back port this improvement to CDI as well. The changes in MIParser.java are not crucial for this patch. The important changes are in RxThread.java. If you disapprove with the changes in MIParser.java, I can live with that :-) Is there any chance of having this fix included in CDT 8.0.1? Can I do anything to facilitate that? (this is part of a batch change) The CDI debug implementation has been removed in CDT 9.0. Please see bug 484900 and the entry on the New and Noteworthy page https://wiki.eclipse.org/CDT/User/NewIn90#API_modifications |