mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
We now parse the MI output and look for "exit-code" for the
exit return value.
This commit is contained in:
parent
7de6e84c6b
commit
b65d77fc75
1 changed files with 58 additions and 0 deletions
|
@ -5,11 +5,69 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.mi.core.event;
|
package org.eclipse.cdt.debug.mi.core.event;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIConst;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIResult;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* *stopped,reason="exited-normally"
|
* *stopped,reason="exited-normally"
|
||||||
|
* *stopped,reason="exited",exit-code="04"
|
||||||
|
* ^done,reason="exited",exit-code="04"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MIInferiorExitEvent extends MIEvent {
|
public class MIInferiorExitEvent extends MIEvent {
|
||||||
|
|
||||||
|
int code = 0;
|
||||||
|
|
||||||
|
MIExecAsyncOutput exec = null;
|
||||||
|
MIResultRecord rr = null;
|
||||||
|
|
||||||
|
public MIInferiorExitEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MIInferiorExitEvent(MIExecAsyncOutput record) {
|
||||||
|
exec = record;
|
||||||
|
parse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MIInferiorExitEvent(MIResultRecord record) {
|
||||||
|
rr = record;
|
||||||
|
parse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExitCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
void parse () {
|
||||||
|
MIResult[] results = null;
|
||||||
|
if (exec != null) {
|
||||||
|
results = exec.getMIResults();
|
||||||
|
} else if (rr != null) {
|
||||||
|
results = rr.getMIResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results != null) {
|
||||||
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
String var = results[i].getVariable();
|
||||||
|
MIValue value = results[i].getMIValue();
|
||||||
|
String str = "";
|
||||||
|
if (value instanceof MIConst) {
|
||||||
|
str = ((MIConst)value).getString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var.equals("exit-code")) {
|
||||||
|
try {
|
||||||
|
code = Integer.parseInt(str.trim());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue