Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-01-31 05:49:01 +0000
committerPawel Piech2012-02-08 19:53:55 +0000
commit1dbaf3c1baad7a1fd713b8b2c211f13d442eda7a (patch)
tree493564c60f145d67c57e123b7d30ff8b91da64fb /dsf/org.eclipse.cdt.dsf
parentb9255e88a54c84de5af5774cecb4bdad0373e5fa (diff)
downloadorg.eclipse.cdt-1dbaf3c1baad7a1fd713b8b2c211f13d442eda7a.tar.gz
org.eclipse.cdt-1dbaf3c1baad7a1fd713b8b2c211f13d442eda7a.tar.xz
org.eclipse.cdt-1dbaf3c1baad7a1fd713b8b2c211f13d442eda7a.zip
Bug 360280 - [breakpoints] Reposition breakpoints when planted on invalid line (PDA Example - Added updating of C Breakpoint status to set installed flag and update line number)
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java55
1 files changed, 33 insertions, 22 deletions
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java
index d77e185869b..035a41991eb 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/BreakpointsMediator2.java
@@ -14,6 +14,7 @@
package org.eclipse.cdt.dsf.debug.service;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -181,8 +182,8 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
* - Modified on breakpointChanged()
* - Diminished on breakpointRemoved()
*/
- private Map<IBreakpointsTargetDMContext, Map<IBreakpoint, List<TargetBP>>> fPlatformBPs =
- new HashMap<IBreakpointsTargetDMContext, Map<IBreakpoint, List<TargetBP>>>();
+ private Map<IBreakpointsTargetDMContext, Map<IBreakpoint, List<ITargetBreakpointInfo>>> fPlatformBPs =
+ new HashMap<IBreakpointsTargetDMContext, Map<IBreakpoint, List<ITargetBreakpointInfo>>>();
/**
* BreakpointsTargetDMContext's that are being removed from {@link #fPlatformBPs}.
@@ -352,7 +353,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
// - Install the platform breakpoints on the selected target
// Make sure a mapping for this execution context does not already exist
- Map<IBreakpoint, List<TargetBP>> platformBPs = fPlatformBPs.get(dmc);
+ Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(dmc);
if (platformBPs != null) {
rm.setStatus(new Status(IStatus.ERROR, getPluginID(), INTERNAL_ERROR, "Context already initialized", null)); //$NON-NLS-1$
rm.done();
@@ -361,7 +362,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
// Create entries in the breakpoint tables for the new context. These entries should only
// be removed when this service stops tracking breakpoints for the given context.
- fPlatformBPs.put(dmc, new HashMap<IBreakpoint, List<TargetBP>>());
+ fPlatformBPs.put(dmc, new HashMap<IBreakpoint, List<ITargetBreakpointInfo>>());
// Install the platform breakpoints (stored in fPlatformBPs) on the target.
// We need to use a background thread for this operation because we are
@@ -391,7 +392,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
// - Remove the target breakpoints for the given DMC
// - Remove the given DMC from the internal maps.
//
- Map<IBreakpoint, List<TargetBP>> platformBPs = fPlatformBPs.get(dmc);
+ Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(dmc);
if (platformBPs == null) {
rm.setStatus(new Status(IStatus.INFO /* NOT error */, getPluginID(), INTERNAL_ERROR, "Breakpoints not installed for given context", null)); //$NON-NLS-1$
rm.done();
@@ -449,11 +450,11 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
public ITargetBreakpointInfo[] getTargetBreakpoints(IBreakpointsTargetDMContext dmc, IBreakpoint platformBp) {
assert getExecutor().isInExecutorThread();
- Map<IBreakpoint, List<TargetBP>> platformBPs = fPlatformBPs.get(dmc);
+ Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(dmc);
if (platformBPs != null)
{
- List<TargetBP> bpInfo = platformBPs.get(platformBp);
+ List<ITargetBreakpointInfo> bpInfo = platformBPs.get(platformBp);
if (bpInfo != null) {
return bpInfo.toArray(new ITargetBreakpointInfo[bpInfo.size()]);
}
@@ -475,14 +476,14 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
if (dmc != null && !dmc.equals(bpContext))
continue;
- Map<IBreakpoint, List<TargetBP>> platformBPs = fPlatformBPs.get(bpContext);
+ Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(bpContext);
if (platformBPs != null && platformBPs.size() > 0)
{
- for(Map.Entry<IBreakpoint, List<TargetBP>> e: platformBPs.entrySet())
+ for(Map.Entry<IBreakpoint, List<ITargetBreakpointInfo>> e: platformBPs.entrySet())
{
// Stop at the first occurrence
- for (TargetBP tbp : e.getValue())
+ for (ITargetBreakpointInfo tbp : e.getValue())
if(tbp.getTargetBreakpoint().equals(bp))
return e.getKey();
}
@@ -510,7 +511,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
final List<Map<String, Object>> attrsList, final DataRequestMonitor<List<TargetBP>> rm)
{
// Retrieve the set of breakpoints for this context
- final Map<IBreakpoint, List<TargetBP>> platformBPs = fPlatformBPs.get(dmc);
+ final Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(dmc);
assert platformBPs != null;
// Ensure the breakpoint is not already installed
@@ -521,7 +522,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
targetBPsAttempted.add(new TargetBP(attrsList.get(i)));
}
- final ArrayList<TargetBP> targetBPsInstalled = new ArrayList<TargetBP>(attrsList.size());
+ final ArrayList<ITargetBreakpointInfo> targetBPsInstalled = new ArrayList<ITargetBreakpointInfo>(attrsList.size());
// Update the breakpoint status when all back-end breakpoints have been installed
final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), rm) {
@@ -575,17 +576,17 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
* regardless of success or failure in the removal.
*/
private void uninstallBreakpoint(final IBreakpointsTargetDMContext dmc, final IBreakpoint breakpoint,
- final DataRequestMonitor<List<TargetBP>> drm)
+ final DataRequestMonitor<List<ITargetBreakpointInfo>> drm)
{
// Remove the back-end breakpoints
- final Map<IBreakpoint, List<TargetBP>> platformBPs = fPlatformBPs.get(dmc);
+ final Map<IBreakpoint, List<ITargetBreakpointInfo>> platformBPs = fPlatformBPs.get(dmc);
if (platformBPs == null) {
drm.setStatus(new Status(IStatus.ERROR, getPluginID(), INVALID_HANDLE, "Invalid breakpoint", null)); //$NON-NLS-1$
drm.done();
return;
}
- final List<TargetBP> bpList = platformBPs.get(breakpoint);
+ final List<ITargetBreakpointInfo> bpList = platformBPs.get(breakpoint);
assert bpList != null;
// Only try to remove those targetBPs that are successfully installed.
@@ -604,7 +605,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
int count = 0;
for (int i = 0; i < bpList.size(); i++) {
- final TargetBP bp = bpList.get(i);
+ final ITargetBreakpointInfo bp = bpList.get(i);
if (bp.getTargetBreakpoint() != null) {
fBreakpointsService.removeBreakpoint(
bp.getTargetBreakpoint(),
@@ -612,16 +613,16 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
@Override
protected void handleCompleted() {
// Remember result of the removal, success or failure.
- bp.setStatus(getStatus());
+ ((TargetBP)bp).setStatus(getStatus());
if (isSuccess()) {
- bp.setTargetBreakpoint(null);
+ ((TargetBP)bp).setTargetBreakpoint(null);
}
countingRm.done();
}
});
count++;
} else {
- bp.setStatus(Status.OK_STATUS);
+ ((TargetBP)bp).setStatus(Status.OK_STATUS);
}
}
countingRm.setDoneCount(count);
@@ -712,6 +713,11 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
@Override
protected void handleCompleted() {
processPendingRequests();
+ for (Map.Entry<IBreakpoint, Map<IBreakpointsTargetDMContext, ITargetBreakpointInfo[]>> eventEntry : eventBPs.entrySet()) {
+ for (Map.Entry<IBreakpointsTargetDMContext, ITargetBreakpointInfo[]> bpEntry : eventEntry.getValue().entrySet()) {
+ fPlatformBPs.get(bpEntry.getKey()).put(eventEntry.getKey(), Arrays.asList( bpEntry.getValue() ));
+ }
+ }
fireUpdateBreakpointsStatus(eventBPs, BreakpointEventType.ADDED);
if (rm != null)
// don't call this if "rm" is null as this will
@@ -930,9 +936,9 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
fRunningEvents.add(bp);
for (IBreakpointsTargetDMContext context : updateContexts) {
- List<TargetBP> targetBPs = fPlatformBPs.get(context).get(bp);
+ List<ITargetBreakpointInfo> targetBPs = fPlatformBPs.get(context).get(bp);
if (targetBPs != null) {
- for (TargetBP tbp : targetBPs) {
+ for (ITargetBreakpointInfo tbp : targetBPs) {
// this must be an installed breakpoint.
assert (tbp.getTargetBreakpoint() != null);
@@ -1016,6 +1022,11 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
protected void handleCompleted() {
processPendingRequests();
fireUpdateBreakpointsStatus(eventBPs, BreakpointEventType.REMOVED);
+ for (Map.Entry<IBreakpoint, Map<IBreakpointsTargetDMContext, ITargetBreakpointInfo[]>> eventEntry : eventBPs.entrySet()) {
+ for (IBreakpointsTargetDMContext bpTarget : eventEntry.getValue().keySet()) {
+ fPlatformBPs.get(bpTarget).remove(eventEntry.getKey());
+ }
+ }
if (rm != null)
// don't call this if "rm" is null as this will
// log errors if any and pack Eclipse error
@@ -1063,7 +1074,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
uninstallBreakpoint(
dmc, breakpoint,
- new DataRequestMonitor<List<TargetBP>>(getExecutor(), bpTargetsCountingRM) {
+ new DataRequestMonitor<List<ITargetBreakpointInfo>>(getExecutor(), bpTargetsCountingRM) {
@Override
protected void handleSuccess() {
targetBPs.put(dmc, getData().toArray(new ITargetBreakpointInfo[getData().size()]));

Back to the top