Skip to content
Browse files

proper disconnect behaviour

  • Loading branch information...
1 parent bd384b8 commit 57a2c010a809805abad5e4c8cc57c44f44a739ea @JPMoresmau committed Oct 24, 2012
View
2 docs/releasenotes/net.sf.eclipsefp.haskell_2.3.2.txt
@@ -15,6 +15,8 @@ Fixes:
- only accept ascii characters in project names, since accented characters do not work well with gcc and such
- adding a list to cabal (example: data-files) via the ui does not mess the cabal file
- synchronize operations do not block other operations
+ - Terminating a debugging session when stopped at a breakpoint removes correctly breakpoint marker in code
+ - Terminating a debugging session correctly forbids to resume execution (restart a new session)
Features:
- Specify the cabal stanza you want to use settings from when checking a file in the editor
View
26 ...debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/debug/HaskellDebugTarget.java
@@ -59,6 +59,7 @@
private boolean connected=true;
+ private boolean disposed=false;
private boolean atEnd=false;
private final HaskellThread thread=new HaskellThread( this );
@@ -143,13 +144,13 @@ public ILaunch getLaunch() {
@Override
public boolean canTerminate() {
- return fProcess.canTerminate();
+ return !disposed && (!connected || fProcess.canTerminate());
}
@Override
public boolean isTerminated() {
- boolean t=fProcess.isTerminated();
- if (t && connected){
+ boolean t=fProcess.isTerminated() || disposed;
+ if (t && !disposed){
dispose();
}
return t;
@@ -189,14 +190,22 @@ private synchronized void waitForPrompt(){
@Override
public void terminate() throws DebugException {
-
- sendRequest( GHCiSyntax.QUIT_COMMAND,false );
+ if (isSuspended()){
+ thread.setBreakpoint( null );
+ thread.setStopLocation( null );
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[]{new DebugEvent( thread, DebugEvent.RESUME )});
+ }
+ // if disconnected, leave GHCi running
+ if (connected){
+ sendRequest( GHCiSyntax.QUIT_COMMAND,false );
+ }
dispose();
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[]{new DebugEvent( this, DebugEvent.TERMINATE ),new DebugEvent( thread, DebugEvent.TERMINATE )});
}
@Override
public boolean canResume() {
- return isSuspended();
+ return connected && isSuspended();
}
@Override
@@ -303,19 +312,20 @@ public boolean canDisconnect() {
@Override
public void disconnect() throws DebugException {
- dispose();
+
try {
// TODO take out GHCi specific
sendRequest(GHCiSyntax.DELETE_ALL_BREAKPOINTS_COMMAND,true);
} catch (CoreException e) {
throw new DebugException(new Status(IStatus.ERROR,HaskellDebugCore.getPluginId(),e.getLocalizedMessage(),e));
}
-
+ dispose();
}
public void dispose(){
connected=false;
+ disposed=true;
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this );
}

0 comments on commit 57a2c01

Please sign in to comment.
Something went wrong with that request. Please try again.