Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-debug-dev] remove a thread from UI after terminating/disconnecting a process

Hi,
 
This is an issue found in CDT debugger but it's more related to platform debugger code. I know some platform debugger gurus like Darin are on the list, so I'm sending this here.
 
I see this bug in our Nokia CDT-based debugger, but it's a generic problem in any CDT debugger.
 
During a debug session with multiple processes in Launch View,  I select a process (target) and click the "Disconnect" command, then the process is shown as "disconnected" in Launch View but its threads and stackframes remain in the view, which is not good. 
 
I can work around the bug by changing CDT code, but I think a better fix should be done in the platform.
 
Here's the code of
org.eclipse.debug.internal.ui.viewers.update.ThreadEventHandler.handleTerminate()
 
protected void handleTerminate(DebugEvent event) {
     IThread thread = (IThread) event.getSource();
     IDebugTarget target = thread.getDebugTarget();
     // ignore thread termination if target is terminated/disconnected
     if (!(target.isTerminated() || target.isDisconnected())) {
          fireDeltaAndClearTopFrame(thread, IModelDelta.REMOVED);
     }
}
The code in red & italics does not make much sense to me. When a thread is terminated, why shouldn't we remove it from the UI if the owning process is terminated/disconnected ?  Why leave the zombie there ?
 
In CDT (e.g. org.eclipse.cdt.debug.internal.core.model.CDebugTarget.handleDisconnectedEvent()), when a target/process is terminated/disconnected, the target is marked terminated/disconnected and TerminateEvent's are fired for all threads in the processs. As the events are handled asynchronously by the ThreadEventHandler.handleTerminate(), the condition check in red may become true and thus the threads are not removed from UI.
 
So is it ok to remove the condition check ?
 
Regards.
 
-- Ling
 
 

Back to the top