mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-15 20:25:46 +02:00
Bug 124966: GDBTypeParser.parse(String) parses incorrectly. Applied patch from Matthias Spycher (matthias@coware.com).
This commit is contained in:
parent
ef1cb915f1
commit
06c2cfafd5
2 changed files with 41 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2006-01-31 Mikhail Khodjaiants
|
||||||
|
Bug 124966: GDBTypeParser.parse(String) parses incorrectly.
|
||||||
|
Applied patch from Matthias Spycher (matthias@coware.com).
|
||||||
|
* GDBTypeParser.java
|
||||||
|
|
||||||
2006-01-27 Mikhail Khodjaiants
|
2006-01-27 Mikhail Khodjaiants
|
||||||
Bug 107202: slow debug launch with external sources.
|
Bug 107202: slow debug launch with external sources.
|
||||||
Use "-p" option when passing a large number of directories to "cygpath".
|
Use "-p" option when passing a large number of directories to "cygpath".
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Matthias Spycher (matthias@coware.com) - bug 124966
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.mi.core;
|
package org.eclipse.cdt.debug.mi.core;
|
||||||
|
@ -82,13 +83,16 @@ public class GDBTypeParser {
|
||||||
// Hack for GDB, the typename can be something like
|
// Hack for GDB, the typename can be something like
|
||||||
// class A : public B, C { ... } *
|
// class A : public B, C { ... } *
|
||||||
// We are only interested in "class A"
|
// We are only interested in "class A"
|
||||||
// Carefull for class A::data
|
// Carefull for class A::data or class ns::A<ns::data>
|
||||||
int column = dataType.indexOf(':');
|
int column = dataType.indexOf(':');
|
||||||
if (column > 0) {
|
while (column > 0) {
|
||||||
if ((column + 1) < dataType.length() && dataType.charAt(column + 1) != ':') {
|
if ((column + 2) < dataType.length() && dataType.charAt(column + 1) == ':') {
|
||||||
dataType = dataType.substring(0, column);
|
column = dataType.indexOf(':', column+2);
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
|
dataType = dataType.substring(0, column);
|
||||||
|
break;
|
||||||
|
}
|
||||||
genericType = new GDBType(dataType);
|
genericType = new GDBType(dataType);
|
||||||
|
|
||||||
// Start the recursive parser.
|
// Start the recursive parser.
|
||||||
|
@ -336,13 +340,29 @@ public class GDBTypeParser {
|
||||||
}
|
}
|
||||||
tokenType = BRACKETS;
|
tokenType = BRACKETS;
|
||||||
} else if (isCIdentifierStart(c)) {
|
} else if (isCIdentifierStart(c)) {
|
||||||
token = "" + (char) c; //$NON-NLS-1$
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append((char) c);
|
||||||
while (isCIdentifierPart((c = getch())) && c != EOF) {
|
while (isCIdentifierPart((c = getch())) && c != EOF) {
|
||||||
token += (char) c;
|
sb.append((char) c);
|
||||||
}
|
}
|
||||||
if (c != EOF) {
|
if (c == '<') {
|
||||||
|
// Swallow template args in types like "class foobar<A,B> : public C {..} *"
|
||||||
|
// FIXME: if the bracket is not terminate do we throw exception?
|
||||||
|
sb.append((char) c);
|
||||||
|
int count = 1;
|
||||||
|
do {
|
||||||
|
c = getch();
|
||||||
|
if (c == '<') {
|
||||||
|
count++;
|
||||||
|
} else if (c == '>') {
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
sb.append((char)c);
|
||||||
|
} while (count > 0 && c != EOF);
|
||||||
|
} else if (c != EOF) {
|
||||||
ungetch();
|
ungetch();
|
||||||
}
|
}
|
||||||
|
token = sb.toString();
|
||||||
tokenType = NAME;
|
tokenType = NAME;
|
||||||
} else if (c == '{') {
|
} else if (c == '{') {
|
||||||
// Swallow gdb sends things like "struct foobar {..} *"
|
// Swallow gdb sends things like "struct foobar {..} *"
|
||||||
|
@ -464,7 +484,13 @@ public class GDBTypeParser {
|
||||||
System.out.println(parser.getGDBType().verbose());
|
System.out.println(parser.getGDBType().verbose());
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
System.out.println("char **argv"); //$NON-NLS-1$
|
System.out.println("class ns::link<8, ns::A> : public ns::B { int i; int j; struct link * next;} *"); //$NON-NLS-1$
|
||||||
|
parser.parse("class ns::link<8, ns::A> : public ns::B { int i; int j; struct link * next;} *"); //$NON-NLS-1$
|
||||||
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
|
System.out.println(parser.getGDBType().verbose());
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
System.out.println("char **argv"); //$NON-NLS-1$
|
||||||
parser.parse("char **argv"); //$NON-NLS-1$
|
parser.parse("char **argv"); //$NON-NLS-1$
|
||||||
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
System.out.println(GDBTypeParser.unParse(parser.getGDBType()));
|
||||||
System.out.println(parser.getGDBType().verbose());
|
System.out.println(parser.getGDBType().verbose());
|
||||||
|
|
Loading…
Add table
Reference in a new issue