1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

get the log messages also

This commit is contained in:
Alain Magloire 2002-12-05 16:00:50 +00:00
parent c18e72426c
commit 55dcaf643e
4 changed files with 65 additions and 28 deletions

View file

@ -12,7 +12,18 @@ package org.eclipse.cdt.debug.mi.core;
* *
*/ */
public class MIException extends Exception { public class MIException extends Exception {
String log = "";
public MIException(String s) { public MIException(String s) {
super(s); super(s);
} }
public MIException(String s, String l) {
super(s);
log = l;
}
public String getLogMessage() {
return log;
}
} }

View file

@ -21,4 +21,11 @@ public class ErrorInfo extends SessionObject implements ICDIErrorInfo {
return event.getMessage(); return event.getMessage();
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo#getDetailMessage()
*/
public String getDetailMessage() {
return event.getLogMessage();
}
} }

View file

@ -8,7 +8,10 @@ package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MILogStreamOutput;
import org.eclipse.cdt.debug.mi.core.output.MIOOBRecord;
import org.eclipse.cdt.debug.mi.core.output.MIOutput; import org.eclipse.cdt.debug.mi.core.output.MIOutput;
import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord;
/** /**
* A base class for all mi requests. * A base class for all mi requests.
@ -67,8 +70,16 @@ public abstract class Command
if (out != null) { if (out != null) {
info = new MIInfo(out); info = new MIInfo(out);
if (info.isError()) { if (info.isError()) {
String s = info.getErrorMsg(); String mesg = info.getErrorMsg();
throw new MIException(s); StringBuffer sb = new StringBuffer();
MIOOBRecord[] oobs = out.getMIOOBRecords();
for (int i = 0; i < oobs.length; i++) {
if (oobs[i] instanceof MILogStreamOutput) {
MIStreamRecord o = (MIStreamRecord) oobs[i];
sb.append(o.getString());
}
}
throw new MIException(mesg, sb.toString());
} }
} }
return info; return info;

View file

@ -6,9 +6,11 @@
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.MIConst;
import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput; import org.eclipse.cdt.debug.mi.core.output.MILogStreamOutput;
import org.eclipse.cdt.debug.mi.core.output.MIOOBRecord;
import org.eclipse.cdt.debug.mi.core.output.MIResult; 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.MIResultRecord;
import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord;
import org.eclipse.cdt.debug.mi.core.output.MIValue; import org.eclipse.cdt.debug.mi.core.output.MIValue;
@ -22,14 +24,12 @@ import org.eclipse.cdt.debug.mi.core.output.MIValue;
public class MIErrorEvent extends MIStoppedEvent { public class MIErrorEvent extends MIStoppedEvent {
String msg = ""; String msg = "";
String log = "";
MIOOBRecord[] oobs;
public MIErrorEvent(MIExecAsyncOutput async) { public MIErrorEvent(MIResultRecord rr, MIOOBRecord[] o) {
super(async); super(rr);
parse(); oobs = o;
}
public MIErrorEvent(MIResultRecord record) {
super(record);
parse(); parse();
} }
@ -37,29 +37,37 @@ public class MIErrorEvent extends MIStoppedEvent {
return msg; return msg;
} }
public String getLogMessage() {
return log;
}
void parse () { void parse () {
MIResult[] results = null;
MIExecAsyncOutput exec = getMIExecAsyncOutput();
MIResultRecord rr = getMIResultRecord(); MIResultRecord rr = getMIResultRecord();
if (rr != null) {
MIResult[] 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 (exec != null) { if (var.equals("msg")) {
results = exec.getMIResults(); msg = str;
} 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("msg")) { if (oobs != null) {
msg = str; StringBuffer sb = new StringBuffer();
for (int i = 0; i < oobs.length; i++) {
if (oobs[i] instanceof MILogStreamOutput) {
MIStreamRecord o = (MIStreamRecord)oobs[i];
sb.append(o.getString());
}
} }
log = sb.toString();
} }
} }
} }