mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 220959
Do not sent target output generated by CLI commands to the target console.
This commit is contained in:
parent
d7635bc046
commit
14259c32e5
1 changed files with 24 additions and 2 deletions
|
@ -38,6 +38,7 @@ import org.eclipse.dd.dsf.debug.service.command.IEventListener;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
import org.eclipse.dd.dsf.service.DsfSession;
|
||||||
import org.eclipse.dd.dsf.service.IDsfService;
|
import org.eclipse.dd.dsf.service.IDsfService;
|
||||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||||
|
import org.eclipse.dd.mi.service.command.commands.CLICommand;
|
||||||
import org.eclipse.dd.mi.service.command.commands.CLIExecAbort;
|
import org.eclipse.dd.mi.service.command.commands.CLIExecAbort;
|
||||||
import org.eclipse.dd.mi.service.command.commands.MIGDBShowExitCode;
|
import org.eclipse.dd.mi.service.command.commands.MIGDBShowExitCode;
|
||||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||||
|
@ -79,6 +80,20 @@ public class MIInferiorProcess extends Process
|
||||||
@ConfinedToDsfExecutor("fSession#getExecutor")
|
@ConfinedToDsfExecutor("fSession#getExecutor")
|
||||||
private boolean fDisposed = false;
|
private boolean fDisposed = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter for tracking console commands sent by services.
|
||||||
|
*
|
||||||
|
* The CLI 'monitor' command produces target output which should
|
||||||
|
* not be written to the target console, since it is in response to a CLI
|
||||||
|
* command. In fact, CLI commands should never have their output sent
|
||||||
|
* to the target console.
|
||||||
|
*
|
||||||
|
* This counter is incremented any time a CLI command is seen. It is
|
||||||
|
* decremented whenever a CLI command is finished. When counter
|
||||||
|
* value is 0, the inferior process writes the target output.
|
||||||
|
*/
|
||||||
|
private int fSuppressTargetOutputCounter = 0;
|
||||||
|
|
||||||
Integer fExitCode = null;
|
Integer fExitCode = null;
|
||||||
|
|
||||||
private State fState = State.RUNNING;
|
private State fState = State.RUNNING;
|
||||||
|
@ -357,6 +372,7 @@ public class MIInferiorProcess extends Process
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (oobr instanceof MITargetStreamOutput) {
|
} else if (oobr instanceof MITargetStreamOutput) {
|
||||||
|
if (fSuppressTargetOutputCounter > 0) return;
|
||||||
MITargetStreamOutput tgtOut = (MITargetStreamOutput)oobr;
|
MITargetStreamOutput tgtOut = (MITargetStreamOutput)oobr;
|
||||||
if (fInputStreamPiped != null && tgtOut.getString() != null) {
|
if (fInputStreamPiped != null && tgtOut.getString() != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -374,14 +390,20 @@ public class MIInferiorProcess extends Process
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commandSent(ICommand<? extends ICommandResult> command) {
|
public void commandSent(ICommand<? extends ICommandResult> command) {
|
||||||
// No action
|
if (command instanceof CLICommand<?>) {
|
||||||
|
fSuppressTargetOutputCounter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commandRemoved(ICommand<? extends ICommandResult> command) {
|
public void commandRemoved(ICommand<? extends ICommandResult> command) {
|
||||||
// No action
|
// No action
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commandDone(ICommand<? extends ICommandResult> cmd, ICommandResult result) {
|
public void commandDone(ICommand<? extends ICommandResult> command, ICommandResult result) {
|
||||||
|
if (command instanceof CLICommand<?>) {
|
||||||
|
fSuppressTargetOutputCounter--;
|
||||||
|
}
|
||||||
|
|
||||||
MIInfo cmdResult = (MIInfo) result ;
|
MIInfo cmdResult = (MIInfo) result ;
|
||||||
MIOutput output = cmdResult.getMIOutput();
|
MIOutput output = cmdResult.getMIOutput();
|
||||||
MIResultRecord rr = output.getMIResultRecord();
|
MIResultRecord rr = output.getMIResultRecord();
|
||||||
|
|
Loading…
Add table
Reference in a new issue