1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-09 19:43:27 +02:00

Bug 299167, turn the Variable View's Address column into a Location column.

This commit is contained in:
Ken Ryall 2010-01-11 22:08:24 +00:00
parent 485b4d73de
commit fceb61087c
5 changed files with 69 additions and 17 deletions

View file

@ -22,10 +22,10 @@ public class MessagesForVariablesVM extends NLS {
public static String VariableColumnPresentation_name; public static String VariableColumnPresentation_name;
public static String VariableColumnPresentation_type; public static String VariableColumnPresentation_type;
public static String VariableColumnPresentation_value; public static String VariableColumnPresentation_value;
public static String VariableColumnPresentation_address; public static String VariableColumnPresentation_location;
public static String VariableVMNode_Address_column__Error__text_format; public static String VariableVMNode_Location_column__Error__text_format;
public static String VariableVMNode_Address_column__text_format; public static String VariableVMNode_Location_column__text_format;
public static String VariableVMNode_Description_column__text_format; public static String VariableVMNode_Description_column__text_format;
public static String VariableVMNode_Expression_column__text_format; public static String VariableVMNode_Expression_column__text_format;
public static String VariableVMNode_Name_column__text_format; public static String VariableVMNode_Name_column__text_format;

View file

@ -42,7 +42,7 @@ public class VariableColumnPresentation implements IColumnPresentation {
} else if (IDebugVMConstants.COLUMN_ID__VALUE.equals(id)) { } else if (IDebugVMConstants.COLUMN_ID__VALUE.equals(id)) {
return MessagesForVariablesVM.VariableColumnPresentation_value; return MessagesForVariablesVM.VariableColumnPresentation_value;
} else if (IDebugVMConstants.COLUMN_ID__ADDRESS.equals(id)) { } else if (IDebugVMConstants.COLUMN_ID__ADDRESS.equals(id)) {
return MessagesForVariablesVM.VariableColumnPresentation_address; return MessagesForVariablesVM.VariableColumnPresentation_location;
} }
return null; return null;
} }

View file

@ -17,7 +17,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.internal.ui.CDebugImages; import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor; import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
@ -36,6 +35,7 @@ import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionChangedDMEvent;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMAddress; import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMAddress;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext; import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMData; import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMData;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMLocation;
import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryChangedEvent; import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryChangedEvent;
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
@ -132,7 +132,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
* *
* @since 2.0 * @since 2.0
*/ */
private IElementLabelProvider fLabelProvider; private final IElementLabelProvider fLabelProvider;
public class VariableExpressionVMC extends DMVMContext implements IFormattedValueVMContext { public class VariableExpressionVMC extends DMVMContext implements IFormattedValueVMContext {
@ -375,9 +375,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
IDebugVMConstants.COLUMN_ID__ADDRESS, IDebugVMConstants.COLUMN_ID__ADDRESS,
new LabelColumnInfo(new LabelAttribute[] { new LabelColumnInfo(new LabelAttribute[] {
new LabelText( new LabelText(
MessagesForVariablesVM.VariableVMNode_Address_column__text_format, MessagesForVariablesVM.VariableVMNode_Location_column__text_format,
new String[] { PROP_VARIABLE_ADDRESS }), new String[] { PROP_VARIABLE_ADDRESS }),
new LabelText(MessagesForVariablesVM.VariableVMNode_Address_column__Error__text_format, new String[] {}), new LabelText(MessagesForVariablesVM.VariableVMNode_Location_column__Error__text_format, new String[] {}),
new LabelBackground( new LabelBackground(
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB()) DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
{ {
@ -706,9 +706,10 @@ public class VariableVMNode extends AbstractExpressionVMNode
@ConfinedToDsfExecutor("getSession().getExecutor()") @ConfinedToDsfExecutor("getSession().getExecutor()")
protected void fillAddressDataProperties(IPropertiesUpdate update, IExpressionDMAddress address) protected void fillAddressDataProperties(IPropertiesUpdate update, IExpressionDMAddress address)
{ {
IExpressionDMAddress expression = address; if (address instanceof IExpressionDMLocation)
IAddress expAddress = expression.getAddress(); update.setProperty(PROP_VARIABLE_ADDRESS, ((IExpressionDMLocation)address).getLocation());
update.setProperty(PROP_VARIABLE_ADDRESS, "0x" + expAddress.toString(16)); //$NON-NLS-1$ else
update.setProperty(PROP_VARIABLE_ADDRESS, "0x" + address.getAddress().toString(16)); //$NON-NLS-1$
} }
public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) { public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) {

View file

@ -7,16 +7,17 @@
# #
# Contributors: # Contributors:
# Wind River Systems - initial API and implementation # Wind River Systems - initial API and implementation
# Wind River Systems - added Address # Wind River Systems - added Location
# Wind River Systems - changed Location to Location
############################################################################### ###############################################################################
VariableColumnPresentation_name=Name VariableColumnPresentation_name=Name
VariableColumnPresentation_type=Type VariableColumnPresentation_type=Type
VariableColumnPresentation_value=Value VariableColumnPresentation_value=Value
VariableColumnPresentation_address=Address VariableColumnPresentation_location=Location
VariableVMNode_Address_column__Error__text_format= VariableVMNode_Location_column__Error__text_format=
VariableVMNode_Address_column__text_format={0} VariableVMNode_Location_column__text_format={0}
VariableVMNode_Description_column__text_format= VariableVMNode_Description_column__text_format=
VariableVMNode_Expression_column__text_format={0} VariableVMNode_Expression_column__text_format={0}
VariableVMNode_Name_column__text_format={0} VariableVMNode_Name_column__text_format={0}

View file

@ -11,6 +11,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.service; package org.eclipse.cdt.dsf.debug.service;
import java.math.BigInteger;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IAddress;
@ -41,14 +42,61 @@ public interface IExpressions extends IFormattedValues {
*/ */
String getExpression(); String getExpression();
} }
/** /**
* The address and size of an expression. * The address and size of an expression.
*/ */
public interface IExpressionDMAddress { public interface IExpressionDMAddress {
/**
* Returns the address of the expression.
*/
IAddress getAddress(); IAddress getAddress();
/**
* Returns the size of the address.
*/
int getSize(); int getSize();
} }
/**
* A representation of an expression location that does not correspond to
* an address.
*
* @since 2.1
*/
public interface IExpressionDMLocation extends IExpressionDMAddress {
/**
* A constant that can be returned by {@link IExpressionDMAddress#getAddress()}
* to represent an invalid address. Implementations of
* <code>IExpressionDMLocation</code> can return this constant if no
* valid address can be returned for a given expression location.
*/
public static final IAddress INVALID_ADDRESS = new IAddress() {
public IAddress add(BigInteger offset) { return this; }
public IAddress add(long offset) { return this; }
public BigInteger getMaxOffset() { return BigInteger.ZERO; }
public BigInteger distanceTo(IAddress other) { return BigInteger.ZERO; }
public BigInteger getValue() { return BigInteger.ZERO; }
public boolean isZero() { return false; }
public boolean isMax() { return false; }
public String toString(int radix) { return "INVALID"; }
public String toHexAddressString() { return toString(); }
public String toBinaryAddressString() { return toString(); }
public int getCharsNum() { return 0; }
public int getSize() { return 0; }
public int compareTo(Object o) { return 0; }
};
/**
* Returns a string representation of the expression location.
*/
public String getLocation();
}
/** /**
* This is the model data interface that corresponds to IExpressionDMContext. * This is the model data interface that corresponds to IExpressionDMContext.
@ -140,7 +188,9 @@ public interface IExpressions extends IFormattedValues {
/** /**
* Retrieves the address and size of an expression given by the expression context(<tt>dmc</tt>). * Retrieves the address and size of an expression given by the expression context(<tt>dmc</tt>).
* Non-lvalues do not have an addresses (e.g., "x + 5"). When the expression * Non-lvalues do not have an addresses (e.g., "x + 5"). When the expression
- * has no address, the data request monitor will contain null. - * has no address, the request monitor will have an error with code
* <code>IDsfStatusConstants.REQUEST_FAILED</code> and the data request
* monitor will contain null.
* *
* @param dmc * @param dmc
* The ExpressionDMC for the expression * The ExpressionDMC for the expression