1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Bug 532035: Be explicit in iterating over IBreakpointsTargetDMContext

Change-Id: I802ad946347c01d466f5011883ad644b8f31aca1
This commit is contained in:
Jonah Graham 2018-03-05 11:10:44 +00:00
parent 107bfee755
commit 377374febb
2 changed files with 20 additions and 8 deletions

View file

@ -78,8 +78,8 @@ public class GDBBreakpointsManager_7_0 extends MIBreakpointsManager {
// Process created.
IContainerDMContext containerWithPid = (IContainerDMContext)e.getDMContext();
assert getPlatformToAttributesMaps().keySet().size() == 1; // Only one process for GDB 7.0 and 7.1
for (IBreakpointsTargetDMContext oldBpTarget : getPlatformToAttributesMaps().keySet()) {
assert getTrackedBreakpointTargetContexts().size() == 1; // Only one process for GDB 7.0 and 7.1
for (IBreakpointsTargetDMContext oldBpTarget : getTrackedBreakpointTargetContexts()) {
assert oldBpTarget instanceof IContainerDMContext;
assert !containerWithPid.equals(oldBpTarget); // BpTarget does not have pid, while new container does

View file

@ -23,6 +23,7 @@ package org.eclipse.cdt.dsf.mi.service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
@ -589,6 +590,17 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
}
/**
* Return the collection of tracked target breakpoint contexts. Use this method
* instead of implying the installed collection from the various maps contained
* in the manager.
*
* @since 5.5
*/
protected Collection<IBreakpointsTargetDMContext> getTrackedBreakpointTargetContexts() {
return fPlatformToAttributesMaps.keySet();
}
///////////////////////////////////////////////////////////////////////////
// Back-end interface functions
///////////////////////////////////////////////////////////////////////////
@ -1371,9 +1383,9 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
rm.done();
}
};
countingRm.setDoneCount(fPlatformToAttributesMaps.size());
countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
for (final IBreakpointsTargetDMContext dmc : fPlatformToAttributesMaps.keySet()) {
for (final IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
boolean filtered = isBreakpointEntirelyFiltered(dmc, (ICBreakpoint)breakpoint);
if (!filtered) {
determineDebuggerPath(dmc, attrs,
@ -1462,13 +1474,13 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
}
};
countingRm.setDoneCount(fPlatformToAttributesMaps.size());
countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
// Mark the breakpoint as being updated and go
fPendingRequests.add(breakpoint);
// Modify the breakpoint in all the execution contexts
for (final IBreakpointsTargetDMContext dmc : fPlatformToAttributesMaps.keySet()) {
for (final IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
determineDebuggerPath(dmc, attrs,
new RequestMonitor(getExecutor(), countingRm) {
@Override
@ -1505,10 +1517,10 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
}
};
countingRm.setDoneCount(fPlatformToAttributesMaps.size());
countingRm.setDoneCount(getTrackedBreakpointTargetContexts().size());
// Remove the breakpoint in all the execution contexts
for (IBreakpointsTargetDMContext dmc : fPlatformToAttributesMaps.keySet()) {
for (IBreakpointsTargetDMContext dmc : getTrackedBreakpointTargetContexts()) {
if (fPlatformToAttributesMaps.get(dmc).containsKey(breakpoint)) {
uninstallBreakpoint(dmc, (ICBreakpoint) breakpoint, countingRm);
}