mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
|
@ -702,11 +706,7 @@ public class CDebugTarget extends CDebugElement
|
|||
}
|
||||
else if ( event instanceof ICDIDestroyedEvent )
|
||||
{
|
||||
if ( source instanceof ICDITarget )
|
||||
{
|
||||
handleTerminatedEvent( (ICDIDestroyedEvent)event );
|
||||
}
|
||||
else if ( source instanceof ICDIThread )
|
||||
if ( source instanceof ICDIThread )
|
||||
{
|
||||
handleThreadTerminatedEvent( (ICDIDestroyedEvent)event );
|
||||
}
|
||||
|
@ -1052,6 +1052,18 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
setCurrentStateId( IState.TERMINATED );
|
||||
setCurrentStateInfo( null );
|
||||
IProcess process = getProcess();
|
||||
if ( process != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
process.terminate();
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
CDebugCorePlugin.log( e.getStatus() );
|
||||
}
|
||||
}
|
||||
terminated();
|
||||
}
|
||||
|
||||
|
@ -1059,6 +1071,18 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
setCurrentStateId( IState.DISCONNECTED );
|
||||
setCurrentStateInfo( null );
|
||||
IProcess process = getProcess();
|
||||
if ( process != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
process.terminate();
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
CDebugCorePlugin.log( e.getStatus() );
|
||||
}
|
||||
}
|
||||
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.CommandFactory;
|
||||
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.event.MIExitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIInferiorExitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowExitCodeInfo;
|
||||
|
||||
|
@ -112,6 +114,7 @@ public class MIInferior extends Process {
|
|||
* @see java.lang.Process#destroy()
|
||||
*/
|
||||
public void destroy() {
|
||||
/*
|
||||
if (!isTerminated()) {
|
||||
CommandFactory factory = session.getCommandFactory();
|
||||
MIExecAbort abort = factory.createMIExecAbort();
|
||||
|
@ -122,6 +125,19 @@ public class MIInferior extends Process {
|
|||
} 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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue