mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
processCLICommand() new method.
This commit is contained in:
parent
e5540c5ea1
commit
5c88b5c611
1 changed files with 47 additions and 1 deletions
|
@ -8,7 +8,10 @@ package org.eclipse.cdt.debug.mi.core;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.Command;
|
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIRunningEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transmission command thread blocks on the command Queue
|
* Transmission command thread blocks on the command Queue
|
||||||
|
@ -55,7 +58,12 @@ public class TxThread extends Thread {
|
||||||
cmd.notifyAll();
|
cmd.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// May need to fire event.
|
||||||
|
if (cmd instanceof CLICommand) {
|
||||||
|
processCLICommand((CLICommand)cmd);
|
||||||
|
}
|
||||||
|
|
||||||
// shove in the pipe
|
// shove in the pipe
|
||||||
String str = cmd.toString();
|
String str = cmd.toString();
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
|
@ -79,4 +87,42 @@ public class TxThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An attempt to discover the command type and
|
||||||
|
* fire an event if necessary.
|
||||||
|
*/
|
||||||
|
void processCLICommand(CLICommand cmd) {
|
||||||
|
String operation = cmd.getOperation();
|
||||||
|
int indx = operation.indexOf(' ');
|
||||||
|
if (indx != -1) {
|
||||||
|
operation = operation.substring(0, indx).trim();
|
||||||
|
} else {
|
||||||
|
operation = operation.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the type of command
|
||||||
|
int type = -1;
|
||||||
|
// if it was a step instruction set state running
|
||||||
|
if (operation.equals("n") || operation.equals("next")) {
|
||||||
|
type = MIRunningEvent.NEXT;
|
||||||
|
} else if (operation.equals("ni") || operation.equals("nexti")) {
|
||||||
|
type = MIRunningEvent.NEXTI;
|
||||||
|
} else if (operation.equals("s") || operation.equals("step")) {
|
||||||
|
type = MIRunningEvent.STEP;
|
||||||
|
} else if (operation.equals("si") || operation.equals("stepi")) {
|
||||||
|
type = MIRunningEvent.STEPI;
|
||||||
|
} else if (operation.equals("u") || operation.startsWith("unt")) {
|
||||||
|
type = MIRunningEvent.UNTIL;
|
||||||
|
} else if (operation.startsWith("fin")) {
|
||||||
|
type = MIRunningEvent.FINISH;
|
||||||
|
} else if (operation.equals("c") || operation.equals("fg") || operation.startsWith("cont")) {
|
||||||
|
type = MIRunningEvent.CONTINUE;
|
||||||
|
}
|
||||||
|
if (type != -1) {
|
||||||
|
session.getMIInferior().setRunning();
|
||||||
|
MIEvent event = new MIRunningEvent(type);
|
||||||
|
session.fireEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue