Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320044

Summary: New breakpoints are got installed in dead process
Product: [Tools] CDT Reporter: Ling Wang <ling.5.wang>
Component: cdt-debug-dsfAssignee: Ling Wang <ling.5.wang>
Status: RESOLVED FIXED QA Contact: Pawel Piech <pawel.1.piech>
Severity: normal    
Priority: P2 CC: ken.ryall, pawel.1.piech, warren.paul
Version: 7.0Flags: ling.5.wang: review? (pawel.1.piech)
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
my patch cdtdoug: iplog-

Description Ling Wang CLA 2010-07-15 17:18:51 EDT
This bug is revealed in multi-process debug in EDC. After a process is dead/terminated while another process is still alive under debug, if user sets a breakpoint, debugger will still try to install the breakpoint for the dead process. Another symptom is after a binary module (e.g. a DLL) is unloaded, debugger still tries to install a new breakpoint in that module.
Comment 1 Ling Wang CLA 2010-07-15 17:23:19 EDT
This turns out to be a bug in BreakpointsMediator2. After 
   BreakpointsMediator2.stopTrackingBreakpoints(dmc)
is called for the dead process "dmc", the breakpoints in the dmc are removed, but the dmc remains in the internal map "fPlatformBPs", namely it's still being "tracked" by the mediator. 
So the solution is to make sure the dmc is removed from the internal map.
Comment 2 Ling Wang CLA 2010-07-15 17:28:33 EDT
Created attachment 174454 [details]
my patch

Powel, could you please review ?
Comment 3 Marc Khouzam CLA 2010-07-16 06:50:49 EDT
For completeness, in case someone wonders or comes back to this bug later, the MIBreakpointsManager does clear the fPlatformBPs map in stopTrackingBreakpoints.

Ling, do we need the new fBPTargetDMCsBeingRemoved for MIBreakpointsManager too?  What are the consequence of this double remove?

P.S. The patch looks good to me
Comment 4 Ling Wang CLA 2010-07-16 11:34:30 EDT
(In reply to comment #3)
> Ling, do we need the new fBPTargetDMCsBeingRemoved for MIBreakpointsManager
> too?  What are the consequence of this double remove?

With multi-process debug in EDC, the stopTrackingBreakpoints() is called twice on the last terminated process. Depends on timing, the DSF tasks (runnalbes, request monitors) triggered by those two calls may get interleaved and run into NPE when acessing the dmc in the map. Yes, another solution is to plug those NPE on site, but I prefer my current solution.

> 
> P.S. The patch looks good to me

Thanks.
Comment 5 Ling Wang CLA 2010-07-16 15:13:41 EDT
I committed my patch to head.
Comment 6 CDT Genie CLA 2010-07-16 15:23:02 EDT
*** cdt cvs genie on behalf of lwang ***
Bug 320044: New breakpoints are got installed in dead process.

[*] BreakpointsMediator2.java 1.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java?root=Tools_Project&r1=1.3&r2=1.4
Comment 7 Ling Wang CLA 2010-07-19 19:34:28 EDT
Also committed in cdt_7_0 branch.
Comment 8 CDT Genie CLA 2010-07-19 20:23:06 EDT
*** cdt cvs genie on behalf of lwang ***
Bug 320044: New breakpoints got installed in dead process.

[*] BreakpointsMediator2.java 1.3.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java?root=Tools_Project&r1=1.3&r2=1.3.2.1