mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Changed the termination procedure.
This commit is contained in:
parent
60da64d862
commit
a07d1424da
2 changed files with 46 additions and 6 deletions
|
@ -670,7 +670,11 @@ public class CDebugTarget extends CDebugElement
|
||||||
public void handleDebugEvent( ICDIEvent event )
|
public void handleDebugEvent( ICDIEvent event )
|
||||||
{
|
{
|
||||||
ICDIObject source = event.getSource();
|
ICDIObject source = event.getSource();
|
||||||
if ( source.getTarget().equals( getCDITarget() ) )
|
if ( source == null && event instanceof ICDIDestroyedEvent )
|
||||||
|
{
|
||||||
|
handleTerminatedEvent( (ICDIDestroyedEvent)event );
|
||||||
|
}
|
||||||
|
else if ( source.getTarget().equals( getCDITarget() ) )
|
||||||
{
|
{
|
||||||
if ( event instanceof ICDICreatedEvent )
|
if ( event instanceof ICDICreatedEvent )
|
||||||
{
|
{
|
||||||
|
@ -702,11 +706,7 @@ public class CDebugTarget extends CDebugElement
|
||||||
}
|
}
|
||||||
else if ( event instanceof ICDIDestroyedEvent )
|
else if ( event instanceof ICDIDestroyedEvent )
|
||||||
{
|
{
|
||||||
if ( source instanceof ICDITarget )
|
if ( source instanceof ICDIThread )
|
||||||
{
|
|
||||||
handleTerminatedEvent( (ICDIDestroyedEvent)event );
|
|
||||||
}
|
|
||||||
else if ( source instanceof ICDIThread )
|
|
||||||
{
|
{
|
||||||
handleThreadTerminatedEvent( (ICDIDestroyedEvent)event );
|
handleThreadTerminatedEvent( (ICDIDestroyedEvent)event );
|
||||||
}
|
}
|
||||||
|
@ -1052,6 +1052,18 @@ public class CDebugTarget extends CDebugElement
|
||||||
{
|
{
|
||||||
setCurrentStateId( IState.TERMINATED );
|
setCurrentStateId( IState.TERMINATED );
|
||||||
setCurrentStateInfo( null );
|
setCurrentStateInfo( null );
|
||||||
|
IProcess process = getProcess();
|
||||||
|
if ( process != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
process.terminate();
|
||||||
|
}
|
||||||
|
catch( DebugException e )
|
||||||
|
{
|
||||||
|
CDebugCorePlugin.log( e.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
terminated();
|
terminated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,6 +1071,18 @@ public class CDebugTarget extends CDebugElement
|
||||||
{
|
{
|
||||||
setCurrentStateId( IState.DISCONNECTED );
|
setCurrentStateId( IState.DISCONNECTED );
|
||||||
setCurrentStateInfo( null );
|
setCurrentStateInfo( null );
|
||||||
|
IProcess process = getProcess();
|
||||||
|
if ( process != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
process.terminate();
|
||||||
|
}
|
||||||
|
catch( DebugException e )
|
||||||
|
{
|
||||||
|
CDebugCorePlugin.log( e.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
disconnected();
|
disconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,9 @@ import java.io.OutputStream;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecAbort;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecAbort;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIGDBExit;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode;
|
import org.eclipse.cdt.debug.mi.core.command.MIGDBShowExitCode;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.event.MIExitEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo;
|
||||||
|
|
||||||
|
@ -112,6 +114,7 @@ public class MIInferior extends Process {
|
||||||
* @see java.lang.Process#destroy()
|
* @see java.lang.Process#destroy()
|
||||||
*/
|
*/
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
/*
|
||||||
if (!isTerminated()) {
|
if (!isTerminated()) {
|
||||||
CommandFactory factory = session.getCommandFactory();
|
CommandFactory factory = session.getCommandFactory();
|
||||||
MIExecAbort abort = factory.createMIExecAbort();
|
MIExecAbort abort = factory.createMIExecAbort();
|
||||||
|
@ -122,6 +125,19 @@ public class MIInferior extends Process {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if (!isSuspended())
|
||||||
|
{
|
||||||
|
// interrupt execution
|
||||||
|
}
|
||||||
|
CommandFactory factory = session.getCommandFactory();
|
||||||
|
MIGDBExit exit = factory.createMIGDBExit();
|
||||||
|
try {
|
||||||
|
session.postCommand(exit);
|
||||||
|
setTerminated();
|
||||||
|
session.getRxThread().fireEvent(new MIExitEvent());
|
||||||
|
} catch (MIException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean isSuspended() {
|
public synchronized boolean isSuspended() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue