Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 202327 Details for
Bug 356085
GDB MI parser in CDT/CDI is broken on Windows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/output/MIParser.java
MIParser.java.patch (text/plain), 3.49 KB, created by
Stefan Bylund
on 2011-08-29 10:29:51 EDT
(
hide
)
Description:
Patch for org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/output/MIParser.java
Filename:
MIME Type:
Creator:
Stefan Bylund
Created:
2011-08-29 10:29:51 EDT
Size:
3.49 KB
patch
obsolete
>--- MIParser.java 2011-08-29 15:02:00.500000000 +0200 >+++ MIParser.java.fix 2011-08-29 15:06:05.613000000 +0200 >@@ -105,39 +105,27 @@ > MIOutput mi = new MIOutput(); > MIResultRecord rr = null; > List oobs = new ArrayList(1); >- int id = -1; > > StringTokenizer st = new StringTokenizer(buffer, "\n"); //$NON-NLS-1$ > while (st.hasMoreTokens()) { > StringBuffer token = new StringBuffer(st.nextToken()); >+ int i = 0; > > // Fetch the Token/Id > if (token.length() > 0 && Character.isDigit(token.charAt(0))) { >- int i = 1; >+ i = 1; > while (i < token.length() && Character.isDigit(token.charAt(i))) { > i++; > } >- String numbers = token.substring(0, i); >- try { >- id = Integer.parseInt(numbers); >- } catch (NumberFormatException e) { >- } >- // Consume the token. >- token.delete(0, i); > } > > // ResultRecord ||| Out-Of-Band Records >- if (token.length() > 0) { >- if (token.charAt(0) == '^') { >- token.deleteCharAt(0); >- rr = processMIResultRecord(token, id); >- } else if (startsWith(token, primaryPrompt)) { >- //break; // Do nothing. >- } else { >- MIOOBRecord band = processMIOOBRecord(token, id); >- if (band != null) { >- oobs.add(band); >- } >+ if (i < token.length() && token.charAt(i) == '^') { >+ rr = processMIResultRecord(token); >+ } else if (!token.toString().startsWith(primaryPrompt, i)) { >+ MIOOBRecord band = processMIOOBRecord(token); >+ if (band != null) { >+ oobs.add(band); > } > } > } >@@ -147,10 +135,31 @@ > return mi; > } > >- /** >- * Assuming '^' was deleted from the Result Record. >- */ >- private MIResultRecord processMIResultRecord(StringBuffer buffer, int id) { >+ private int parseToken(StringBuffer buffer) { >+ int id = -1; >+ // Fetch the Token/Id >+ if (Character.isDigit(buffer.charAt(0))) { >+ int i = 1; >+ while (i < buffer.length() && Character.isDigit(buffer.charAt(i))) { >+ i++; >+ } >+ String numbers = buffer.substring(0, i); >+ try { >+ id = Integer.parseInt(numbers); >+ } catch (NumberFormatException e) { >+ } >+ // Consume the token. >+ buffer.delete(0, i); >+ } >+ return id; >+ } >+ >+ private MIResultRecord processMIResultRecord(StringBuffer buffer) { >+ // Fetch the Token/Id >+ int id = parseToken(buffer); >+ // Consume the '^' >+ buffer.deleteCharAt(0); >+ > MIResultRecord rr = new MIResultRecord(); > rr.setToken(id); > if (buffer.toString().startsWith(MIResultRecord.DONE)) { >@@ -185,9 +194,11 @@ > /** > * Find OutOfBand Records depending on the starting token. > */ >- private MIOOBRecord processMIOOBRecord(StringBuffer buffer, int id) { >+ private MIOOBRecord processMIOOBRecord(StringBuffer buffer) { >+ String line = buffer.toString(); >+ int id = parseToken(buffer); > MIOOBRecord oob = null; >- char c = buffer.charAt(0); >+ char c = buffer.length() != 0 ? buffer.charAt(0) : 0; > if (c == '*' || c == '+' || c == '=') { > // Consume the first char > buffer.deleteCharAt(0); >@@ -242,10 +253,9 @@ > } else { > // Badly format MI line, just pass it to the user as target stream > MIStreamRecord stream = new MITargetStreamOutput(); >- String res = buffer.toString(); > // this awfull expression just mean to replace \ with \\. This is needed because otherwise escaping is lost. > // this is to fix bug 255946 without breaking other stuff 286785 >- res = res.replaceAll("\\Q\\", "\\\\\\\\"); //$NON-NLS-1$//$NON-NLS-2$ >+ String res = line.replaceAll("\\Q\\", "\\\\\\\\"); //$NON-NLS-1$//$NON-NLS-2$ > stream.setCString(res + "\n"); //$NON-NLS-1$ > oob = stream; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 356085
:
202325
|
202326
| 202327