|
Lines 18-27
Link Here
|
| 18 |
import java.io.OutputStream; |
18 |
import java.io.OutputStream; |
| 19 |
import java.io.PipedInputStream; |
19 |
import java.io.PipedInputStream; |
| 20 |
import java.io.PipedOutputStream; |
20 |
import java.io.PipedOutputStream; |
|
|
21 |
import java.util.ArrayList; |
| 22 |
import java.util.List; |
| 21 |
import java.util.Observable; |
23 |
import java.util.Observable; |
| 22 |
|
24 |
|
| 23 |
import org.eclipse.cdt.debug.mi.core.command.Command; |
25 |
import org.eclipse.cdt.debug.mi.core.command.Command; |
| 24 |
import org.eclipse.cdt.debug.mi.core.command.CommandFactory; |
26 |
import org.eclipse.cdt.debug.mi.core.command.CommandFactory; |
|
|
27 |
import org.eclipse.cdt.debug.mi.core.command.MICommand; |
| 25 |
import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt; |
28 |
import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt; |
| 26 |
import org.eclipse.cdt.debug.mi.core.command.MIGDBExit; |
29 |
import org.eclipse.cdt.debug.mi.core.command.MIGDBExit; |
| 27 |
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; |
30 |
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet; |
|
Lines 31-39
Link Here
|
| 31 |
import org.eclipse.cdt.debug.mi.core.command.MIVersion; |
34 |
import org.eclipse.cdt.debug.mi.core.command.MIVersion; |
| 32 |
import org.eclipse.cdt.debug.mi.core.event.MIEvent; |
35 |
import org.eclipse.cdt.debug.mi.core.event.MIEvent; |
| 33 |
import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent; |
36 |
import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent; |
|
|
37 |
import org.eclipse.cdt.debug.mi.core.output.MIBreakInsertInfo; |
| 38 |
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint; |
| 39 |
import org.eclipse.cdt.debug.mi.core.output.MIConst; |
| 34 |
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo; |
40 |
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo; |
|
|
41 |
import org.eclipse.cdt.debug.mi.core.output.MIInfo; |
| 42 |
import org.eclipse.cdt.debug.mi.core.output.MIList; |
| 35 |
import org.eclipse.cdt.debug.mi.core.output.MIOutput; |
43 |
import org.eclipse.cdt.debug.mi.core.output.MIOutput; |
| 36 |
import org.eclipse.cdt.debug.mi.core.output.MIParser; |
44 |
import org.eclipse.cdt.debug.mi.core.output.MIParser; |
|
|
45 |
import org.eclipse.cdt.debug.mi.core.output.MIResult; |
| 46 |
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord; |
| 47 |
import org.eclipse.cdt.debug.mi.core.output.MITuple; |
| 48 |
import org.eclipse.cdt.debug.mi.core.output.MIValue; |
| 37 |
import org.eclipse.core.runtime.IProgressMonitor; |
49 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 38 |
import org.eclipse.core.runtime.NullProgressMonitor; |
50 |
import org.eclipse.core.runtime.NullProgressMonitor; |
| 39 |
|
51 |
|
|
Lines 111-116
Link Here
|
| 111 |
*/ |
123 |
*/ |
| 112 |
public MISession(MIProcess process, IMITTY tty, int type, int commandTimeout, int launchTimeout, String miVersion, IProgressMonitor monitor) throws MIException { |
124 |
public MISession(MIProcess process, IMITTY tty, int type, int commandTimeout, int launchTimeout, String miVersion, IProgressMonitor monitor) throws MIException { |
| 113 |
this(process, tty, type, new CommandFactory(miVersion), commandTimeout, launchTimeout, monitor); |
125 |
this(process, tty, type, new CommandFactory(miVersion), commandTimeout, launchTimeout, monitor); |
|
|
126 |
inqureGDBFeatures(); |
| 114 |
} |
127 |
} |
| 115 |
|
128 |
|
| 116 |
|
129 |
|
|
Lines 130-135
Link Here
|
| 130 |
// if exec console is present, assume MI2 supported |
143 |
// if exec console is present, assume MI2 supported |
| 131 |
setCommandFactory(new CommandFactory(MIVersion.MI2)); |
144 |
setCommandFactory(new CommandFactory(MIVersion.MI2)); |
| 132 |
} |
145 |
} |
|
|
146 |
inqureGDBFeatures(); |
| 133 |
} |
147 |
} |
| 134 |
|
148 |
|
| 135 |
/** |
149 |
/** |
|
Lines 166-171
Link Here
|
| 166 |
|
180 |
|
| 167 |
// initialize/setup |
181 |
// initialize/setup |
| 168 |
setup(launchTimeout, new NullProgressMonitor()); |
182 |
setup(launchTimeout, new NullProgressMonitor()); |
|
|
183 |
inqureGDBFeatures(); |
| 169 |
} |
184 |
} |
| 170 |
|
185 |
|
| 171 |
/** |
186 |
/** |
|
Lines 179-185
Link Here
|
| 179 |
* |
194 |
* |
| 180 |
* @since 3.1 |
195 |
* @since 3.1 |
| 181 |
*/ |
196 |
*/ |
| 182 |
public MISession(MIProcess process, IMITTY tty, int type, CommandFactory commandFactory, int commandTimeout) throws MIException { |
197 |
public MISession(MIProcess process, IMITTY tty, int type, CommandFactory commandFactory, int commandTimeout) throws MIException { |
| 183 |
gdbProcess = process; |
198 |
gdbProcess = process; |
| 184 |
inChannel = process.getInputStream(); |
199 |
inChannel = process.getInputStream(); |
| 185 |
outChannel = process.getOutputStream(); |
200 |
outChannel = process.getOutputStream(); |
|
Lines 205-211
Link Here
|
| 205 |
|
220 |
|
| 206 |
txThread.start(); |
221 |
txThread.start(); |
| 207 |
rxThread.start(); |
222 |
rxThread.start(); |
| 208 |
eventThread.start(); |
223 |
eventThread.start(); |
|
|
224 |
|
| 225 |
inqureGDBFeatures(); |
| 209 |
} |
226 |
} |
| 210 |
|
227 |
|
| 211 |
/** |
228 |
/** |
|
Lines 860-863
Link Here
|
| 860 |
public final void setBreakpointsWithFullName(boolean breakpointsWithFullName) { |
877 |
public final void setBreakpointsWithFullName(boolean breakpointsWithFullName) { |
| 861 |
this.breakpointsWithFullName = breakpointsWithFullName; |
878 |
this.breakpointsWithFullName = breakpointsWithFullName; |
| 862 |
} |
879 |
} |
|
|
880 |
|
| 881 |
|
| 882 |
private final void inqureGDBFeatures() { |
| 883 |
try{ |
| 884 |
MIGdbListFearutes features = new MIGdbListFearutes(null); |
| 885 |
postCommand(features); |
| 886 |
factory.setMIPendingBreakpointEnabled(features.getMIInfo().pendingBrekpoints); |
| 887 |
}catch(MIException e){ |
| 888 |
e.printStackTrace(); |
| 889 |
} |
| 890 |
} |
| 891 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 892 |
static class MIGdbListFearutes extends MICommand{ |
| 893 |
boolean pendingBrekpoints; |
| 894 |
boolean threadInfo; |
| 895 |
boolean frozenVarobjs; |
| 896 |
|
| 897 |
public MIGdbListFearutes(String miVersion) { |
| 898 |
super(miVersion, "-list-features"); //$NON-NLS-1$ |
| 899 |
setParameters(new String[]{""}); |
| 900 |
} |
| 901 |
|
| 902 |
|
| 903 |
public MIGdbFeaturesInfo getMIInfo() throws MIException { |
| 904 |
MIGdbFeaturesInfo info = null; |
| 905 |
MIOutput out = getMIOutput(); |
| 906 |
if (out != null) { |
| 907 |
info = new MIGdbFeaturesInfo(out); |
| 908 |
if (info.isError()) { |
| 909 |
throwMIException(info, out); |
| 910 |
} |
| 911 |
} |
| 912 |
return info; |
| 913 |
} |
| 914 |
|
| 915 |
} |
| 916 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 917 |
public static class MIGdbFeaturesInfo extends MIInfo{ |
| 918 |
boolean pendingBrekpoints; |
| 919 |
boolean threadInfo; |
| 920 |
boolean frozenVarobjs; |
| 921 |
|
| 922 |
public MIGdbFeaturesInfo(MIOutput record) { |
| 923 |
super(record); |
| 924 |
parse(); |
| 925 |
} |
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
void parse() { |
| 930 |
//List aList = new ArrayList(1); |
| 931 |
if (isDone()) { |
| 932 |
MIOutput out = getMIOutput(); |
| 933 |
MIResultRecord rr = out.getMIResultRecord(); |
| 934 |
if (rr != null) { |
| 935 |
MIResult[] results = rr.getMIResults(); |
| 936 |
for (int i = 0; i < results.length; i++) { |
| 937 |
String var = results[i].getVariable(); |
| 938 |
MIList valList = (MIList)(results[i].getMIValue()); |
| 939 |
MIValue[] values = valList.getMIValues(); |
| 940 |
for(int j=0;j<values.length;++j){ |
| 941 |
String val=((MIConst)values[j]).getString(); |
| 942 |
if("pending-breakpoints".equals(val)){ |
| 943 |
pendingBrekpoints = true; |
| 944 |
} else if("thread-info".equals(val)){ |
| 945 |
threadInfo = true; |
| 946 |
} else if("frozen-varobjs".equals(val)){ |
| 947 |
frozenVarobjs = true; |
| 948 |
} |
| 949 |
} |
| 950 |
} |
| 951 |
|
| 952 |
} |
| 953 |
} |
| 954 |
|
| 955 |
} |
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
} |
| 960 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 863 |
} |
961 |
} |