mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Parsing of Variable Objects.
This commit is contained in:
parent
42edb8b4d2
commit
1c66d960ea
7 changed files with 35 additions and 25 deletions
|
@ -10,24 +10,25 @@ package org.eclipse.cdt.debug.mi.core.output;
|
||||||
* ^done,numchild="6",children={child={name="var2.0",exp="0",numchild="0",type="char"},child={name="var2.1",exp="1",numchild="0",type="char"},child={name="var2.2",exp="2",numchild="0",type="char"},child={name="var2.3",exp="3",numchild="0",type="char"},child={name="var2.4",exp="4",numchild="0",type="char"},child={name="var2.5",exp="5",numchild="0",type="char"}}
|
* ^done,numchild="6",children={child={name="var2.0",exp="0",numchild="0",type="char"},child={name="var2.1",exp="1",numchild="0",type="char"},child={name="var2.2",exp="2",numchild="0",type="char"},child={name="var2.3",exp="3",numchild="0",type="char"},child={name="var2.4",exp="4",numchild="0",type="char"},child={name="var2.5",exp="5",numchild="0",type="char"}}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MIChild {
|
public class MIVar {
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
String type = "";
|
String type = "";
|
||||||
|
String exp = "";
|
||||||
int numchild;
|
int numchild;
|
||||||
|
|
||||||
|
|
||||||
public MIChild(String n, int num, String t) {
|
public MIVar(String n, int num, String t) {
|
||||||
name = n;
|
name = n;
|
||||||
numchild = num;
|
numchild = num;
|
||||||
type = t;
|
type = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIChild(MITuple tuple) {
|
public MIVar(MITuple tuple) {
|
||||||
parse(tuple);
|
parse(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getVarName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +40,10 @@ public class MIChild {
|
||||||
return numchild;
|
return numchild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getExp() {
|
||||||
|
return exp;
|
||||||
|
}
|
||||||
|
|
||||||
void parse(MITuple tuple) {
|
void parse(MITuple tuple) {
|
||||||
MIResult[] results = tuple.getMIResults();
|
MIResult[] results = tuple.getMIResults();
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
@ -58,6 +63,8 @@ public class MIChild {
|
||||||
name = str;
|
name = str;
|
||||||
} else if (var.equals("type")) {
|
} else if (var.equals("type")) {
|
||||||
type = str;
|
type = str;
|
||||||
|
} else if (var.equals("exp")) {
|
||||||
|
exp = str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,15 +8,19 @@ package org.eclipse.cdt.debug.mi.core.output;
|
||||||
* GDB/MI var-update.
|
* GDB/MI var-update.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MIChange {
|
public class MIVarChange {
|
||||||
String name;
|
String name;
|
||||||
boolean inScope;
|
boolean inScope;
|
||||||
boolean changed;
|
boolean changed;
|
||||||
|
|
||||||
public MIChange(String n) {
|
public MIVarChange(String n) {
|
||||||
name = n;
|
name = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVarName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isInScope() {
|
public boolean isInScope() {
|
||||||
return inScope;
|
return inScope;
|
||||||
}
|
}
|
|
@ -15,16 +15,16 @@ public class MIVarCreateInfo extends MIInfo {
|
||||||
String name = "";
|
String name = "";
|
||||||
int numChild;
|
int numChild;
|
||||||
String type = "";
|
String type = "";
|
||||||
MIChild child;
|
MIVar child;
|
||||||
|
|
||||||
public MIVarCreateInfo(MIOutput record) {
|
public MIVarCreateInfo(MIOutput record) {
|
||||||
super(record);
|
super(record);
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIChild getMIChild() {
|
public MIVar getMIVar() {
|
||||||
if (child == null) {
|
if (child == null) {
|
||||||
child = new MIChild(name, numChild, type);
|
child = new MIVar(name, numChild, type);
|
||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class MIVarEvaluateExpressionInfo extends MIInfo {
|
||||||
MIResult[] results = rr.getMIResults();
|
MIResult[] results = rr.getMIResults();
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
String var = results[i].getVariable();
|
String var = results[i].getVariable();
|
||||||
if (var.equals("name")) {
|
if (var.equals("value")) {
|
||||||
MIValue val = results[i].getMIValue();
|
MIValue val = results[i].getMIValue();
|
||||||
if (val instanceof MIConst) {
|
if (val instanceof MIConst) {
|
||||||
value = ((MIConst)val).getString();
|
value = ((MIConst)val).getString();
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class MIVarListChildrenInfo extends MIInfo {
|
public class MIVarListChildrenInfo extends MIInfo {
|
||||||
|
|
||||||
MIChild[] children;
|
MIVar[] children;
|
||||||
int numchild;
|
int numchild;
|
||||||
|
|
||||||
public MIVarListChildrenInfo(MIOutput record) {
|
public MIVarListChildrenInfo(MIOutput record) {
|
||||||
|
@ -23,7 +23,7 @@ public class MIVarListChildrenInfo extends MIInfo {
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIChild[] getChildren() {
|
public MIVar[] getMIVars() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class MIVarListChildrenInfo extends MIInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
children = (MIChild[])aList.toArray(new MIChild[aList.size()]);
|
children = (MIVar[])aList.toArray(new MIVar[aList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseChildren(MITuple tuple, List aList) {
|
void parseChildren(MITuple tuple, List aList) {
|
||||||
|
@ -64,7 +64,7 @@ public class MIVarListChildrenInfo extends MIInfo {
|
||||||
if (var.equals("child")) {
|
if (var.equals("child")) {
|
||||||
MIValue value = results[i].getMIValue();
|
MIValue value = results[i].getMIValue();
|
||||||
if (value instanceof MITuple) {
|
if (value instanceof MITuple) {
|
||||||
aList.add(new MIChild((MITuple)value));
|
aList.add(new MIVar((MITuple)value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ public class MIVarShowAttributesInfo extends MIInfo {
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEditable() {
|
||||||
|
return attr.equals("editable");
|
||||||
|
}
|
||||||
|
|
||||||
void parse() {
|
void parse() {
|
||||||
if (isDone()) {
|
if (isDone()) {
|
||||||
MIOutput out = getMIOutput();
|
MIOutput out = getMIOutput();
|
||||||
|
|
|
@ -14,20 +14,14 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class MIVarUpdateInfo extends MIInfo {
|
public class MIVarUpdateInfo extends MIInfo {
|
||||||
|
|
||||||
public class Change {
|
MIVarChange[] changeList;
|
||||||
String name;
|
|
||||||
boolean inScope;
|
|
||||||
boolean changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
MIChange[] changeList;
|
|
||||||
|
|
||||||
public MIVarUpdateInfo(MIOutput record) {
|
public MIVarUpdateInfo(MIOutput record) {
|
||||||
super(record);
|
super(record);
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIChange[] getChangeList () {
|
public MIVarChange[] getMIVarChanges() {
|
||||||
return changeList;
|
return changeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,12 +43,12 @@ public class MIVarUpdateInfo extends MIInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changeList = (MIChange[])aList.toArray(new MIChange[aList.size()]);
|
changeList = (MIVarChange[])aList.toArray(new MIVarChange[aList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseChangeList(MITuple tuple, List aList) {
|
void parseChangeList(MITuple tuple, List aList) {
|
||||||
MIResult[] results = tuple.getMIResults();
|
MIResult[] results = tuple.getMIResults();
|
||||||
MIChange change = null;
|
MIVarChange change = null;
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
String var = results[i].getVariable();
|
String var = results[i].getVariable();
|
||||||
MIValue value = results[i].getMIValue();
|
MIValue value = results[i].getMIValue();
|
||||||
|
@ -63,7 +57,8 @@ public class MIVarUpdateInfo extends MIInfo {
|
||||||
str = ((MIConst)value).getString();
|
str = ((MIConst)value).getString();
|
||||||
}
|
}
|
||||||
if (var.equals("name")) {
|
if (var.equals("name")) {
|
||||||
change = new MIChange(str);
|
change = new MIVarChange(str);
|
||||||
|
System.out.println("Changelist " + str);
|
||||||
aList.add(change);
|
aList.add(change);
|
||||||
} else if (var.equals("in_scope")) {
|
} else if (var.equals("in_scope")) {
|
||||||
if (change != null) {
|
if (change != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue