From c0109d378d90e0b1fdfe6c1d7fa52bc5bdd46ac5 Mon Sep 17 00:00:00 2001 From: Marc Dumais Date: Tue, 15 Mar 2016 10:00:12 -0400 Subject: [PATCH] Bug 489683 - Change the breakpoint "number" from an int to a String Change-Id: I33a8ca95f6894c360c95260433945cdf1b529bc3 --- .../events/MITracepointSelectedEvent.java | 8 +- .../dsf/gdb/service/GDBBreakpoints_7_0.java | 34 +++--- .../dsf/gdb/service/GDBBreakpoints_7_2.java | 14 +-- .../dsf/gdb/service/GDBBreakpoints_7_4.java | 14 +-- .../dsf/gdb/service/GDBBreakpoints_7_7.java | 8 +- .../cdt/dsf/gdb/service/GDBRunControl.java | 24 ++-- .../dsf/gdb/service/GDBRunControl_7_0_NS.java | 28 ++--- .../dsf/mi/service/MIBreakpointDMData.java | 8 +- .../cdt/dsf/mi/service/MIBreakpoints.java | 110 +++++++++--------- .../dsf/mi/service/MIBreakpointsManager.java | 8 +- .../mi/service/MIBreakpointsSynchronizer.java | 74 ++++++------ .../cdt/dsf/mi/service/MIRunControl.java | 6 +- .../mi/service/command/CommandFactory.java | 21 ++-- .../command/commands/CLIPasscount.java | 7 +- .../command/commands/MIBreakAfter.java | 7 +- .../command/commands/MIBreakCommands.java | 9 +- .../command/commands/MIBreakCondition.java | 8 +- .../command/commands/MIBreakDelete.java | 7 +- .../command/commands/MIBreakDisable.java | 7 +- .../command/commands/MIBreakEnable.java | 7 +- .../command/events/MIBreakpointHitEvent.java | 14 ++- .../command/events/MICatchpointHitEvent.java | 11 +- .../events/MIWatchpointScopeEvent.java | 14 ++- .../events/MIWatchpointTriggerEvent.java | 18 ++- .../command/output/CLIInfoBreakInfo.java | 16 +-- .../service/command/output/CLITraceInfo.java | 13 +-- .../service/command/output/MIBreakpoint.java | 21 ++-- .../cdt/tests/dsf/gdb/framework/SyncUtil.java | 20 ++-- .../gdb/tests/GDBConsoleBreakpointsTest.java | 18 +-- .../dsf/gdb/tests/MIBreakpointsTest.java | 78 ++++++------- .../dsf/gdb/tests/MICatchpointsTest.java | 14 +-- .../tests/dsf/gdb/tests/TraceFileTest.java | 2 +- 32 files changed, 337 insertions(+), 311 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java index 16dfe14e911..9b1895ff3b9 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/service/command/events/MITracepointSelectedEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Ericsson and others. + * Copyright (c) 2010 - 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,7 +38,7 @@ public class MITracepointSelectedEvent extends MIBreakpointHitEvent { private int fRecNo; - protected MITracepointSelectedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, int trptno, int recordno) { + protected MITracepointSelectedEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String trptno, int recordno) { super(ctx, token, results, frame, trptno); fRecNo = recordno; } @@ -53,7 +53,7 @@ public class MITracepointSelectedEvent extends MIBreakpointHitEvent { @ConfinedToDsfExecutor("") public static MITracepointSelectedEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) { - int trptno = -1; + String trptno = ""; //$NON-NLS-1$ int recordno = -1; for (int i = 0; i < results.length; i++) { @@ -66,7 +66,7 @@ public class MITracepointSelectedEvent extends MIBreakpointHitEvent { if (var.equals("tracepoint")) { //$NON-NLS-1$ try { - trptno = Integer.parseInt(str.trim()); + trptno = str.trim(); } catch (NumberFormatException e) { } } else if (var.equals("traceframe")) { //$NON-NLS-1$ diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java index 4020be89c4e..6a5056d7650 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 Ericsson and others. + * Copyright (c) 2010, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -108,7 +108,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints final DataRequestMonitor finalRm) { // Select the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -150,8 +150,8 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]); - int reference = newBreakpoint.getNumber(); - if (reference == -1) { + String reference = newBreakpoint.getNumber(); + if (reference.isEmpty()) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); rm.done(); return; @@ -191,7 +191,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map attributes, final DataRequestMonitor drm) { // Select the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); drm.done(); @@ -213,7 +213,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { - final Integer tpReference = getData().getTraceReference(); + final String tpReference = getData().getTraceReference(); if (tpReference == null) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); drm.done(); @@ -229,11 +229,11 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints protected void handleSuccess() { MIBreakpoint[] breakpoints = getData().getMIBreakpoints(); for (MIBreakpoint bp : breakpoints) { - if (bp.getNumber() == tpReference) { + if (bp.getNumber().equals(tpReference)) { // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(bp); - int reference = newBreakpoint.getNumber(); + String reference = newBreakpoint.getNumber(); contextBreakpoints.put(reference, newBreakpoint); // Format the return value @@ -277,8 +277,8 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints // At this point, we know their are OK so there is no need to re-validate MIBreakpointDMContext breakpointCtx = (MIBreakpointDMContext) dmc; IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(breakpointCtx, IBreakpointsTargetDMContext.class); - final Map contextBreakpoints = getBreakpointMap(context); - final int reference = breakpointCtx.getReference(); + final Map contextBreakpoints = getBreakpointMap(context); + final String reference = breakpointCtx.getReference(); MIBreakpointDMData breakpoint = contextBreakpoints.get(reference); // Track the number of change requests @@ -336,10 +336,10 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints } private void changeActions(final IBreakpointsTargetDMContext context, - final int reference, final String actionNames, final ITracepointAction[] actions, final RequestMonitor rm) + final String reference, final String actionNames, final ITracepointAction[] actions, final RequestMonitor rm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); rm.done(); @@ -376,10 +376,10 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints */ @Override protected void changeIgnoreCount(IBreakpointsTargetDMContext context, - final int reference, final int ignoreCount, final RequestMonitor rm) + final String reference, final int ignoreCount, final RequestMonitor rm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); rm.done(); @@ -404,12 +404,14 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints * @param reference * @param ignoreCount * @param rm + * + * @since 5.0 */ protected void changePassCount(IBreakpointsTargetDMContext context, - final int reference, final int ignoreCount, final RequestMonitor rm) + final String reference, final int ignoreCount, final RequestMonitor rm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); rm.done(); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java index e5c1714662e..84dff5163a1 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 Ericsson and others. + * Copyright (c) 2011, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -119,7 +119,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 // Select the breakpoints context map // If it doesn't exist then no breakpoint was ever inserted for this breakpoint space. // In that case, return an empty list. - final Map breakpointContext = getBreakpointMap(context); + final Map breakpointContext = getBreakpointMap(context); if (breakpointContext == null) { drm.setData(new IBreakpointDMContext[0]); drm.done(); @@ -141,7 +141,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 new ImmediateDataRequestMonitor(drm) { @Override protected void handleSuccess() { - Map groupIdMap = getData().getBreakpointToGroupMap(); + Map groupIdMap = getData().getBreakpointToGroupMap(); // Refresh the breakpoints map and format the result breakpointContext.clear(); @@ -153,7 +153,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 // It is ok to get null. For example, pending breakpoints are not // associated to a thread-group; also, when debugging a single process, // the thread-group list is empty. - int reference = breakpointData.getReference(); + String reference = breakpointData.getReference(); String[] groupIds = groupIdMap.get(reference); breakpointData.setGroupIds(groupIds); @@ -191,7 +191,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 protected void sendTracepointCommand(final IBreakpointsTargetDMContext context, final Map attributes, boolean isFastTracepoint, final DataRequestMonitor drm) { // Select the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); drm.done(); @@ -223,8 +223,8 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]); - int reference = newBreakpoint.getNumber(); - if (reference == -1) { + String reference = newBreakpoint.getNumber(); + if (reference.isEmpty()) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); drm.done(); return; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java index 5d1853bca2c..37e0b803b69 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 Mentor Graphics and others. + * Copyright (c) 2012, 2016 Mentor Graphics and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -118,8 +118,8 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList bs.targetBreakpointCreated(bpt); } else if (BREAKPOINT_DELETED.equals(asyncClass)) { - int id = getMIBreakpointIdFromOutput(notifyOutput); - if (id != 0) + String id = getMIBreakpointIdFromOutput(notifyOutput); + if (!id.isEmpty()) bs.targetBreakpointDeleted(id); } else if (BREAKPOINT_MODIFIED.equals(asyncClass)) { @@ -152,21 +152,21 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList return bpt; } - private int getMIBreakpointIdFromOutput(MINotifyAsyncOutput notifyOutput) { + private String getMIBreakpointIdFromOutput(MINotifyAsyncOutput notifyOutput) { MIResult[] results = notifyOutput.getMIResults(); for(int i = 0; i < results.length; i++) { String var = results[i].getVariable(); MIValue val = results[i].getMIValue(); if (var.equals("id") && val instanceof MIConst) { //$NON-NLS-1$ try { - return Integer.parseInt(((MIConst)val).getCString().trim()); + return ((MIConst)val).getCString().trim(); } catch(NumberFormatException e) { GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid breakpoint id")); //$NON-NLS-1$ } } } - return 0; + return ""; //$NON-NLS-1$ } @Override @@ -284,7 +284,7 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList } @Override - protected void deleteBreakpointFromTarget(IBreakpointsTargetDMContext context, int reference, RequestMonitor finalRm) { + protected void deleteBreakpointFromTarget(IBreakpointsTargetDMContext context, String reference, RequestMonitor finalRm) { MIBreakpointsSynchronizer bs = getServicesTracker().getService(MIBreakpointsSynchronizer.class); if (bs != null) { // Do nothing if the breakpoint is deleted from the console. diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java index 5b51fcf084b..2493b9de94c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Ericsson and others. + * Copyright (c) 2014 - 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -135,7 +135,7 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 { protected void doAddDynamicPrintf(final IBreakpointsTargetDMContext context, Map attributes, final DataRequestMonitor finalRm) { // Select the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); return; @@ -174,8 +174,8 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 { // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]); - int reference = newBreakpoint.getNumber(); - if (reference == -1) { + String reference = newBreakpoint.getNumber(); + if (reference.isEmpty()) { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, null)); return; } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java index b2bb4d019d1..3baa51c01f9 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 Wind River Systems and others. + * Copyright (c) 2006, 2016 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,13 +67,13 @@ public class GDBRunControl extends MIRunControl { private static class RunToLineActiveOperation { private IMIExecutionDMContext fThreadContext; - private int fBpId; + private String fBpId; private String fFileLocation; private String fAddrLocation; private boolean fSkipBreakpoints; public RunToLineActiveOperation(IMIExecutionDMContext threadContext, - int bpId, String fileLoc, String addr, boolean skipBreakpoints) { + String bpId, String fileLoc, String addr, boolean skipBreakpoints) { fThreadContext = threadContext; fBpId = bpId; fFileLocation = fileLoc; @@ -82,7 +82,7 @@ public class GDBRunControl extends MIRunControl { } public IMIExecutionDMContext getThreadContext() { return fThreadContext; } - public int getBreakointId() { return fBpId; } + public String getBreakointId() { return fBpId; } public String getFileLocation() { return fFileLocation; } public String getAddrLocation() { return fAddrLocation; } public boolean shouldSkipBreakpoints() { return fSkipBreakpoints; } @@ -333,7 +333,7 @@ public class GDBRunControl extends MIRunControl { public void handleSuccess() { // We must set are RunToLineActiveOperation *before* we do the resume // or else we may get the stopped event, before we have set this variable. - int bpId = getData().getMIBreakpoints()[0].getNumber(); + String bpId = getData().getMIBreakpoints()[0].getNumber(); String addr = getData().getMIBreakpoints()[0].getAddress(); fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints); @@ -342,9 +342,9 @@ public class GDBRunControl extends MIRunControl { public void handleFailure() { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - int bpId = fRunToLineActiveOperation.getBreakointId(); + String bpId = fRunToLineActiveOperation.getBreakointId(); - getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; fStepInToSelectionActiveOperation = null; @@ -372,9 +372,9 @@ public class GDBRunControl extends MIRunControl { if (fRunToLineActiveOperation != null) { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - int bpId = fRunToLineActiveOperation.getBreakointId(); + String bpId = fRunToLineActiveOperation.getBreakointId(); - getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; fStepInToSelectionActiveOperation = null; @@ -436,7 +436,7 @@ public class GDBRunControl extends MIRunControl { private boolean processRunToLineStoppedEvent(final MIStoppedEvent e) { if (fRunToLineActiveOperation != null) { - int bpId = 0; + String bpId = ""; //$NON-NLS-1$ if (e instanceof MIBreakpointHitEvent) { bpId = ((MIBreakpointHitEvent)e).getNumber(); } @@ -454,7 +454,7 @@ public class GDBRunControl extends MIRunControl { // has multiple addresses for the breakpoint. I'm mean, come on! boolean equalFileLocation = false; boolean equalAddrLocation = false; - boolean equalBpId = bpId == fRunToLineActiveOperation.getBreakointId(); + boolean equalBpId = bpId.equals(fRunToLineActiveOperation.getBreakointId()); MIFrame frame = e.getFrame(); if(frame != null) { String fileLocation = frame.getFile() + ":" + frame.getLine(); //$NON-NLS-1$ @@ -487,7 +487,7 @@ public class GDBRunControl extends MIRunControl { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {fRunToLineActiveOperation.getBreakointId()}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; fStepInToSelectionActiveOperation = null; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java index c8eaf9046d9..33184482789 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java @@ -331,13 +331,14 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo */ protected static class RunToLineActiveOperation { private IMIExecutionDMContext fThreadContext; - private int fBpId; + private String fBpId; private String fFileLocation; private String fAddrLocation; private boolean fSkipBreakpoints; + /** @since 5.0 */ public RunToLineActiveOperation(IMIExecutionDMContext threadContext, - int bpId, String fileLoc, String addr, boolean skipBreakpoints) { + String bpId, String fileLoc, String addr, boolean skipBreakpoints) { fThreadContext = threadContext; fBpId = bpId; fFileLocation = fileLoc; @@ -346,7 +347,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo } public IMIExecutionDMContext getThreadContext() { return fThreadContext; } - public int getBreakointId() { return fBpId; } + /** @since 5.0 */ + public String getBreakointId() { return fBpId; } public String getFileLocation() { return fFileLocation; } public String getAddrLocation() { return fAddrLocation; } public boolean shouldSkipBreakpoints() { return fSkipBreakpoints; } @@ -960,7 +962,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo public void handleSuccess() { // We must set are RunToLineActiveOperation *before* we do the resume // or else we may get the stopped event, before we have set this variable. - int bpId = getData().getMIBreakpoints()[0].getNumber(); + String bpId = getData().getMIBreakpoints()[0].getNumber(); String addr = getData().getMIBreakpoints()[0].getAddress(); fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints); @@ -969,9 +971,9 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo public void handleFailure() { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - int bpId = fRunToLineActiveOperation.getBreakointId(); + String bpId = fRunToLineActiveOperation.getBreakointId(); - fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), + fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; fStepInToSelectionActiveOperation = null; @@ -1715,9 +1717,9 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo IDMEvent event = null; MIBreakpointDMContext bp = null; if (e instanceof MIBreakpointHitEvent) { - int bpId = ((MIBreakpointHitEvent) e).getNumber(); + String bpId = ((MIBreakpointHitEvent) e).getNumber(); IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class); - if (bpsTarget != null && bpId >= 0) { + if (bpsTarget != null && !bpId.isEmpty()) { bp = new MIBreakpointDMContext(getSession().getId(), new IDMContext[] { bpsTarget }, bpId); event = new BreakpointHitEvent(e.getDMContext(), (MIBreakpointHitEvent) e, bp); } @@ -1857,7 +1859,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo // First check if it is the right thread that stopped IMIExecutionDMContext threadDmc = DMContexts.getAncestorOfType(e.getDMContext(), IMIExecutionDMContext.class); if (fRunToLineActiveOperation.getThreadContext().equals(threadDmc)) { - int bpId = 0; + String bpId = ""; //$NON-NLS-1$ if (e instanceof MIBreakpointHitEvent) { bpId = ((MIBreakpointHitEvent) e).getNumber(); } @@ -1877,7 +1879,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo // does a runToLine to a line that is non-executable AND has another breakpoint AND // has multiple addresses for the breakpoint. I'm mean, come on! if (fileLocation.equals(fRunToLineActiveOperation.getFileLocation()) || addrLocation.equals(fRunToLineActiveOperation.getAddrLocation()) - || bpId == fRunToLineActiveOperation.getBreakointId()) { + || bpId.equals(fRunToLineActiveOperation.getBreakointId())) { // We stopped at the right place. All is well. // Run to line completed fRunToLineActiveOperation = null; @@ -1898,7 +1900,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo // be for another thread altogether and should not affect the current thread. IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] { fRunToLineActiveOperation.getBreakointId() }), new DataRequestMonitor(getExecutor(), null)); + fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] { fRunToLineActiveOperation.getBreakointId() }), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; fStepInToSelectionActiveOperation = null; } @@ -2004,9 +2006,9 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo if (fRunToLineActiveOperation != null) { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - int bpId = fRunToLineActiveOperation.getBreakointId(); + String bpId = fRunToLineActiveOperation.getBreakointId(); - fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), + fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new String[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java index 88dd2b1301c..adefd1b13b0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2014 Ericsson and others. + * Copyright (c) 2007, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -252,7 +252,8 @@ public class MIBreakpointDMData implements IBreakpointDMData { return (String) fProperties.get(MIBreakpoints.BREAKPOINT_TYPE); } - public int getReference() { + /** @since 5.0 */ + public String getReference() { return fBreakpoint.getNumber(); } @@ -323,7 +324,8 @@ public class MIBreakpointDMData implements IBreakpointDMData { return fBreakpoint.getCommands(); } - public int getNumber() { + /** @since 5.0 */ + public String getNumber() { return fBreakpoint.getNumber(); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java index 6d54078dc5c..2a05bf0b094 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 Ericsson and others. + * Copyright (c) 2007, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -130,7 +130,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // Service breakpoints tracking // The breakpoints are stored per context and keyed on the back-end breakpoint reference - private Map> fBreakpoints = new HashMap<>(); + private Map> fBreakpoints = new HashMap<>(); /** * Map tracking which threads are currently suspended on a breakpoint. @@ -143,7 +143,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * * @since 3.0 */ - protected Map getBreakpointMap(IBreakpointsTargetDMContext ctx) { + protected Map getBreakpointMap(IBreakpointsTargetDMContext ctx) { return fBreakpoints.get(ctx); } @@ -154,8 +154,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * * @since 3.0 */ - protected Map createNewBreakpointMap(IBreakpointsTargetDMContext ctx) { - Map map = new HashMap<>(); + protected Map createNewBreakpointMap(IBreakpointsTargetDMContext ctx) { + Map map = new HashMap<>(); fBreakpoints.put(ctx, map); return map; } @@ -231,14 +231,16 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I public static final class MIBreakpointDMContext extends AbstractDMContext implements IBreakpointDMContext { // The breakpoint reference - private final Integer fReference; + private final String fReference; /** * @param service the Breakpoint service * @param parents the parent contexts * @param reference the DsfMIBreakpoint reference + * + * @since 5.0 */ - public MIBreakpointDMContext(MIBreakpoints service, IDMContext[] parents, int reference) { + public MIBreakpointDMContext(MIBreakpoints service, IDMContext[] parents, String reference) { this(service.getSession().getId(), parents, reference); } @@ -247,17 +249,19 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * @param parents the parent contexts * @param reference the DsfMIBreakpoint reference * - * @since 3.0 + * @since 5.0 */ - public MIBreakpointDMContext(String sessionId, IDMContext[] parents, int reference) { + public MIBreakpointDMContext(String sessionId, IDMContext[] parents, String reference) { super(sessionId, parents); fReference = reference; } - /* (non-Javadoc) + /** + * @returns a reference to the breakpoint * @see org.eclipse.cdt.dsf.debug.service.IBreakpoints.IDsfBreakpointDMContext#getReference() - */ - public int getReference() { + * @since 5.0 + */ + public String getReference() { return fReference; } @@ -370,7 +374,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // remove it from our breakpoints map. IBreakpointsTargetDMContext bpContext = DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class); if (bpContext != null) { - Map contextBps = getBreakpointMap(bpContext); + Map contextBps = getBreakpointMap(bpContext); if (contextBps != null) { contextBps.remove(e.getNumber()); } @@ -410,7 +414,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // Select the breakpoints context map // If it doesn't exist then no breakpoint was ever inserted for this breakpoint space. // In that case, return an empty list. - final Map breakpointContext = getBreakpointMap(context); + final Map breakpointContext = getBreakpointMap(context); if (breakpointContext == null) { drm.setData(new IBreakpointDMContext[0]); drm.done(); @@ -428,7 +432,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length]; for (int i = 0; i < breakpoints.length; i++) { MIBreakpointDMData breakpoint = new MIBreakpointDMData(breakpoints[i]); - int reference = breakpoint.getReference(); + String reference = breakpoint.getReference(); result[i] = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference); breakpointContext.put(reference, breakpoint); } @@ -475,7 +479,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I } // Select the breakpoints context map - Map contextBreakpoints = getBreakpointMap(context); + Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null)); drm.done(); @@ -506,7 +510,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I } // Select the breakpoints context map. If it doesn't exist, create it. - Map breakpointContext = getBreakpointMap(context); + Map breakpointContext = getBreakpointMap(context); if (breakpointContext == null) { breakpointContext = createNewBreakpointMap(context); } @@ -637,7 +641,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I protected void addBreakpoint(final IBreakpointsTargetDMContext context, final Map attributes, final DataRequestMonitor finalRm) { // Select the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -677,8 +681,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]); - int reference = newBreakpoint.getNumber(); - if (reference == -1) { + String reference = newBreakpoint.getNumber(); + if (reference.isEmpty()) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); rm.done(); return; @@ -738,7 +742,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I protected void addWatchpoint(final IBreakpointsTargetDMContext context, final Map attributes, final DataRequestMonitor drm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); drm.done(); @@ -770,8 +774,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]); - int reference = newBreakpoint.getNumber(); - if (reference == -1) { + String reference = newBreakpoint.getNumber(); + if (reference.isEmpty()) { drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, WATCHPOINT_INSERTION_FAILURE, null)); drm.done(); return; @@ -810,7 +814,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I */ protected void addCatchpoint(final IBreakpointsTargetDMContext context, final Map attributes, final DataRequestMonitor finalRm) { // Select the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -845,8 +849,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // Create a breakpoint object and store it in the map final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBkpt); - int reference = newBreakpoint.getNumber(); - if (reference == -1) { + String reference = newBreakpoint.getNumber(); + if (reference.isEmpty()) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, null)); rm.done(); return; @@ -929,7 +933,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I } // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null)); finalRm.done(); @@ -937,7 +941,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I } // Validate the breakpoint - final int reference = breakpointCtx.getReference(); + final String reference = breakpointCtx.getReference(); MIBreakpointDMData breakpoint = contextBreakpoints.get(reference); if (breakpoint == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null)); @@ -994,7 +998,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I } // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null)); rm.done(); @@ -1002,7 +1006,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I } // Validate the breakpoint - final int reference = breakpointCtx.getReference(); + final String reference = breakpointCtx.getReference(); MIBreakpointDMData breakpoint = contextBreakpoints.get(reference); if (breakpoint == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT, null)); @@ -1030,8 +1034,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I // At this point, we know their are OK so there is no need to re-validate MIBreakpointDMContext breakpointCtx = (MIBreakpointDMContext) dmc; IBreakpointsTargetDMContext context = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class); - final Map contextBreakpoints = getBreakpointMap(context); - final int reference = breakpointCtx.getReference(); + final Map contextBreakpoints = getBreakpointMap(context); + final String reference = breakpointCtx.getReference(); MIBreakpointDMData breakpoint = contextBreakpoints.get(reference); // Track the number of change requests @@ -1107,13 +1111,13 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * @param condition * @param finalRm * - * @since 3.0 + * @since 5.0 */ protected void changeCondition(final IBreakpointsTargetDMContext context, - final int reference, final String condition, final RequestMonitor finalRm) + final String reference, final String condition, final RequestMonitor finalRm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -1181,13 +1185,13 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * @param ignoreCount * @param finalRm * - * @since 3.0 + * @since 5.0 */ protected void changeIgnoreCount(final IBreakpointsTargetDMContext context, - final int reference, final int ignoreCount, final RequestMonitor finalRm) + final String reference, final int ignoreCount, final RequestMonitor finalRm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -1226,13 +1230,13 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * @param reference * @param finalRm * - * @since 3.0 + * @since 5.0 */ protected void enableBreakpoint(final IBreakpointsTargetDMContext context, - final int reference, final RequestMonitor finalRm) + final String reference, final RequestMonitor finalRm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -1244,7 +1248,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - fCommandFactory.createMIBreakEnable(context, new int[] { reference }), + fCommandFactory.createMIBreakEnable(context, new String[] { reference }), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -1271,13 +1275,13 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I * @param dmc * @param finalRm * - * @since 3.0 + * @since 5.0 */ protected void disableBreakpoint(final IBreakpointsTargetDMContext context, - final int reference, final RequestMonitor finalRm) + final String reference, final RequestMonitor finalRm) { // Pick the context breakpoints map - final Map contextBreakpoints = getBreakpointMap(context); + final Map contextBreakpoints = getBreakpointMap(context); if (contextBreakpoints == null) { finalRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); finalRm.done(); @@ -1289,7 +1293,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - fCommandFactory.createMIBreakDisable(context, new int[] { reference }), + fCommandFactory.createMIBreakDisable(context, new String[] { reference }), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -1311,15 +1315,15 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I /** * This method deletes the target breakpoint with the given reference number. - * @since 4.2 + * @since 5.0 */ - protected void deleteBreakpointFromTarget(final IBreakpointsTargetDMContext context, final int reference, RequestMonitor finalRm) { + protected void deleteBreakpointFromTarget(final IBreakpointsTargetDMContext context, final String reference, RequestMonitor finalRm) { final Step deleteBreakpointStep = new Step() { @Override public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - fCommandFactory.createMIBreakDelete(context, new int[] { reference }), + fCommandFactory.createMIBreakDelete(context, new String[] { reference }), new DataRequestMonitor(getExecutor(), rm)); } }; @@ -1385,12 +1389,12 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I /** * Returns a breakpoint target context for given breakpoint number. - * @since 4.2 + * @since 5.0 */ - protected IBreakpointsTargetDMContext getBreakpointTargetContext(int reference) { + protected IBreakpointsTargetDMContext getBreakpointTargetContext(String reference) { for (IBreakpointsTargetDMContext context : fBreakpoints.keySet()) { - Map map = fBreakpoints.get(context); - if (map != null && map.keySet().contains(Integer.valueOf(reference))) { + Map map = fBreakpoints.get(context); + if (map != null && map.keySet().contains(reference)) { return context; } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java index b75aa7dfedf..c34d3444eac 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 Wind River and others. + * Copyright (c) 2007, 2016 Wind River and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1475,7 +1475,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo public void eventDispatched(SuspendedEvent e) { } - private void performBreakpointAction(final IDMContext context, int number) { + private void performBreakpointAction(final IDMContext context, String number) { // Identify the platform breakpoint final ICBreakpoint breakpoint = findPlatformBreakpoint(number); @@ -1496,7 +1496,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // to the target breakpoint/watchpoint that was just hit // FIXME: (Bug228703) Need a way to identify the correct context where the BP was hit - private ICBreakpoint findPlatformBreakpoint(int targetBreakpointID) { + private ICBreakpoint findPlatformBreakpoint(String targetBreakpointID) { Set targets = fBPToPlatformMaps.keySet(); for (IBreakpointsTargetDMContext target : targets) { Map bps = fBPToPlatformMaps.get(target); @@ -1504,7 +1504,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo for (IBreakpointDMContext context : contexts) { if (context instanceof MIBreakpointDMContext) { MIBreakpointDMContext ctx = (MIBreakpointDMContext) context; - if (ctx.getReference() == targetBreakpointID) { + if (ctx.getReference().equals(targetBreakpointID)) { return bps.get(context); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java index 4f01132c758..fe1f1bbfb57 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 Mentor Graphics and others. + * Copyright (c) 2012, 2016 Mentor Graphics and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -109,24 +109,24 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI /** * Collection of breakpoints created from the GDB console or outside of Eclipse */ - private Map> fCreatedTargetBreakpoints; + private Map> fCreatedTargetBreakpoints; /** * Collection of breakpoints deleted from the GDB console or outside of Eclipse */ - private Map> fDeletedTargetBreakpoints; + private Map> fDeletedTargetBreakpoints; /** * Collection of pending breakpoint modifications */ - private Map> fPendingModifications; + private Map> fPendingModifications; public MIBreakpointsSynchronizer(DsfSession session) { super(session); fTrackedTargets = new HashSet(); - fCreatedTargetBreakpoints = new HashMap>(); - fDeletedTargetBreakpoints = new HashMap>(); - fPendingModifications = new HashMap>(); + fCreatedTargetBreakpoints = new HashMap>(); + fDeletedTargetBreakpoints = new HashMap>(); + fPendingModifications = new HashMap>(); } @Override @@ -219,20 +219,20 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI } // Store the target breakpoint data - Map contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC); + Map contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC); if (contextBreakpoints == null) { contextBreakpoints = breakpointsService.createNewBreakpointMap(bpTargetDMC); } - contextBreakpoints.put(Integer.valueOf(miBpt.getNumber()), new MIBreakpointDMData(miBpt)); + contextBreakpoints.put(miBpt.getNumber(), new MIBreakpointDMData(miBpt)); // Store the created target breakpoint to prevent setting it again on the target // when addBreakpoint() is called. - Map targetMap = fCreatedTargetBreakpoints.get(bpTargetDMC); + Map targetMap = fCreatedTargetBreakpoints.get(bpTargetDMC); if (targetMap == null) { - targetMap = new HashMap(); + targetMap = new HashMap(); fCreatedTargetBreakpoints.put(bpTargetDMC, targetMap); } - targetMap.put(Integer.valueOf(miBpt.getNumber()), miBpt); + targetMap.put(miBpt.getNumber(), miBpt); // Convert the debug info file path into the file path in the local file system String debuggerPath = getFileName(miBpt); @@ -277,9 +277,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI } // Make sure the platform breakpoint's parameters are synchronized // with the target breakpoint. - Map map = fPendingModifications.get(bpTargetDMC); + Map map = fPendingModifications.get(bpTargetDMC); if (map != null) { - MIBreakpoint mod = map.remove(Integer.valueOf(miBpt.getNumber())); + MIBreakpoint mod = map.remove(miBpt.getNumber()); if (mod != null) { targetBreakpointModified(bpTargetDMC, plBpt, mod); } @@ -296,7 +296,10 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI }); } - public void targetBreakpointDeleted(final int id) { + /** + * @since 5.0 + */ + public void targetBreakpointDeleted(final String id) { MIBreakpoints breakpointsService = getBreakpointsService(); final MIBreakpointsManager bm = getBreakpointsManager(); if (breakpointsService == null || bm == null) { @@ -322,12 +325,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI IBreakpoint plBpt = bm.findPlatformBreakpoint(bpDMC); if (plBpt instanceof ICBreakpoint) { - Set set = fDeletedTargetBreakpoints.get(bpTargetDMC); + Set set = fDeletedTargetBreakpoints.get(bpTargetDMC); if (set == null) { - set = new HashSet(); + set = new HashSet(); fDeletedTargetBreakpoints.put(bpTargetDMC, set); } - set.add(Integer.valueOf(id)); + set.add(id); try { int threadId = Integer.parseInt(data.getThreadId()); @@ -390,7 +393,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI if (bpTargetDMC == null) { return; } - final Map contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC); + final Map contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC); if (contextBreakpoints == null) { return; } @@ -399,12 +402,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI if (!(b instanceof ICBreakpoint)) { // Platform breakpoint hasn't been created yet. Store the latest // modification data, it will be picked up later. - Map map = fPendingModifications.get(bpTargetDMC); + Map map = fPendingModifications.get(bpTargetDMC); if (map == null) { - map = new HashMap(); + map = new HashMap(); fPendingModifications.put(bpTargetDMC, map); } - map.put(Integer.valueOf(miBpt.getNumber()), miBpt); + map.put(miBpt.getNumber(), miBpt); } else { ICBreakpoint plBpt = (ICBreakpoint)b; @@ -417,9 +420,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI IBreakpointsTargetDMContext bpTargetDMC, ICBreakpoint plBpt, MIBreakpoint miBpt) { - Map contextBreakpoints = getBreakpointsService().getBreakpointMap(bpTargetDMC); - MIBreakpointDMData oldData = contextBreakpoints.get(Integer.valueOf(miBpt.getNumber())); - contextBreakpoints.put(Integer.valueOf(miBpt.getNumber()), new MIBreakpointDMData(miBpt)); + Map contextBreakpoints = getBreakpointsService().getBreakpointMap(bpTargetDMC); + MIBreakpointDMData oldData = contextBreakpoints.get(miBpt.getNumber()); + contextBreakpoints.put(miBpt.getNumber(), new MIBreakpointDMData(miBpt)); try { if (plBpt.isEnabled() != miBpt.isEnabled()) { plBpt.setEnabled(miBpt.isEnabled()); @@ -482,7 +485,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI } } catch(CoreException e) { - contextBreakpoints.put(Integer.valueOf(miBpt.getNumber()), oldData); + contextBreakpoints.put(miBpt.getNumber(), oldData); GdbPlugin.log(e.getStatus()); } } @@ -898,7 +901,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI IBreakpointsTargetDMContext context, Map attributes, DataRequestMonitor rm) { - Map map = fCreatedTargetBreakpoints.get(context); + Map map = fCreatedTargetBreakpoints.get(context); if (map == null) { rm.done(); return; @@ -1083,9 +1086,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI } public void removeCreatedTargetBreakpoint(IBreakpointsTargetDMContext context, MIBreakpoint miBpt) { - Map map = fCreatedTargetBreakpoints.get(context); + Map map = fCreatedTargetBreakpoints.get(context); if (map != null) { - map.remove(Integer.valueOf(miBpt.getNumber())); + map.remove(miBpt.getNumber()); } } @@ -1163,10 +1166,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI return isPlatformLineBreakpoint(plBpt, miBpt, fileName); } - public boolean isTargetBreakpointDeleted(IBreakpointsTargetDMContext context, int bpId, boolean remove) { - Set set = fDeletedTargetBreakpoints.get(context); + /** @since 5.0 */ + public boolean isTargetBreakpointDeleted(IBreakpointsTargetDMContext context, String bpId, boolean remove) { + Set set = fDeletedTargetBreakpoints.get(context); if (set != null) { - return (remove) ? set.remove(Integer.valueOf(bpId)) : set.contains(Integer.valueOf(bpId)); + return (remove) ? set.remove(bpId) : set.contains(bpId); } return false; } @@ -1461,15 +1465,15 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI // This will happen for GDB < 7.4 where the container is the breakpoint target. // For GDB >= 7.4, GDB is the breakpoint target and will not be removed. IBreakpointsTargetDMContext bpTargetDMContext = (IBreakpointsTargetDMContext)e.getDMContext(); - Map createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext); + Map createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext); if (createdBreakpoints != null) { createdBreakpoints.clear(); } - Map modifications = fPendingModifications.remove(bpTargetDMContext); + Map modifications = fPendingModifications.remove(bpTargetDMContext); if (modifications != null) { modifications.clear(); } - Set deletedBreakpoints = fDeletedTargetBreakpoints.remove(bpTargetDMContext); + Set deletedBreakpoints = fDeletedTargetBreakpoints.remove(bpTargetDMContext); if (deletedBreakpoints != null) { deletedBreakpoints.clear(); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java index c6e2a472623..d89fc67fb02 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2015 Wind River Systems and others. + * Copyright (c) 2006, 2016 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -524,9 +524,9 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I MIBreakpointDMContext _bp = null; if (e instanceof MIBreakpointHitEvent) { - int bpId = ((MIBreakpointHitEvent)e).getNumber(); + String bpId = ((MIBreakpointHitEvent)e).getNumber(); IBreakpointsTargetDMContext bpsTarget = DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class); - if (bpsTarget != null && bpId >= 0) { + if (bpsTarget != null && !bpId.isEmpty()) { _bp = new MIBreakpointDMContext(getSession().getId(), new IDMContext[] {bpsTarget}, bpId); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java index 01a6057e615..34929834fcb 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java @@ -319,7 +319,8 @@ public class CommandFactory { return new CLIMaintenance(ctx, subCommand); } - public ICommand createCLIPasscount(IBreakpointsTargetDMContext ctx, int breakpoint, int passcount) { + /** @since 5.0 */ + public ICommand createCLIPasscount(IBreakpointsTargetDMContext ctx, String breakpoint, int passcount) { return new CLIPasscount(ctx, breakpoint, passcount); } @@ -393,27 +394,33 @@ public class CommandFactory { return new MIAddInferior(ctx); } - public ICommand createMIBreakAfter(IBreakpointsTargetDMContext ctx, int breakpoint, int ignoreCount) { + /** @since 5.0 */ + public ICommand createMIBreakAfter(IBreakpointsTargetDMContext ctx, String breakpoint, int ignoreCount) { return new MIBreakAfter(ctx, breakpoint, ignoreCount); } - public ICommand createMIBreakCommands(IBreakpointsTargetDMContext ctx, int breakpoint, String[] commands) { + /** @since 5.0 */ + public ICommand createMIBreakCommands(IBreakpointsTargetDMContext ctx, String breakpoint, String[] commands) { return new MIBreakCommands(ctx, breakpoint, commands); } - public ICommand createMIBreakCondition(IBreakpointsTargetDMContext ctx, int breakpoint, String condition) { + /** @since 5.0 */ + public ICommand createMIBreakCondition(IBreakpointsTargetDMContext ctx, String breakpoint, String condition) { return new MIBreakCondition(ctx, breakpoint, condition); } - public ICommand createMIBreakDelete(IBreakpointsTargetDMContext ctx, int[] array) { + /** @since 5.0 */ + public ICommand createMIBreakDelete(IBreakpointsTargetDMContext ctx, String[] array) { return new MIBreakDelete(ctx, array); } - public ICommand createMIBreakDisable(IBreakpointsTargetDMContext ctx, int[] array) { + /** @since 5.0 */ + public ICommand createMIBreakDisable(IBreakpointsTargetDMContext ctx, String[] array) { return new MIBreakDisable(ctx, array); } - public ICommand createMIBreakEnable(IBreakpointsTargetDMContext ctx, int[] array) { + /** @since 5.0 */ + public ICommand createMIBreakEnable(IBreakpointsTargetDMContext ctx, String[] array) { return new MIBreakEnable(ctx, array); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java index f808bb00e6b..045f8b46c53 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIPasscount.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson and others. + * Copyright (c) 2009, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,9 +22,10 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; * @since 3.0 */ public class CLIPasscount extends CLICommand { - public CLIPasscount(IBreakpointsTargetDMContext ctx, int breakpoint, int passcount) { + /** @since 5.0 */ + public CLIPasscount(IBreakpointsTargetDMContext ctx, String breakpoint, int passcount) { super(ctx, "passcount"); //$NON-NLS-1$ - setParameters(new String[] { Integer.toString(passcount), Integer.toString(breakpoint) }); + setParameters(new String[] { Integer.toString(passcount), breakpoint }); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java index 3bd00025ae0..893670bba1f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakAfter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Ericsson and others. + * Copyright (c) 2007, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,8 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; public class MIBreakAfter extends MICommand { - public MIBreakAfter(IBreakpointsTargetDMContext ctx, int breakpoint, int ignoreCount) { - super(ctx, "-break-after", new String[] { Integer.toString(breakpoint), Integer.toString(ignoreCount) }); //$NON-NLS-1$ + /** @since 5.0 */ + public MIBreakAfter(IBreakpointsTargetDMContext ctx, String breakpoint, int ignoreCount) { + super(ctx, "-break-after", new String[] { breakpoint, Integer.toString(ignoreCount) }); //$NON-NLS-1$ } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java index f036be3d138..6f2733d6e3e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCommands.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Ericsson and others. + * Copyright (c) 2010, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,13 +29,14 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; public class MIBreakCommands extends MICommand { - public MIBreakCommands(IBreakpointsTargetDMContext ctx, int breakpoint, String[] commands) { + /** @since 5.0 */ + public MIBreakCommands(IBreakpointsTargetDMContext ctx, String breakpoint, String[] commands) { super(ctx, "-break-commands"); //$NON-NLS-1$ if (commands == null) { - setParameters(new String[] { Integer.toString(breakpoint) }); + setParameters(new String[] { breakpoint }); } else { String[] params = new String[commands.length + 1]; - params[0] = Integer.toString(breakpoint); + params[0] = breakpoint; for (int i = 1; i < params.length; i++) { params[i] = commands[i-1]; } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java index fd28ad9a327..9a3d642c957 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakCondition.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Ericsson and others. + * Copyright (c) 2007, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,11 +36,11 @@ public class MIBreakCondition extends MICommand * * See bug 213076 for more information. */ - - public MIBreakCondition(IBreakpointsTargetDMContext ctx, int breakpoint, String condition) { + /** @since 5.0 */ + public MIBreakCondition(IBreakpointsTargetDMContext ctx, String breakpoint, String condition) { super(ctx, "-break-condition"); //$NON-NLS-1$ - setParameters(new Adjustable[]{ new MIStandardParameterAdjustable(Integer.toString(breakpoint)), + setParameters(new Adjustable[]{ new MIStandardParameterAdjustable(breakpoint), new NoChangeAdjustable(condition) }); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java index b1cf09148f5..a7c3ac2e752 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDelete.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 QNX Software Systems and others. + * Copyright (c) 2000, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,12 +29,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; public class MIBreakDelete extends MICommand { - public MIBreakDelete (IBreakpointsTargetDMContext ctx, int[] array) { + /** @since 5.0 */ + public MIBreakDelete (IBreakpointsTargetDMContext ctx, String[] array) { super(ctx, "-break-delete"); //$NON-NLS-1$ if (array != null && array.length > 0) { String[] brkids = new String[array.length]; for (int i = 0; i < array.length; i++) { - brkids[i] = Integer.toString(array[i]); + brkids[i] = array[i]; } setParameters(brkids); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java index 0ce1dbf1e50..dba21ffdf22 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakDisable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 QNX Software Systems and others. + * Copyright (c) 2000, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,12 +28,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; public class MIBreakDisable extends MICommand { - public MIBreakDisable (IBreakpointsTargetDMContext ctx, int[] array) { + /** @since 5.0 */ + public MIBreakDisable (IBreakpointsTargetDMContext ctx, String[] array) { super(ctx, "-break-disable"); //$NON-NLS-1$ if (array != null && array.length > 0) { String[] brkids = new String[array.length]; for (int i = 0; i < array.length; i++) { - brkids[i] = Integer.toString(array[i]); + brkids[i] = array[i]; } setParameters(brkids); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java index 89cec6e223f..f4aeb198754 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIBreakEnable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 QNX Software Systems and others. + * Copyright (c) 2000, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,12 +27,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; public class MIBreakEnable extends MICommand { - public MIBreakEnable (IBreakpointsTargetDMContext ctx, int[] array) { + /** @since 5.0 */ + public MIBreakEnable (IBreakpointsTargetDMContext ctx, String[] array) { super(ctx, "-break-enable"); //$NON-NLS-1$ if (array != null && array.length > 0) { String[] brkids = new String[array.length]; for (int i = 0; i < array.length; i++) { - brkids[i] = Integer.toString(array[i]); + brkids[i] = array[i]; } setParameters(brkids); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java index c7653aaa862..06b4ae01f39 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIBreakpointHitEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 QNX Software Systems and others. + * Copyright (c) 2009, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -43,20 +43,22 @@ import org.eclipse.debug.core.model.IBreakpoint; @Immutable public class MIBreakpointHitEvent extends MIStoppedEvent { - int bkptno; + private String bkptno; - protected MIBreakpointHitEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, int bkptno) { + /** @since 5.0 */ + protected MIBreakpointHitEvent(IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String bkptno) { super(ctx, token, results, frame); this.bkptno = bkptno; } - public int getNumber() { + /** @since 5.0 */ + public String getNumber() { return bkptno; } @ConfinedToDsfExecutor("") public static MIBreakpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) { - int bkptno = -1; + String bkptno = ""; //$NON-NLS-1$ for (int i = 0; i < results.length; i++) { String var = results[i].getVariable(); @@ -68,7 +70,7 @@ public class MIBreakpointHitEvent extends MIStoppedEvent { if (var.equals("bkptno")) { //$NON-NLS-1$ try { - bkptno = Integer.parseInt(str.trim()); + bkptno = str.trim(); } catch (NumberFormatException e) { } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java index c1fe86d999e..8519fee62e5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MICatchpointHitEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,8 +27,9 @@ public class MICatchpointHitEvent extends MIBreakpointHitEvent { */ private String fReason; + /** @since 5.0 */ protected MICatchpointHitEvent(IExecutionDMContext ctx, int token, - MIResult[] results, MIFrame frame, int bkptno, String reason) { + MIResult[] results, MIFrame frame, String bkptno, String reason) { super(ctx, token, results, frame, bkptno); fReason = reason; } @@ -58,7 +59,7 @@ public class MICatchpointHitEvent extends MIBreakpointHitEvent { StringTokenizer tokenizer = new StringTokenizer(streamRecord.getString()); tokenizer.nextToken(); // "Catchpoint" try { - int bkptNumber = Integer.parseInt(tokenizer.nextToken()); // "1" + String bkptNumber = tokenizer.nextToken(); // "1" StringBuilder reason = new StringBuilder(); boolean first = true; while (tokenizer.hasMoreElements()) { @@ -95,8 +96,10 @@ public class MICatchpointHitEvent extends MIBreakpointHitEvent { * < 7.0 case we use the reason provided in the stream record (e.g., * "exception caught"). The inconsistency is fine. The user will get the * insight he needs either way. + * + * @since 5.0 */ - public static MICatchpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, int bkptNumber, String gdbKeyword) { + public static MICatchpointHitEvent parse(IExecutionDMContext dmc, int token, MIResult[] results, String bkptNumber, String gdbKeyword) { MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(dmc, token, results); return new MICatchpointHitEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame(), bkptNumber, gdbKeyword); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java index 8b26dbde8fd..552eae12124 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointScopeEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 QNX Software Systems and others. + * Copyright (c) 2009, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,16 +26,18 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue; @Immutable public class MIWatchpointScopeEvent extends MIStoppedEvent { - final private int number; + final private String number; + /** @since 5.0 */ protected MIWatchpointScopeEvent( - IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, int number) + IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, String number) { super(ctx, token, results, frame); this.number = number; } - public int getNumber() { + /** @since 5.0 */ + public String getNumber() { return number; } @@ -44,7 +46,7 @@ public class MIWatchpointScopeEvent extends MIStoppedEvent { */ public static MIWatchpointScopeEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) { - int number = 0; + String number = ""; //$NON-NLS-1$ for (int i = 0; i < results.length; i++) { String var = results[i].getVariable(); MIValue value = results[i].getMIValue(); @@ -53,7 +55,7 @@ public class MIWatchpointScopeEvent extends MIStoppedEvent { if (value instanceof MIConst) { String str = ((MIConst) value).getString(); try { - number = Integer.parseInt(str.trim()); + number = str.trim(); } catch (NumberFormatException e) { } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java index 5fbdc239e38..2765109440c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/events/MIWatchpointTriggerEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 QNX Software Systems and others. + * Copyright (c) 2009, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,14 +27,17 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIValue; @Immutable public class MIWatchpointTriggerEvent extends MIStoppedEvent { - final private int number; + final private String number; final private String exp; final private String oldValue; final private String newValue; + /** + * @since 5.0 + */ protected MIWatchpointTriggerEvent( IExecutionDMContext ctx, int token, MIResult[] results, MIFrame frame, - int number, String exp, String oldValue, String newValue) + String number, String exp, String oldValue, String newValue) { super(ctx, token, results, frame); this.number = number; @@ -43,7 +46,10 @@ public class MIWatchpointTriggerEvent extends MIStoppedEvent { this.newValue = newValue; } - public int getNumber() { + /** + * @since 5.0 + */ + public String getNumber() { return number; } @@ -64,7 +70,7 @@ public class MIWatchpointTriggerEvent extends MIStoppedEvent { */ public static MIWatchpointTriggerEvent parse(IExecutionDMContext dmc, int token, MIResult[] results) { - int number = 0; + String number = ""; //$NON-NLS-1$ String exp = ""; //$NON-NLS-1$ String oldValue = ""; //$NON-NLS-1$ String newValue = ""; //$NON-NLS-1$ @@ -83,7 +89,7 @@ public class MIWatchpointTriggerEvent extends MIStoppedEvent { if (wptValue instanceof MIConst) { String str = ((MIConst) wptValue).getString(); try { - number = Integer.parseInt(str); + number = str; } catch (NumberFormatException e) { } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java index 04936c1e85b..8f294f12885 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Ericsson and others. + * Copyright (c) 2012, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,7 +53,7 @@ import java.util.Set; */ public class CLIInfoBreakInfo extends MIInfo { - private Map fBreakpointToGroupMap = new HashMap(); + private Map fBreakpointToGroupMap = new HashMap(); public CLIInfoBreakInfo(MIOutput out) { super(out); @@ -65,7 +65,7 @@ public class CLIInfoBreakInfo extends MIInfo { * each breakpoint applies. If there is only a single thread-group being debugged, an * empty map will be returned. */ - public Map getBreakpointToGroupMap() { + public Map getBreakpointToGroupMap() { return fBreakpointToGroupMap; } @@ -81,14 +81,8 @@ public class CLIInfoBreakInfo extends MIInfo { // Get the breakpoint id by extracting the first element before a white space // or before a period. We can set a limit of 2 since we only need the first element String bpIdStr = line.split("[\\s\\.]", 2)[0]; //$NON-NLS-1$ - int bpId = 0; - try { - bpId = Integer.parseInt(bpIdStr); - } catch (NumberFormatException e) { - assert false; - } - String[] groups = fBreakpointToGroupMap.get(bpId); + String[] groups = fBreakpointToGroupMap.get(bpIdStr); Set groupIdList = new HashSet(); if (groups != null) { // Since we already know about this breakpoint id we must retain the list @@ -104,7 +98,7 @@ public class CLIInfoBreakInfo extends MIInfo { groupIdList.add("i" + id.trim()); //$NON-NLS-1$ } - fBreakpointToGroupMap.put(bpId, groupIdList.toArray(new String[groupIdList.size()])); + fBreakpointToGroupMap.put(bpIdStr, groupIdList.toArray(new String[groupIdList.size()])); } } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java index ffaf60aa25a..24a7b117584 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLITraceInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 Ericsson and others. + * Copyright (c) 2009, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,9 +28,10 @@ public class CLITraceInfo extends MIInfo { parse(); } - private Integer fReference = null; + private String fReference = null; - public Integer getTraceReference(){ + /** @since 5.0 */ + public String getTraceReference(){ return fReference; } @@ -47,11 +48,7 @@ public class CLITraceInfo extends MIInfo { Matcher matcher = pattern.matcher(str); if (matcher.find()) { String id = matcher.group(1); - try { - fReference = Integer.parseInt(id); - } catch (NumberFormatException e) { - fReference = null; - } + fReference = id; } } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java index 1cfcfda46fa..04089cf69e5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 QNX Software Systems and others. + * Copyright (c) 2000, 2016 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,7 +67,7 @@ import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManage */ public class MIBreakpoint { - int number = -1; + String number = ""; //$NON-NLS-1$ String type = ""; //$NON-NLS-1$ String disp = ""; //$NON-NLS-1$ boolean enabled = false; @@ -199,7 +199,7 @@ public class MIBreakpoint { */ public MIBreakpoint(String cliResult) { if (cliResult.startsWith("Catchpoint ")) { //$NON-NLS-1$ - int bkptNumber = 0; + String bkptNumber = ""; //$NON-NLS-1$ StringTokenizer tokenizer = new StringTokenizer(cliResult); for (int i = 0; tokenizer.hasMoreTokens(); i++) { @@ -208,7 +208,7 @@ public class MIBreakpoint { case 0: // first token is "Catchpoint" break; case 1: // second token is the breakpoint number - bkptNumber = Integer.parseInt(sub); + bkptNumber = sub; break; case 2: // third token is the event type; drop the parenthesis if (sub.startsWith("(")) { //$NON-NLS-1$ @@ -233,7 +233,8 @@ public class MIBreakpoint { // Properties getters /////////////////////////////////////////////////////////////////////////// - public int getNumber() { + /** @since 5.0 */ + public String getNumber() { return number; } @@ -506,10 +507,7 @@ public class MIBreakpoint { } if (var.equals("number")) { //$NON-NLS-1$ - try { - number = Integer.parseInt(str.trim()); - } catch (NumberFormatException e) { - } + number = str.trim(); } else if (var.equals("type")) { //$NON-NLS-1$ // Note that catchpoints are reported by gdb as address // breakpoints; there's really nothing we can go on to determine @@ -552,10 +550,7 @@ public class MIBreakpoint { } else if (var.equals("enabled")) { //$NON-NLS-1$ enabled = str.equals("y"); //$NON-NLS-1$ } else if (var.equals("addr")) { //$NON-NLS-1$ - try { - address = str.trim(); - } catch (NumberFormatException e) { - } + address = str.trim(); } else if (var.equals("func")) { //$NON-NLS-1$ func = str; } else if (var.equals("file")) { //$NON-NLS-1$ diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java index 554626dfce0..6c02912e4e8 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 Ericsson and others. + * Copyright (c) 2007, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -187,19 +187,19 @@ public class SyncUtil { return eventWaitor.waitForEvent(timeout); } - public static int addBreakpoint(String location) throws Throwable { + public static String addBreakpoint(String location) throws Throwable { return addBreakpoint(location, DefaultTimeouts.get(ETimeout.addBreakpoint)); } - public static int addBreakpoint(String location, int timeout) throws Throwable { + public static String addBreakpoint(String location, int timeout) throws Throwable { return addBreakpoint(location, true, timeout); } - public static int addBreakpoint(String location, boolean temporary) throws Throwable { + public static String addBreakpoint(String location, boolean temporary) throws Throwable { return addBreakpoint(location, temporary, DefaultTimeouts.get(ETimeout.addBreakpoint)); } - public static int addBreakpoint(final String location, final boolean temporary, int timeout) + public static String addBreakpoint(final String location, final boolean temporary, int timeout) throws Throwable { IContainerDMContext containerDmc = SyncUtil.getContainerContext(); @@ -220,7 +220,7 @@ public class SyncUtil { } - public static int[] getBreakpointList(int timeout) throws Throwable { + public static String[] getBreakpointList(int timeout) throws Throwable { IContainerDMContext containerDmc = SyncUtil.getContainerContext(); final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class); @@ -235,18 +235,18 @@ public class SyncUtil { MIBreakListInfo info = query.get(timeout, TimeUnit.MILLISECONDS); MIBreakpoint[] breakpoints = info.getMIBreakpoints(); - int[] result = new int[breakpoints.length]; + String[] result = new String[breakpoints.length]; for (int i = 0; i < breakpoints.length; i++) { result[i] = breakpoints[i].getNumber(); } return result; } - public static void deleteBreakpoint(int breakpointIndex, int timeout) throws Throwable { - deleteBreakpoint(new int[] {breakpointIndex}, timeout); + public static void deleteBreakpoint(String breakpointIndex, int timeout) throws Throwable { + deleteBreakpoint(new String[] {breakpointIndex}, timeout); } - public static void deleteBreakpoint(final int[] breakpointIndices, int timeout) throws Throwable { + public static void deleteBreakpoint(final String[] breakpointIndices, int timeout) throws Throwable { IContainerDMContext containerDmc = SyncUtil.getContainerContext(); final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java index 7c637e02f92..830c87b6461 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBConsoleBreakpointsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 Mentor Graphics and others. + * Copyright (c) 2012, 2016 Mentor Graphics and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -374,22 +374,22 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase { queueConsoleCommand(String.format("%s %s", command, expression)); } - private void deleteConsoleBreakpoint(int bpId) throws Throwable { - queueConsoleCommand(String.format("delete %d", bpId)); + private void deleteConsoleBreakpoint(String bpId) throws Throwable { + queueConsoleCommand(String.format("delete %s", bpId)); } - private void enableConsoleBreakpoint(int bpId, boolean enable) throws Throwable { + private void enableConsoleBreakpoint(String bpId, boolean enable) throws Throwable { String cmd = (enable) ? "enable" : "disable"; - queueConsoleCommand(String.format("%s %d", cmd, bpId)); + queueConsoleCommand(String.format("%s %s", cmd, bpId)); } - private void setConsoleBreakpointIgnoreCount(int bpId, int ignoreCount) throws Throwable { + private void setConsoleBreakpointIgnoreCount(String bpId, int ignoreCount) throws Throwable { Assert.assertTrue(ignoreCount >= 0); - queueConsoleCommand(String.format("ignore %d %d", bpId, ignoreCount)); + queueConsoleCommand(String.format("ignore %s %d", bpId, ignoreCount)); } - private void setConsoleBreakpointCondition(int bpId, String condition) throws Throwable { - queueConsoleCommand(String.format("condition %d %s", bpId, condition)); + private void setConsoleBreakpointCondition(String bpId, String condition) throws Throwable { + queueConsoleCommand(String.format("condition %s %s", bpId, condition)); } private MIBreakpoint[] getTargetBreakpoints() throws Throwable { diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java index 0131d7cc277..7273efa26ac 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 Ericsson and others. + * Copyright (c) 2007, 2016 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -117,7 +117,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { protected final int WP_OOS = Events.WP_OOS.ordinal(); protected int[] fBreakpointEvents = new int[Events.values().length]; protected int fBreakpointEventCount; - protected int fBreakpointRef; + protected String fBreakpointRef; // Some useful constants protected final String BREAKPOINT_TYPE_TAG = MIBreakpoints.BREAKPOINT_TYPE; protected final String BREAKPOINT_TAG = MIBreakpoints.BREAKPOINT; @@ -330,7 +330,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { * @param timeout * max wait time, in milliseconds */ - private void waitForBreakpointEvent(int count, final int timeout) throws Exception { + private void waitForBreakpointEvent(final int count, final int timeout) throws Exception { try { Timeout.builder().withTimeout(timeout, TimeUnit.MILLISECONDS).build().apply( new Statement() { @@ -1097,9 +1097,9 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { MIBreakpointDMData svc_bp2 = (MIBreakpointDMData) getBreakpoint(breakpoints[1]); // The breakpoint references are not necessarily retrieved in the order the // breakpoints were initially set... - int ref1 = breakpoint1.getNumber(); - int ref2 = svc_bp1.getNumber(); - if (ref1 == ref2) { + String ref1 = breakpoint1.getNumber(); + String ref2 = svc_bp1.getNumber(); + if (ref1.equals(ref2)) { assertTrue("BreakpointService problem: breakpoint mismatch", svc_bp1.equals(breakpoint1)); assertTrue("BreakpointService problem: breakpoint mismatch", svc_bp2.equals(breakpoint2)); } else { @@ -1172,9 +1172,9 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { MIBreakpointDMData svc_bp2 = (MIBreakpointDMData) getBreakpoint(breakpoints[1]); // The breakpoint references are not necessarily retrieved in the order the // breakpoints were initially set... - int ref1 = breakpoint1.getNumber(); - int ref2 = svc_bp1.getNumber(); - if (ref1 == ref2) { + String ref1 = breakpoint1.getNumber(); + String ref2 = svc_bp1.getNumber(); + if (ref1.equals(ref2)) { assertTrue("BreakpointService problem: breakpoint mismatch", svc_bp1.equals(breakpoint1)); assertTrue("BreakpointService problem: breakpoint mismatch", svc_bp2.equals(breakpoint2)); } else { @@ -1219,14 +1219,14 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); assertTrue("Did not stop because of breakpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == ref.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(ref.getReference())); } // ------------------------------------------------------------------------ @@ -1273,14 +1273,14 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); assertTrue("Did not stop because of breakpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == ref.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(ref.getReference())); } /////////////////////////////////////////////////////////////////////////// // Add Watchpoint tests @@ -1475,7 +1475,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("Did not stop because of watchpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIWatchpointTriggerEvent); assertTrue("Did not stop because of the watchpoint", - ((MIWatchpointTriggerEvent) event).getNumber() == watchpoint1.getReference()); + ((MIWatchpointTriggerEvent) event).getNumber().equals(watchpoint1.getReference())); } /////////////////////////////////////////////////////////////////////////// // Remove Breakpoint tests @@ -1527,7 +1527,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { public void removeBreakpoint_InvalidBreakpoint() throws Throwable { // Create an invalid breakpoint reference IBreakpointDMContext invalid_ref = new MIBreakpointDMContext((MIBreakpoints) fBreakpointService, - new IDMContext[] { fBreakpointsDmc }, 0); + new IDMContext[] { fBreakpointsDmc }, "0.0"); // Remove the invalid breakpoint String expected = UNKNOWN_BREAKPOINT; removeBreakpoint(invalid_ref); @@ -1714,7 +1714,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("Did not stop on a breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == ref1.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(ref1.getReference())); } /////////////////////////////////////////////////////////////////////////// // Breakpoint Update tests @@ -1729,7 +1729,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { public void updateBreakpoint_InvalidBreakpoint() throws Throwable { // Create an invalid breakpoint reference IBreakpointDMContext invalid_ref = new MIBreakpointDMContext((MIBreakpoints) fBreakpointService, - new IDMContext[] { fBreakpointsDmc }, 0); + new IDMContext[] { fBreakpointsDmc }, "0.0"); // Update the invalid breakpoint String expected = UNKNOWN_BREAKPOINT; Map properties = new HashMap(); @@ -1925,7 +1925,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("Did not stop on our modified breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == breakpoint2.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(breakpoint2.getReference())); } // ------------------------------------------------------------------------ @@ -2236,7 +2236,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("Did not stop on our modified breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == breakpoint2.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(breakpoint2.getReference())); } // ------------------------------------------------------------------------ @@ -2300,7 +2300,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint2.getNumber()); + fBreakpointRef.equals(breakpoint2.getNumber())); clearEventCounters(); } @@ -2358,7 +2358,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("Did not stop on a breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == ref1.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(ref1.getReference())); } // ------------------------------------------------------------------------ @@ -2423,7 +2423,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint2.getNumber()); + fBreakpointRef.equals(breakpoint2.getNumber())); clearEventCounters(); // Enable the first breakpoint delta = new HashMap(); @@ -2451,7 +2451,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); clearEventCounters(); } @@ -2510,7 +2510,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == breakpoint1.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(breakpoint1.getReference())); } private void queueConsoleCommand(final String command) throws Throwable { @@ -2574,7 +2574,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { event instanceof MIBreakpointHitEvent); MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(bps[0]); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == bpData.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(bpData.getReference())); // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2606,7 +2606,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { event instanceof MIBreakpointHitEvent); bpData = (MIBreakpointDMData) getBreakpoint(bps[0]); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent) event).getNumber() == bpData.getReference()); + ((MIBreakpointHitEvent) event).getNumber().equals(bpData.getReference())); // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2653,7 +2653,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); @@ -2690,7 +2690,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); @@ -2731,7 +2731,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); @@ -2786,7 +2786,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); @@ -2830,7 +2830,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); @@ -2885,7 +2885,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); @@ -2927,7 +2927,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received " + getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1); assertTrue("BreakpointService problem: watchpoint mismatch", - fBreakpointRef == watchpoint1.getNumber()); + fBreakpointRef.equals(watchpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); @@ -2969,7 +2969,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received " + getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1); assertTrue("BreakpointService problem: watchpoint mismatch", - fBreakpointRef == watchpoint1.getNumber()); + fBreakpointRef.equals(watchpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); @@ -3012,7 +3012,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received " + getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1); assertTrue("BreakpointService problem: watchpoint mismatch", - fBreakpointRef == watchpoint1.getNumber()); + fBreakpointRef.equals(watchpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); @@ -3068,7 +3068,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received " + getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1); assertTrue("BreakpointService problem: watchpoint mismatch", - fBreakpointRef == watchpoint1.getNumber()); + fBreakpointRef.equals(watchpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); @@ -3128,7 +3128,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received " + getBreakpointEventCount(WP_HIT), getBreakpointEventCount(WP_HIT) == 1); assertTrue("BreakpointService problem: watchpoint mismatch", - fBreakpointRef == watchpoint1.getNumber()); + fBreakpointRef.equals(watchpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); @@ -3176,7 +3176,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " WATCHPOINT_HIT event(s), received " + getBreakpointEventCount(WP_OOS), getBreakpointEventCount(WP_OOS) == 1); assertTrue("BreakpointService problem: watchpoint mismatch", - fBreakpointRef == watchpoint1.getNumber()); + fBreakpointRef.equals(watchpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); @@ -3354,7 +3354,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 0); assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); + fBreakpointRef.equals(breakpoint1.getNumber())); assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", breakpoint1.isPending()); clearEventCounters(); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java index 3c9c1c91d3b..fb2959fac21 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java @@ -124,7 +124,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { /** * The gdb breakpoint number associated with the most recent breakpoint event */ - private int fBreakpointRef; + private String fBreakpointRef; // NOTE: The back-end can reformat the condition. In order for the // comparison to work, better specify the condition as the back-end @@ -701,7 +701,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { // The breakpoint references are not necessarily retrieved in the order the // breakpoints were initially set... - if (bkpt1_svc.getNumber() == bkpt1_set.getNumber()) { + if (bkpt1_svc.getNumber().equals(bkpt1_set.getNumber())) { assertEquals(bkpt2_svc.getNumber(), bkpt2_set.getNumber()); } else { @@ -733,7 +733,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { // The breakpoint references are not necessarily retrieved in the order the // breakpoints were initially set... - if (bkpt1_svc.getNumber() == bkpt1_set.getNumber()) { + if (bkpt1_svc.getNumber().equals(bkpt1_set.getNumber())) { assertEquals(bkpt2_svc.getNumber(), bkpt2_set.getNumber()); } else { @@ -1222,14 +1222,14 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 2, breakpoints.length); - int throwCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refThrow)).getNumber(); + String throwCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refThrow)).getNumber(); for (IBreakpointDMContext bkpt : breakpoints) { MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(bkpt); - assertEquals("Incorrect breakpoint condition", throwCatchpointNumber != bkpt_svc.getNumber(), bkpt_svc.isEnabled()); + assertEquals("Incorrect breakpoint condition", !throwCatchpointNumber.equals(bkpt_svc.getNumber()), bkpt_svc.isEnabled()); } // Resume the target. Should miss the throw catchpoint and stop at the catch one - int catchCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refCatch)).getNumber(); + String catchCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refCatch)).getNumber(); resumeAndExpectBkptHit(catchCatchpointNumber, null); // Ee-enable the throw catchpoint @@ -1382,7 +1382,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { * indicate a check isn't wanted * @return the stoppped event */ - private MIStoppedEvent resumeAndExpectBkptHit(int bkptNumber, Integer expectedVarValue) throws Throwable { + private MIStoppedEvent resumeAndExpectBkptHit(String bkptNumber, Integer expectedVarValue) throws Throwable { // Resume the target. The throw catchpoint should get hit. clearEventCounters(); MIStoppedEvent event = SyncUtil.resumeUntilStopped(); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java index e0104f8136c..58c673d0315 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java @@ -142,7 +142,7 @@ public class TraceFileTest extends BaseParametrizedTestCase { startTracing(); MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(); assertTrue(stoppedEvent instanceof MIBreakpointHitEvent - && ((MIBreakpointHitEvent)stoppedEvent).getNumber() == bptDMC.getReference()); + && ((MIBreakpointHitEvent)stoppedEvent).getNumber().equals(bptDMC.getReference())); stopTracing(); saveTraceData(); }