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

[248606] Add support for toggling watchpoints in the variables and expressions views.

This commit is contained in:
John Cortell 2010-02-22 15:07:48 +00:00
parent e78dc0a109
commit a32879bdc0
4 changed files with 24 additions and 10 deletions

View file

@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2010 Wind River Systems, Inc. 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
* Freescale Semiconductor - refactoring
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core; package org.eclipse.cdt.debug.internal.core;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;

View file

@ -25,7 +25,7 @@ public interface ICWatchpointTarget {
/** IRequest object used in the asynchronous method {@link ICWatchpointTarget#getSize()} */ /** IRequest object used in the asynchronous method {@link ICWatchpointTarget#getSize()} */
interface GetSizeRequest extends IRequest { interface GetSizeRequest extends IRequest {
int getSize(); int getSize(); // returns -1 if size not available
void setSize(int size); void setSize(int size);
}; };

View file

@ -53,7 +53,7 @@ public class AddWatchpointOnVariableActionDelegate extends AddWatchpointActionDe
} }
private static class GetSizeRequest extends CRequest implements ICWatchpointTarget.GetSizeRequest { private static class GetSizeRequest extends CRequest implements ICWatchpointTarget.GetSizeRequest {
int fSize; int fSize = -1;
public int getSize() { public int getSize() {
return fSize; return fSize;
} }
@ -122,6 +122,7 @@ public class AddWatchpointOnVariableActionDelegate extends AddWatchpointActionDe
* org.eclipse.jface.viewers.ISelection) * org.eclipse.jface.viewers.ISelection)
*/ */
public void selectionChanged(final IAction action, ISelection selection) { public void selectionChanged(final IAction action, ISelection selection) {
fVar = null;
if (selection == null || selection.isEmpty()) { if (selection == null || selection.isEmpty()) {
action.setEnabled(false); action.setEnabled(false);
return; return;

View file

@ -66,19 +66,23 @@ public class GdbVariableVMNode extends VariableVMNode {
if (expressionService != null) { if (expressionService != null) {
final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) { final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) {
@Override @Override
public void handleSuccess() { public void handleCompleted() {
request.setSize(getData().getSize()); if (isSuccess()) {
request.setSize(getData().getSize());
}
request.done(); request.done();
} }
}; };
expressionService.getExpressionAddressData(exprDmc, drm); expressionService.getExpressionAddressData(exprDmc, drm);
} }
else {
request.done();
}
} }
}); });
} }
else { else {
request.setSize(-1);
request.done(); request.done();
} }
} }
@ -104,24 +108,22 @@ public class GdbVariableVMNode extends VariableVMNode {
assert getData().getSize() > 0; assert getData().getSize() > 0;
request.setCanCreate(true); request.setCanCreate(true);
} }
else {
request.setCanCreate(false);
}
request.done(); request.done();
} }
}; };
expressionService.getExpressionAddressData(exprDmc, drm); expressionService.getExpressionAddressData(exprDmc, drm);
} }
else {
request.done();
}
} }
}); });
} }
else { else {
request.setCanCreate(false);
request.done(); request.done();
} }
} }
}; };
/** /**