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:
parent
c18e72426c
commit
55dcaf643e
4 changed files with 65 additions and 28 deletions
|
@ -12,7 +12,18 @@ package org.eclipse.cdt.debug.mi.core;
|
|||
*
|
||||
*/
|
||||
public class MIException extends Exception {
|
||||
String log = "";
|
||||
|
||||
public MIException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public MIException(String s, String l) {
|
||||
super(s);
|
||||
log = l;
|
||||
}
|
||||
|
||||
public String getLogMessage() {
|
||||
return log;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,11 @@ public class ErrorInfo extends SessionObject implements ICDIErrorInfo {
|
|||
return event.getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo#getDetailMessage()
|
||||
*/
|
||||
public String getDetailMessage() {
|
||||
return event.getLogMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.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.MIStreamRecord;
|
||||
|
||||
/**
|
||||
* A base class for all mi requests.
|
||||
|
@ -67,8 +70,16 @@ public abstract class Command
|
|||
if (out != null) {
|
||||
info = new MIInfo(out);
|
||||
if (info.isError()) {
|
||||
String s = info.getErrorMsg();
|
||||
throw new MIException(s);
|
||||
String mesg = info.getErrorMsg();
|
||||
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;
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
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.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.MIResultRecord;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord;
|
||||
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 {
|
||||
|
||||
String msg = "";
|
||||
String log = "";
|
||||
MIOOBRecord[] oobs;
|
||||
|
||||
public MIErrorEvent(MIExecAsyncOutput async) {
|
||||
super(async);
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIErrorEvent(MIResultRecord record) {
|
||||
super(record);
|
||||
public MIErrorEvent(MIResultRecord rr, MIOOBRecord[] o) {
|
||||
super(rr);
|
||||
oobs = o;
|
||||
parse();
|
||||
}
|
||||
|
||||
|
@ -37,29 +37,37 @@ public class MIErrorEvent extends MIStoppedEvent {
|
|||
return msg;
|
||||
}
|
||||
|
||||
public String getLogMessage() {
|
||||
return log;
|
||||
}
|
||||
|
||||
void parse () {
|
||||
MIResult[] results = null;
|
||||
MIExecAsyncOutput exec = getMIExecAsyncOutput();
|
||||
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) {
|
||||
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("msg")) {
|
||||
msg = str;
|
||||
}
|
||||
}
|
||||
|
||||
if (var.equals("msg")) {
|
||||
msg = str;
|
||||
}
|
||||
if (oobs != null) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue