Skip to main content

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

Yes, on termination, an ICDIDestroyedEvent (also an ICDIExitedEvent in our debugger) is fired.
And an ICDIDisconnectedEvent is fired on "disconnect".
 
CDebugTarget.handleDisconnectedEvent() does call removeAllThreads() asking core debugger to remove the threads, but due to the problem described in my original mail, core debugger fails to do that.
 
Whereas, CDebugTarget.handleExitedEvent() does succeed in that aspect as it calls removeAllThreads() (and fireChangeEvent( DebugEvent.CONTENT )) at the beginning.
 
I can do same thing in handleDisconnectedEvent() as in handleExistedEvent() to fix the problem, but I think the better solution is to change the core code.
 
-- Ling


From: cdt-debug-dev-bounces@xxxxxxxxxxx [mailto:cdt-debug-dev-bounces@xxxxxxxxxxx] On Behalf Of ext Doug Schaefer
Sent: Wednesday, May 30, 2007 5:13 PM
To: CDT Debug developers list
Subject: RE: [cdt-debug-dev] remove a thread from UI after terminating/disconnecting a process

I’ve run into the same thing in the early stages of my Windows debugger (which I’ve started up again, BTW). The target only gets terminated when an ICDIDestroyedEvent gets dispatched. I’ve made sure I dispatch one when I got notified that the process has actually terminated. Or are you already doing that?

 

Doug Schaefer, QNX Software Systems
Eclipse CDT Project Lead, http://cdtdoug.blogspot.com


From: cdt-debug-dev-bounces@xxxxxxxxxxx [mailto:cdt-debug-dev-bounces@xxxxxxxxxxx] On Behalf Of Ling.5.Wang@xxxxxxxxx
Sent: Wednesday, May 30, 2007 5:39 PM
To: cdt-debug-dev@xxxxxxxxxxx
Subject: [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