| Summary: | [breakpoints] MIBreakpointsManager does not handle command control shutdown correctly. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Pawel Piech <pawel.1.piech> | ||||||
| Component: | cdt-debug-dsf-gdb | Assignee: | Francois Chouinard <fchouinard> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Marc Khouzam <marc.khouzam> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cdtdoug, dd.general-inbox, pawel.1.piech | ||||||
| Version: | 6.0 | Flags: | cdtdoug:
iplog-
marc.khouzam: review+ |
||||||
| Target Milestone: | 6.0 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Pawel Piech
Created attachment 124060 [details]
Breakpoint install count handling patch
The intention is to keep the breakpoint install count attribute in sync with reality. This attribute is:
- incremented each time the breakpoint is installed
- decremented each time the breakpoint is removed
- cleared when MIBreakpointsManager terminates
If the count is not cleared, it just keeps incrementing every time a debug session is started. We reset this attribute because we assume that terminating an MI debug session also means that the breakpoints will be removed.
Anyway, the problem was introduced when the fPlatformBPs was restructured to become a map of execution contexts to a set of breakpoints. This part of the code was not kept in sync.
The attached patch takes care of this.
Patch was committed. Looks good. One comment
for (IBreakpointsTargetDMContext ctx : fPlatformBPs.keySet()) {
clearBreakpointStatus(fPlatformBPs.get(ctx).keySet().toArray(new ICBreakpoint[fPlatformBPs.size()]));
Although toArray() will fix it, I think the fPlatformBPs.size() is not the right size. It should probably be fPlatformBPs.get(ctx).size(). But instead, I usually use a size of 0 and let toArray() figure it out.
Created attachment 124156 [details]
Updated fix
Good point. I committed the updated patch.
(In reply to comment #3) > But instead, > I usually use a size of 0 and let toArray() figure it out. Are you kidding me? I didn't know you could do that! (In reply to comment #5) > (In reply to comment #3) > > But instead, > > I usually use a size of 0 and let toArray() figure it out. > Are you kidding me? I didn't know you could do that! :-) From Collection.toArray(Object[] a): "If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection." So I guess using 0 is not the most efficient, as it wastes the call to new myArray[0], but I figure it it worth the bugs one can avoid. |