mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
New file
This commit is contained in:
parent
c89cc3f9e9
commit
df686f48b1
2 changed files with 115 additions and 0 deletions
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIInferiorSignalExitEvent;
|
||||
|
||||
/**.
|
||||
*/
|
||||
public class SignalExitInfo extends SessionObject implements ICDISignalExitInfo {
|
||||
|
||||
MIInferiorSignalExitEvent event;
|
||||
|
||||
public SignalExitInfo(Session session, MIInferiorSignalExitEvent e) {
|
||||
super(session);
|
||||
event = e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return event.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISignalExitInfo#getDescription()
|
||||
*/
|
||||
public String getDescription() {
|
||||
return event.getMeaning();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* signal 2
|
||||
* "signal 2\n"
|
||||
* ^done,reason="exited-signalled",signal-name="SIGINT",signal-meaning="Interrupt"
|
||||
*
|
||||
*/
|
||||
public class MIInferiorSignalExitEvent extends MIDestroyedEvent {
|
||||
|
||||
String sigName = "";
|
||||
String sigMeaning = "";
|
||||
|
||||
MIExecAsyncOutput exec = null;
|
||||
MIResultRecord rr = null;
|
||||
|
||||
public MIInferiorSignalExitEvent(MIExecAsyncOutput async) {
|
||||
super(async.getToken());
|
||||
exec = async;
|
||||
parse();
|
||||
}
|
||||
|
||||
public MIInferiorSignalExitEvent(MIResultRecord record) {
|
||||
super(record.getToken());
|
||||
rr = record;
|
||||
parse();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return sigName;
|
||||
}
|
||||
|
||||
public String getMeaning() {
|
||||
return sigMeaning;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("signal-name=" + sigName + "\n");;
|
||||
buffer.append("signal-meaning=" + sigMeaning + "\n");;
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
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("signal-name")) {
|
||||
sigName = str;
|
||||
} else if (var.equals("signal-meaning")) {
|
||||
sigMeaning = str;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue