mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
Bug 357440 - [disassembly] Add opcode ruler column to the disassembly view
This commit is contained in:
parent
9fe6dfee8e
commit
6f21f0999c
12 changed files with 306 additions and 56 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Wind River Systems and others.
|
* Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -18,20 +18,22 @@ import java.math.BigInteger;
|
||||||
public class DisassemblyPosition extends AddressRangePosition {
|
public class DisassemblyPosition extends AddressRangePosition {
|
||||||
|
|
||||||
public char[] fFunction;
|
public char[] fFunction;
|
||||||
|
public BigInteger fOpcodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param offset
|
* @param offset
|
||||||
* @param length
|
* @param length
|
||||||
* @param addressOffset
|
* @param addressOffset
|
||||||
* @param addressLength
|
* @param addressLength
|
||||||
|
* @param functionOffset
|
||||||
* @param opcodes
|
* @param opcodes
|
||||||
*/
|
*/
|
||||||
public DisassemblyPosition(int offset, int length, BigInteger addressOffset, BigInteger addressLength, String opcodes) {
|
public DisassemblyPosition(int offset, int length, BigInteger addressOffset, BigInteger addressLength, String functionOffset, BigInteger opcodes) {
|
||||||
super(offset, length, addressOffset, addressLength);
|
super(offset, length, addressOffset, addressLength);
|
||||||
fFunction = opcodes.toCharArray();
|
fOpcodes = opcodes;
|
||||||
}
|
fFunction = functionOffset.toCharArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return source file
|
* @return source file
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Wind River Systems, Inc. and others.
|
* Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -28,6 +28,11 @@ public interface IDisassemblyDocument {
|
||||||
throws BadLocationException;
|
throws BadLocationException;
|
||||||
|
|
||||||
AddressRangePosition insertDisassemblyLine(AddressRangePosition p,
|
AddressRangePosition insertDisassemblyLine(AddressRangePosition p,
|
||||||
BigInteger address, int intValue, String opCode, String string,
|
BigInteger address, int intValue, String functionOffset, String instruction,
|
||||||
String compilationPath, int lineNumber) throws BadLocationException;
|
String compilationPath, int lineNumber) throws BadLocationException;
|
||||||
|
|
||||||
|
AddressRangePosition insertDisassemblyLine(AddressRangePosition p,
|
||||||
|
BigInteger address, int length, String functionOffset, BigInteger opcode,
|
||||||
|
String instruction, String compilationPath, int lineNumber)
|
||||||
|
throws BadLocationException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.dsf.ui;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.dsf.ui;singleton:=true
|
||||||
Bundle-Version: 2.2.1.qualifier
|
Bundle-Version: 2.3.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin
|
Bundle-Activator: org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.ui;bundle-version="3.5.0",
|
Require-Bundle: org.eclipse.ui;bundle-version="3.5.0",
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>2.2.1-SNAPSHOT</version>
|
<version>2.3-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.dsf.ui</artifactId>
|
<artifactId>org.eclipse.cdt.dsf.ui</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Wind River Systems and others.
|
* Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -31,6 +31,7 @@ public final class DisassemblyMessages extends NLS {
|
||||||
|
|
||||||
public static String Disassembly_action_ShowAddresses_label;
|
public static String Disassembly_action_ShowAddresses_label;
|
||||||
public static String Disassembly_action_ShowFunctionOffsets_label;
|
public static String Disassembly_action_ShowFunctionOffsets_label;
|
||||||
|
public static String Disassembly_action_ShowOpcode_label;
|
||||||
public static String Disassembly_action_ShowSource_label;
|
public static String Disassembly_action_ShowSource_label;
|
||||||
public static String Disassembly_action_ShowSymbols_label;
|
public static String Disassembly_action_ShowSymbols_label;
|
||||||
public static String Disassembly_action_GotoPC_label;
|
public static String Disassembly_action_GotoPC_label;
|
||||||
|
@ -65,6 +66,10 @@ public final class DisassemblyMessages extends NLS {
|
||||||
public static String DisassemblyPreferencePage_radix_hexadecimal;
|
public static String DisassemblyPreferencePage_radix_hexadecimal;
|
||||||
public static String DisassemblyPreferencePage_showFunctionOffsets;
|
public static String DisassemblyPreferencePage_showFunctionOffsets;
|
||||||
public static String DisassemblyPreferencePage_showFunctionOffsetsTooltip;
|
public static String DisassemblyPreferencePage_showFunctionOffsetsTooltip;
|
||||||
|
public static String DisassemblyPreferencePage_showCodeBytes;
|
||||||
|
public static String DisassemblyPreferencePage_showCodeBytesTooltip;
|
||||||
|
public static String DisassemblyPreferencePage_OpcodeFormat;
|
||||||
|
public static String DisassemblyPreferencePage_OpcodeFormatTooltip;
|
||||||
public static String DisassemblyPreferencePage_showAddress;
|
public static String DisassemblyPreferencePage_showAddress;
|
||||||
public static String DisassemblyPreferencePage_showAddressTooltip;
|
public static String DisassemblyPreferencePage_showAddressTooltip;
|
||||||
public static String DisassemblyPreferencePage_showRadixTooltip;
|
public static String DisassemblyPreferencePage_showRadixTooltip;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Copyright (c) 2007, 2010 Wind River Systems and others.
|
# Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
Disassembly_action_ShowAddresses_label=Show Addresses
|
Disassembly_action_ShowAddresses_label=Show Addresses
|
||||||
Disassembly_action_ShowFunctionOffsets_label=Show Function Offsets
|
Disassembly_action_ShowFunctionOffsets_label=Show Function Offsets
|
||||||
|
Disassembly_action_ShowOpcode_label=Show Opcodes
|
||||||
Disassembly_action_ShowSource_label=Show Source
|
Disassembly_action_ShowSource_label=Show Source
|
||||||
Disassembly_action_ShowSymbols_label=Show Symbols
|
Disassembly_action_ShowSymbols_label=Show Symbols
|
||||||
Disassembly_action_GotoPC_label=Go to Program Counter
|
Disassembly_action_GotoPC_label=Go to Program Counter
|
||||||
|
@ -57,7 +58,11 @@ DisassemblyPreferencePage_radix_decimal=Decimal
|
||||||
DisassemblyPreferencePage_radix_hexadecimal=Hexadecimal
|
DisassemblyPreferencePage_radix_hexadecimal=Hexadecimal
|
||||||
DisassemblyPreferencePage_showFunctionOffsets=Show function offsets
|
DisassemblyPreferencePage_showFunctionOffsets=Show function offsets
|
||||||
DisassemblyPreferencePage_showFunctionOffsetsTooltip=Show offsets of addresses in a function
|
DisassemblyPreferencePage_showFunctionOffsetsTooltip=Show offsets of addresses in a function
|
||||||
|
DisassemblyPreferencePage_showCodeBytes=Show instruction code bytes
|
||||||
|
DisassemblyPreferencePage_showCodeBytesTooltip=Show the value of the address for the instruction code bytes
|
||||||
DisassemblyPreferencePage_showAddress=Show instruction address
|
DisassemblyPreferencePage_showAddress=Show instruction address
|
||||||
|
DisassemblyPreferencePage_OpcodeFormatTooltip=Use this format for the instruction value
|
||||||
|
DisassemblyPreferencePage_OpcodeFormat=Opcode display format:
|
||||||
DisassemblyPreferencePage_showAddressTooltip=Show the address of each instruction
|
DisassemblyPreferencePage_showAddressTooltip=Show the address of each instruction
|
||||||
DisassemblyPreferencePage_showRadixTooltip=Show '0x' with hexadecimal addresses
|
DisassemblyPreferencePage_showRadixTooltip=Show '0x' with hexadecimal addresses
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
protected AbstractDisassemblyAction fActionGotoAddress;
|
protected AbstractDisassemblyAction fActionGotoAddress;
|
||||||
protected AbstractDisassemblyAction fActionToggleSource;
|
protected AbstractDisassemblyAction fActionToggleSource;
|
||||||
private AbstractDisassemblyAction fActionToggleFunctionColumn;
|
private AbstractDisassemblyAction fActionToggleFunctionColumn;
|
||||||
|
private AbstractDisassemblyAction fActionToggleOpcodeColumn;
|
||||||
protected AbstractDisassemblyAction fActionToggleSymbols;
|
protected AbstractDisassemblyAction fActionToggleSymbols;
|
||||||
protected AbstractDisassemblyAction fActionRefreshView;
|
protected AbstractDisassemblyAction fActionRefreshView;
|
||||||
protected Action fActionOpenPreferences;
|
protected Action fActionOpenPreferences;
|
||||||
|
@ -243,7 +244,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
private TextViewerDragAdapter fDragSourceAdapter;
|
private TextViewerDragAdapter fDragSourceAdapter;
|
||||||
private DisassemblyDropAdapter fDropTargetAdapter;
|
private DisassemblyDropAdapter fDropTargetAdapter;
|
||||||
|
|
||||||
private FunctionOffsetRulerColumn fOpcodeRulerColumn;
|
private FunctionOffsetRulerColumn fFunctionOffsetRulerColumn;
|
||||||
|
private OpcodeRulerColumn fOpcodeRulerColumn;
|
||||||
private AddressRulerColumn fAddressRulerColumn;
|
private AddressRulerColumn fAddressRulerColumn;
|
||||||
|
|
||||||
private BigInteger fStartAddress;
|
private BigInteger fStartAddress;
|
||||||
|
@ -270,6 +272,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
private List<Action> fSelectionActions = new ArrayList<Action>();
|
private List<Action> fSelectionActions = new ArrayList<Action>();
|
||||||
private List<AbstractDisassemblyAction> fStateDependentActions = new ArrayList<AbstractDisassemblyAction>();
|
private List<AbstractDisassemblyAction> fStateDependentActions = new ArrayList<AbstractDisassemblyAction>();
|
||||||
private boolean fShowSource;
|
private boolean fShowSource;
|
||||||
|
private boolean fShowFunctionOffsets;
|
||||||
private boolean fShowOpcodes;
|
private boolean fShowOpcodes;
|
||||||
private boolean fShowSymbols;
|
private boolean fShowSymbols;
|
||||||
private Map<String, Object> fFile2Storage = new HashMap<String, Object>();
|
private Map<String, Object> fFile2Storage = new HashMap<String, Object>();
|
||||||
|
@ -409,6 +412,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final class ActionToggleOpcodeColumn extends AbstractDisassemblyAction {
|
||||||
|
ActionToggleOpcodeColumn() {
|
||||||
|
super(DisassemblyPart.this);
|
||||||
|
setText(DisassemblyMessages.Disassembly_action_ShowOpcode_label);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
|
||||||
|
store.setValue(DisassemblyPreferenceConstants.SHOW_CODE_BYTES, !isOpcodeRulerVisible());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
setChecked(isOpcodeRulerVisible());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final class ActionToggleBreakpointEnablement extends AbstractDisassemblyAction {
|
private final class ActionToggleBreakpointEnablement extends AbstractDisassemblyAction {
|
||||||
private IBreakpoint fBreakpoint;
|
private IBreakpoint fBreakpoint;
|
||||||
public ActionToggleBreakpointEnablement() {
|
public ActionToggleBreakpointEnablement() {
|
||||||
|
@ -518,7 +537,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
else
|
else
|
||||||
fEndAddress = new BigInteger(endAddressString, 16);
|
fEndAddress = new BigInteger(endAddressString, 16);
|
||||||
fShowSource = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_SOURCE);
|
fShowSource = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_SOURCE);
|
||||||
fShowOpcodes = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS);
|
fShowFunctionOffsets = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS);
|
||||||
|
fShowOpcodes = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_CODE_BYTES);
|
||||||
fShowSymbols = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_SYMBOLS);
|
fShowSymbols = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_SYMBOLS);
|
||||||
fUpdateBeforeFocus = !prefs.getBoolean(DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC);
|
fUpdateBeforeFocus = !prefs.getBoolean(DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC);
|
||||||
fPCHistorySizeMax = prefs.getInt(DisassemblyPreferenceConstants.PC_HISTORY_SIZE);
|
fPCHistorySizeMax = prefs.getInt(DisassemblyPreferenceConstants.PC_HISTORY_SIZE);
|
||||||
|
@ -602,6 +622,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
hideAddressRuler();
|
hideAddressRuler();
|
||||||
showAddressRuler();
|
showAddressRuler();
|
||||||
}
|
}
|
||||||
|
} else if (property.equals(DisassemblyPreferenceConstants.OPCODE_RADIX)) {
|
||||||
|
if (isOpcodeRulerVisible()) {
|
||||||
|
hideOpcodeRuler();
|
||||||
|
showOpcodeRuler();
|
||||||
|
}
|
||||||
} else if (property.equals(DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX)) {
|
} else if (property.equals(DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX)) {
|
||||||
if (fAddressRulerColumn != null) {
|
if (fAddressRulerColumn != null) {
|
||||||
hideAddressRuler();
|
hideAddressRuler();
|
||||||
|
@ -624,13 +649,21 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
fActionToggleSymbols.update();
|
fActionToggleSymbols.update();
|
||||||
refreshView(10);
|
refreshView(10);
|
||||||
} else if (property.equals(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS)) {
|
} else if (property.equals(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS)) {
|
||||||
fShowOpcodes = store.getBoolean(property);
|
fShowFunctionOffsets = store.getBoolean(property);
|
||||||
fActionToggleFunctionColumn.update();
|
fActionToggleFunctionColumn.update();
|
||||||
if (isFunctionOffsetsRulerVisible()) {
|
if (isFunctionOffsetsRulerVisible()) {
|
||||||
showFunctionOffsetsRuler();
|
showFunctionOffsetsRuler();
|
||||||
} else {
|
} else {
|
||||||
hideFunctionOffsetsRuler();
|
hideFunctionOffsetsRuler();
|
||||||
}
|
}
|
||||||
|
} else if (property.equals(DisassemblyPreferenceConstants.SHOW_CODE_BYTES)) {
|
||||||
|
fShowOpcodes = store.getBoolean(property);
|
||||||
|
fActionToggleOpcodeColumn.update();
|
||||||
|
if (isOpcodeRulerVisible()) {
|
||||||
|
showOpcodeRuler();
|
||||||
|
} else {
|
||||||
|
hideOpcodeRuler();
|
||||||
|
}
|
||||||
} else if (property.equals(DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC)) {
|
} else if (property.equals(DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC)) {
|
||||||
fUpdateBeforeFocus = !store.getBoolean(property);
|
fUpdateBeforeFocus = !store.getBoolean(property);
|
||||||
updateVisibleArea();
|
updateVisibleArea();
|
||||||
|
@ -699,6 +732,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
if (isFunctionOffsetsRulerVisible()) {
|
if (isFunctionOffsetsRulerVisible()) {
|
||||||
showFunctionOffsetsRuler();
|
showFunctionOffsetsRuler();
|
||||||
}
|
}
|
||||||
|
if (isOpcodeRulerVisible()) {
|
||||||
|
showOpcodeRuler();
|
||||||
|
}
|
||||||
|
|
||||||
initDragAndDrop();
|
initDragAndDrop();
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(fViewer.getControl(), IDisassemblyHelpContextIds.DISASSEMBLY_VIEW);
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(fViewer.getControl(), IDisassemblyHelpContextIds.DISASSEMBLY_VIEW);
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
@ -1025,8 +1062,21 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
* @return the created line number column
|
* @return the created line number column
|
||||||
*/
|
*/
|
||||||
protected IVerticalRulerColumn createFunctionOffsetsRulerColumn() {
|
protected IVerticalRulerColumn createFunctionOffsetsRulerColumn() {
|
||||||
fOpcodeRulerColumn= new FunctionOffsetRulerColumn();
|
fFunctionOffsetRulerColumn= new FunctionOffsetRulerColumn();
|
||||||
initializeRulerColumn(fOpcodeRulerColumn, DisassemblyPreferenceConstants.FUNCTION_OFFSETS_COLOR);
|
|
||||||
|
initializeRulerColumn(fFunctionOffsetRulerColumn, DisassemblyPreferenceConstants.FUNCTION_OFFSETS_COLOR);
|
||||||
|
|
||||||
|
return fFunctionOffsetRulerColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IVerticalRulerColumn createOpcodeRulerColumn() {
|
||||||
|
fOpcodeRulerColumn= new OpcodeRulerColumn();
|
||||||
|
|
||||||
|
initializeRulerColumn(fOpcodeRulerColumn, DisassemblyPreferenceConstants.CODE_BYTES_COLOR);
|
||||||
|
|
||||||
|
IPreferenceStore prefs = getPreferenceStore();
|
||||||
|
fOpcodeRulerColumn.setRadix(prefs.getInt(DisassemblyPreferenceConstants.OPCODE_RADIX));
|
||||||
|
|
||||||
return fOpcodeRulerColumn;
|
return fOpcodeRulerColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,18 +1160,49 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFunctionOffsetsRulerVisible() {
|
private boolean isFunctionOffsetsRulerVisible() {
|
||||||
|
return fShowFunctionOffsets;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isOpcodeRulerVisible() {
|
||||||
return fShowOpcodes;
|
return fShowOpcodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the function offset ruler column.
|
||||||
|
*/
|
||||||
|
private void showFunctionOffsetsRuler() {
|
||||||
|
if (fFunctionOffsetRulerColumn == null) {
|
||||||
|
IVerticalRuler v= getVerticalRuler();
|
||||||
|
if (v instanceof CompositeRuler) {
|
||||||
|
CompositeRuler c= (CompositeRuler) v;
|
||||||
|
c.addDecorator(3, createFunctionOffsetsRulerColumn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the function offset ruler column.
|
||||||
|
*/
|
||||||
|
private void hideFunctionOffsetsRuler() {
|
||||||
|
if (fFunctionOffsetRulerColumn != null) {
|
||||||
|
IVerticalRuler v= getVerticalRuler();
|
||||||
|
if (v instanceof CompositeRuler) {
|
||||||
|
CompositeRuler c= (CompositeRuler) v;
|
||||||
|
c.removeDecorator(fFunctionOffsetRulerColumn);
|
||||||
|
}
|
||||||
|
fFunctionOffsetRulerColumn = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the opcode ruler column.
|
* Shows the opcode ruler column.
|
||||||
*/
|
*/
|
||||||
private void showFunctionOffsetsRuler() {
|
private void showOpcodeRuler() {
|
||||||
if (fOpcodeRulerColumn == null) {
|
if (fOpcodeRulerColumn == null) {
|
||||||
IVerticalRuler v= getVerticalRuler();
|
IVerticalRuler v= getVerticalRuler();
|
||||||
if (v instanceof CompositeRuler) {
|
if (v instanceof CompositeRuler) {
|
||||||
CompositeRuler c= (CompositeRuler) v;
|
CompositeRuler c= (CompositeRuler) v;
|
||||||
c.addDecorator(2, createFunctionOffsetsRulerColumn());
|
c.addDecorator(2, createOpcodeRulerColumn());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1210,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
/**
|
/**
|
||||||
* Hides the opcode ruler column.
|
* Hides the opcode ruler column.
|
||||||
*/
|
*/
|
||||||
private void hideFunctionOffsetsRuler() {
|
private void hideOpcodeRuler() {
|
||||||
if (fOpcodeRulerColumn != null) {
|
if (fOpcodeRulerColumn != null) {
|
||||||
IVerticalRuler v= getVerticalRuler();
|
IVerticalRuler v= getVerticalRuler();
|
||||||
if (v instanceof CompositeRuler) {
|
if (v instanceof CompositeRuler) {
|
||||||
|
@ -1235,6 +1316,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
protected void fillRulerContextMenu(IMenuManager manager) {
|
protected void fillRulerContextMenu(IMenuManager manager) {
|
||||||
fActionToggleBreakpointEnablement.update();
|
fActionToggleBreakpointEnablement.update();
|
||||||
fActionToggleAddressColumn.update();
|
fActionToggleAddressColumn.update();
|
||||||
|
fActionToggleOpcodeColumn.update();
|
||||||
fActionToggleFunctionColumn.update();
|
fActionToggleFunctionColumn.update();
|
||||||
|
|
||||||
manager.add(new GroupMarker("group.top")); // ICommonMenuConstants.GROUP_TOP //$NON-NLS-1$
|
manager.add(new GroupMarker("group.top")); // ICommonMenuConstants.GROUP_TOP //$NON-NLS-1$
|
||||||
|
@ -1246,6 +1328,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
manager.add(new Separator("add")); //$NON-NLS-1$
|
manager.add(new Separator("add")); //$NON-NLS-1$
|
||||||
manager.add(new Separator(ITextEditorActionConstants.GROUP_RULERS));
|
manager.add(new Separator(ITextEditorActionConstants.GROUP_RULERS));
|
||||||
manager.add(fActionToggleAddressColumn);
|
manager.add(fActionToggleAddressColumn);
|
||||||
|
manager.add(fActionToggleOpcodeColumn);
|
||||||
manager.add(fActionToggleFunctionColumn);
|
manager.add(fActionToggleFunctionColumn);
|
||||||
manager.add(new Separator(ITextEditorActionConstants.GROUP_REST));
|
manager.add(new Separator(ITextEditorActionConstants.GROUP_REST));
|
||||||
|
|
||||||
|
@ -1347,6 +1430,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
});
|
});
|
||||||
fActionToggleBreakpointEnablement = new ActionToggleBreakpointEnablement();
|
fActionToggleBreakpointEnablement = new ActionToggleBreakpointEnablement();
|
||||||
fActionToggleAddressColumn = new ActionToggleAddressColumn();
|
fActionToggleAddressColumn = new ActionToggleAddressColumn();
|
||||||
|
fActionToggleOpcodeColumn = new ActionToggleOpcodeColumn();
|
||||||
fActionToggleFunctionColumn = new ActionToggleFunctionColumn();
|
fActionToggleFunctionColumn = new ActionToggleFunctionColumn();
|
||||||
fActionToggleSymbols = new ActionToggleSymbols();
|
fActionToggleSymbols = new ActionToggleSymbols();
|
||||||
fActionRefreshView = new ActionRefreshView();
|
fActionRefreshView = new ActionRefreshView();
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Wind River Systems - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
|
||||||
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
|
||||||
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A vertical ruler column to display the opcodes of instructions.
|
||||||
|
*/
|
||||||
|
public class OpcodeRulerColumn extends DisassemblyRulerColumn {
|
||||||
|
|
||||||
|
private int fRadix;
|
||||||
|
private String fRadixPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
public OpcodeRulerColumn() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadix(int radix) {
|
||||||
|
fRadix= radix;
|
||||||
|
setShowRadixPrefix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowRadixPrefix() {
|
||||||
|
if (fRadix == 16) {
|
||||||
|
fRadixPrefix = "0x"; //$NON-NLS-1$
|
||||||
|
} else if (fRadix == 8) {
|
||||||
|
fRadixPrefix = "0"; //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
fRadixPrefix = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.jface.text.source.LineNumberRulerColumn#createDisplayString(int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String createDisplayString(int line) {
|
||||||
|
int nChars = computeNumberOfCharacters();
|
||||||
|
if (nChars > 0) {
|
||||||
|
DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
|
||||||
|
try {
|
||||||
|
int offset = doc.getLineOffset(line);
|
||||||
|
AddressRangePosition pos = doc.getDisassemblyPosition(offset);
|
||||||
|
if (pos instanceof DisassemblyPosition && pos.length > 0 && pos.offset == offset && pos.fValid) {
|
||||||
|
DisassemblyPosition disassPos = (DisassemblyPosition)pos;
|
||||||
|
if (disassPos.fOpcodes != null) {
|
||||||
|
// Format the output.
|
||||||
|
String str = disassPos.fOpcodes.toString(fRadix);
|
||||||
|
int prefixLength = 0;
|
||||||
|
|
||||||
|
if (fRadixPrefix != null)
|
||||||
|
prefixLength = fRadixPrefix.length();
|
||||||
|
|
||||||
|
StringBuilder buf = new StringBuilder(nChars);
|
||||||
|
|
||||||
|
if (prefixLength != 0)
|
||||||
|
buf.append(fRadixPrefix);
|
||||||
|
|
||||||
|
for (int i=str.length()+prefixLength; i < nChars; ++i)
|
||||||
|
buf.append('0');
|
||||||
|
buf.append(str);
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
} else if (pos != null && !pos.fValid) {
|
||||||
|
return DOTS.substring(0, nChars);
|
||||||
|
}
|
||||||
|
} catch (BadLocationException e) {
|
||||||
|
// silently ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int computeNumberOfCharacters() {
|
||||||
|
DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
|
||||||
|
return doc.getMaxOpcodeLength(fRadix);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Wind River Systems and others.
|
* Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -71,13 +71,14 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
private final Map<IStorage, SourceFileInfo> fFileInfoMap = new HashMap<IStorage, SourceFileInfo>();
|
private final Map<IStorage, SourceFileInfo> fFileInfoMap = new HashMap<IStorage, SourceFileInfo>();
|
||||||
|
|
||||||
private int fMaxFunctionLength = 0;
|
private int fMaxFunctionLength = 0;
|
||||||
|
private BigInteger fMaxOpcodeLength = null;
|
||||||
|
|
||||||
private boolean fShowAddresses = false;
|
private boolean fShowAddresses = false;
|
||||||
private int fRadix = 16;
|
private int fRadix = 16;
|
||||||
private boolean fShowRadixPrefix = false;
|
private boolean fShowRadixPrefix = false;
|
||||||
private String fRadixPrefix;
|
private String fRadixPrefix;
|
||||||
private int fNumberOfDigits;
|
private int fNumberOfDigits;
|
||||||
private boolean fShowCodeBytes = false;
|
private boolean fShowFunctionOffset = false;
|
||||||
|
|
||||||
private int fNumberOfInstructions;
|
private int fNumberOfInstructions;
|
||||||
private double fMeanSizeOfInstructions = 4;
|
private double fMeanSizeOfInstructions = 4;
|
||||||
|
@ -140,7 +141,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
return fInvalidAddressRanges.toArray(new AddressRangePosition[fInvalidAddressRanges.size()]);
|
return fInvalidAddressRanges.toArray(new AddressRangePosition[fInvalidAddressRanges.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxOpcodeLength(int opcodeLength) {
|
public void setMaxFunctionLength(int opcodeLength) {
|
||||||
fMaxFunctionLength = opcodeLength;
|
fMaxFunctionLength = opcodeLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +149,29 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
return fMaxFunctionLength;
|
return fMaxFunctionLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxOpcodeLength(BigInteger longOpcode ) {
|
||||||
|
fMaxOpcodeLength = longOpcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxOpcodeLength(int radix ) {
|
||||||
|
int retVal = 0;
|
||||||
|
if (fMaxOpcodeLength != null) {
|
||||||
|
String str = fMaxOpcodeLength.toString(radix);
|
||||||
|
retVal = str.length();
|
||||||
|
switch (radix) {
|
||||||
|
case 8:
|
||||||
|
retVal += 1; // Padded for 0 prefix
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
retVal += 2; // Padded for 0x prefix
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
public int getAddressLength() {
|
public int getAddressLength() {
|
||||||
return fNumberOfDigits+2;
|
return fNumberOfDigits+2;
|
||||||
}
|
}
|
||||||
|
@ -694,10 +718,16 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
// cannot happen
|
// cannot happen
|
||||||
}
|
}
|
||||||
if (pos instanceof DisassemblyPosition) {
|
if (pos instanceof DisassemblyPosition) {
|
||||||
int functionLength = ((DisassemblyPosition)pos).fFunction.length;
|
DisassemblyPosition disassPos = (DisassemblyPosition)pos;
|
||||||
|
int functionLength = disassPos.fFunction.length;
|
||||||
if (functionLength > fMaxFunctionLength) {
|
if (functionLength > fMaxFunctionLength) {
|
||||||
fMaxFunctionLength = functionLength;
|
fMaxFunctionLength = functionLength;
|
||||||
}
|
}
|
||||||
|
if (disassPos.fOpcodes != null) {
|
||||||
|
if (fMaxOpcodeLength == null || fMaxOpcodeLength.compareTo(disassPos.fOpcodes) == -1) {
|
||||||
|
fMaxOpcodeLength = disassPos.fOpcodes;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (fNumberOfInstructions < 100 && fMeanSizeOfInstructions < 16.0) {
|
if (fNumberOfInstructions < 100 && fMeanSizeOfInstructions < 16.0) {
|
||||||
fMeanSizeOfInstructions = (fMeanSizeOfInstructions * fNumberOfInstructions + pos.fAddressLength.floatValue()) / (++fNumberOfInstructions);
|
fMeanSizeOfInstructions = (fMeanSizeOfInstructions * fNumberOfInstructions + pos.fAddressLength.floatValue()) / (++fNumberOfInstructions);
|
||||||
}
|
}
|
||||||
|
@ -989,32 +1019,40 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
|
||||||
*/
|
*/
|
||||||
public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String opcode, String instruction, String file, int lineNr)
|
public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String functionOffset, String instruction, String file, int lineNr)
|
||||||
|
throws BadLocationException {
|
||||||
|
return insertDisassemblyLine(pos, address, length, functionOffset, null, instruction, file, lineNr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
|
||||||
|
*/
|
||||||
|
public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String functionOffset, BigInteger opcode, String instruction, String file, int lineNr)
|
||||||
throws BadLocationException {
|
throws BadLocationException {
|
||||||
assert isGuiThread();
|
assert isGuiThread();
|
||||||
String disassLine = null;
|
String disassLine = null;
|
||||||
if (instruction == null || instruction.length() == 0) {
|
if (instruction == null || instruction.length() == 0) {
|
||||||
disassLine = ""; //$NON-NLS-1$
|
disassLine = ""; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
disassLine = buildDisassemblyLine(address, opcode, instruction);
|
disassLine = buildDisassemblyLine(address, functionOffset, instruction);
|
||||||
}
|
}
|
||||||
AddressRangePosition disassPos;
|
AddressRangePosition disassPos;
|
||||||
if (lineNr < 0) {
|
if (lineNr < 0) {
|
||||||
disassPos = new DisassemblyPosition(0, disassLine.length(), address, BigInteger.valueOf(length), opcode);
|
disassPos = new DisassemblyPosition(0, disassLine.length(), address, BigInteger.valueOf(length), functionOffset, opcode);
|
||||||
} else {
|
} else {
|
||||||
disassPos = new DisassemblyWithSourcePosition(0, disassLine.length(), address, BigInteger.valueOf(length),
|
disassPos = new DisassemblyWithSourcePosition(0, disassLine.length(), address, BigInteger.valueOf(length),
|
||||||
opcode, file, lineNr);
|
functionOffset, opcode, file, lineNr);
|
||||||
}
|
}
|
||||||
pos = insertAddressRange(pos, disassPos, disassLine, true);
|
pos = insertAddressRange(pos, disassPos, disassLine, true);
|
||||||
addDisassemblyPosition(disassPos);
|
addDisassemblyPosition(disassPos);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param address
|
* @param address
|
||||||
* @param opcode
|
* @param functionOffset
|
||||||
* @param instruction
|
* @param instruction
|
||||||
*/
|
*/
|
||||||
private String buildDisassemblyLine(BigInteger address, String opcode, String instruction) {
|
private String buildDisassemblyLine(BigInteger address, String functionOffset, String instruction) {
|
||||||
StringBuffer buf = new StringBuffer(40);
|
StringBuffer buf = new StringBuffer(40);
|
||||||
if (fShowAddresses) {
|
if (fShowAddresses) {
|
||||||
if (fRadixPrefix != null) {
|
if (fRadixPrefix != null) {
|
||||||
|
@ -1027,13 +1065,13 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
|
||||||
buf.append(':');
|
buf.append(':');
|
||||||
buf.append(' ');
|
buf.append(' ');
|
||||||
}
|
}
|
||||||
if (fShowCodeBytes && opcode != null && opcode.length() > 0) {
|
if (fShowFunctionOffset && functionOffset != null && functionOffset.length() > 0) {
|
||||||
buf.append(opcode);
|
buf.append(functionOffset);
|
||||||
int tab = 16;
|
int tab = 16;
|
||||||
if (opcode.length() >= 16) {
|
if (functionOffset.length() >= 16) {
|
||||||
tab = (opcode.length() + 8) & ~7;
|
tab = (functionOffset.length() + 8) & ~7;
|
||||||
}
|
}
|
||||||
int diff = tab - opcode.length();
|
int diff = tab - functionOffset.length();
|
||||||
while (diff-- > 0) {
|
while (diff-- > 0) {
|
||||||
buf.append(' ');
|
buf.append(' ');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Wind River Systems and others.
|
* Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -27,10 +27,11 @@ public class DisassemblyWithSourcePosition extends DisassemblyPosition {
|
||||||
* @param length
|
* @param length
|
||||||
* @param addressOffset
|
* @param addressOffset
|
||||||
* @param addressLength
|
* @param addressLength
|
||||||
* @param opcodes
|
* @param functionOffset
|
||||||
|
* @param opcode
|
||||||
*/
|
*/
|
||||||
public DisassemblyWithSourcePosition(int offset, int length, BigInteger addressOffset, BigInteger addressLength, String opcodes, String file, int lineNr) {
|
public DisassemblyWithSourcePosition(int offset, int length, BigInteger addressOffset, BigInteger addressLength, String functionOffset, BigInteger opcode, String file, int lineNr) {
|
||||||
super(offset, length, addressOffset, addressLength, opcodes);
|
super(offset, length, addressOffset, addressLength, functionOffset, opcode);
|
||||||
fFile = file;
|
fFile = file;
|
||||||
fLine = lineNr;
|
fLine = lineNr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,14 @@ public class DisassemblyPreferenceConstants {
|
||||||
public static final String SHOW_SOURCE = "disassembly.showSource"; //$NON-NLS-1$
|
public static final String SHOW_SOURCE = "disassembly.showSource"; //$NON-NLS-1$
|
||||||
public static final String SHOW_SYMBOLS = "disassembly.showSymbols"; //$NON-NLS-1$
|
public static final String SHOW_SYMBOLS = "disassembly.showSymbols"; //$NON-NLS-1$
|
||||||
public static final String ADDRESS_RADIX = "disassembly.addressRadix"; //$NON-NLS-1$
|
public static final String ADDRESS_RADIX = "disassembly.addressRadix"; //$NON-NLS-1$
|
||||||
|
public static final String OPCODE_RADIX = "disassembly.opcodeRadix"; //$NON-NLS-1$
|
||||||
public static final String SHOW_ADDRESS_RADIX = "disassembly.showAddressRadix"; //$NON-NLS-1$
|
public static final String SHOW_ADDRESS_RADIX = "disassembly.showAddressRadix"; //$NON-NLS-1$
|
||||||
public static final String SHOW_ADDRESS_RULER = "disassembly.showAddressRuler"; //$NON-NLS-1$
|
public static final String SHOW_ADDRESS_RULER = "disassembly.showAddressRuler"; //$NON-NLS-1$
|
||||||
public static final String ADDRESS_COLOR = "disassembly.addressColor"; //$NON-NLS-1$
|
public static final String ADDRESS_COLOR = "disassembly.addressColor"; //$NON-NLS-1$
|
||||||
public static final String SHOW_FUNCTION_OFFSETS = "disassembly.showFunctionOffsetRuler"; //$NON-NLS-1$
|
public static final String SHOW_FUNCTION_OFFSETS = "disassembly.showFunctionOffsetRuler"; //$NON-NLS-1$
|
||||||
public static final String FUNCTION_OFFSETS_COLOR = "disassembly.functionOffsetsColor"; //$NON-NLS-1$
|
public static final String FUNCTION_OFFSETS_COLOR = "disassembly.functionOffsetsColor"; //$NON-NLS-1$
|
||||||
|
public static final String SHOW_CODE_BYTES = "disassembly.showCodeBytesRuler"; //$NON-NLS-1$
|
||||||
|
public static final String CODE_BYTES_COLOR = "disassembly.codeBytesColor"; //$NON-NLS-1$
|
||||||
public static final String AVOID_READ_BEFORE_PC = "disassembly.avoidReadBeforePC"; //$NON-NLS-1$
|
public static final String AVOID_READ_BEFORE_PC = "disassembly.avoidReadBeforePC"; //$NON-NLS-1$
|
||||||
public static final String TRACK_EXPRESSION = "disassembly.trackExpression"; //$NON-NLS-1$
|
public static final String TRACK_EXPRESSION = "disassembly.trackExpression"; //$NON-NLS-1$
|
||||||
public static final String SYNC_ACTIVE_CONTEXT = "disassembly.syncActiveContext"; //$NON-NLS-1$
|
public static final String SYNC_ACTIVE_CONTEXT = "disassembly.syncActiveContext"; //$NON-NLS-1$
|
||||||
|
@ -56,13 +59,16 @@ public class DisassemblyPreferenceConstants {
|
||||||
store.setDefault(PC_HISTORY_SIZE, 4);
|
store.setDefault(PC_HISTORY_SIZE, 4);
|
||||||
store.setDefault(SHOW_SOURCE, true);
|
store.setDefault(SHOW_SOURCE, true);
|
||||||
store.setDefault(SHOW_FUNCTION_OFFSETS, false);
|
store.setDefault(SHOW_FUNCTION_OFFSETS, false);
|
||||||
|
store.setDefault(SHOW_CODE_BYTES, false);
|
||||||
store.setDefault(SHOW_SYMBOLS, true);
|
store.setDefault(SHOW_SYMBOLS, true);
|
||||||
store.setDefault(ADDRESS_RADIX, 16);
|
store.setDefault(ADDRESS_RADIX, 16);
|
||||||
|
store.setDefault(OPCODE_RADIX, 16);
|
||||||
store.setDefault(SHOW_ADDRESS_RADIX, false);
|
store.setDefault(SHOW_ADDRESS_RADIX, false);
|
||||||
store.setDefault(SHOW_ADDRESS_RULER, true);
|
store.setDefault(SHOW_ADDRESS_RULER, true);
|
||||||
store.setDefault(AVOID_READ_BEFORE_PC, false);
|
store.setDefault(AVOID_READ_BEFORE_PC, false);
|
||||||
PreferenceConverter.setDefault(store, ADDRESS_COLOR, new RGB(0, 96, 0));
|
PreferenceConverter.setDefault(store, ADDRESS_COLOR, new RGB(0, 96, 0));
|
||||||
PreferenceConverter.setDefault(store, FUNCTION_OFFSETS_COLOR, new RGB(96, 0, 0));
|
PreferenceConverter.setDefault(store, FUNCTION_OFFSETS_COLOR, new RGB(96, 0, 0));
|
||||||
|
PreferenceConverter.setDefault(store, CODE_BYTES_COLOR, new RGB(96, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Initializer extends AbstractPreferenceInitializer {
|
public static class Initializer extends AbstractPreferenceInitializer {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Wind River Systems and others.
|
* Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -51,6 +51,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private Combo fAddressFormatCombo;
|
private Combo fAddressFormatCombo;
|
||||||
|
private Combo fOpcodeFormatCombo;
|
||||||
private final static String[] fcRadixItems = {
|
private final static String[] fcRadixItems = {
|
||||||
DisassemblyMessages.DisassemblyPreferencePage_radix_octal,
|
DisassemblyMessages.DisassemblyPreferencePage_radix_octal,
|
||||||
DisassemblyMessages.DisassemblyPreferencePage_radix_decimal,
|
DisassemblyMessages.DisassemblyPreferencePage_radix_decimal,
|
||||||
|
@ -76,7 +77,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
super.createControl(parent);
|
super.createControl(parent);
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDisassemblyHelpContextIds.DISASSEMBLY_PREFERENCE_PAGE);
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDisassemblyHelpContextIds.DISASSEMBLY_PREFERENCE_PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
|
@ -100,16 +101,28 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
label = DisassemblyMessages.DisassemblyPreferencePage_showAddress;
|
label = DisassemblyMessages.DisassemblyPreferencePage_showAddress;
|
||||||
final Button showAddressCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_ADDRESS_RULER, 0);
|
final Button showAddressCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_ADDRESS_RULER, 0);
|
||||||
showAddressCB.addSelectionListener(new SelectionAdapter() {
|
showAddressCB.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
fAddressFormatCombo.setEnabled(showAddressCB.getSelection());
|
fAddressFormatCombo.setEnabled(showAddressCB.getSelection());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
showAddressCB.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showAddressTooltip);
|
showAddressCB.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showAddressTooltip);
|
||||||
label = DisassemblyMessages.DisassemblyPreferencePage_addressRadix;
|
label = DisassemblyMessages.DisassemblyPreferencePage_addressRadix;
|
||||||
fAddressFormatCombo = addComboBox(composite, label, DisassemblyPreferenceConstants.ADDRESS_RADIX, fcRadixItems);
|
fAddressFormatCombo = addComboBox(composite, label, DisassemblyPreferenceConstants.ADDRESS_RADIX, fcRadixItems);
|
||||||
fAddressFormatCombo.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_addressFormatTooltip);
|
fAddressFormatCombo.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_addressFormatTooltip);
|
||||||
|
|
||||||
|
label = DisassemblyMessages.DisassemblyPreferencePage_showCodeBytes;
|
||||||
|
final Button showCodeBytes= addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_CODE_BYTES, 0);
|
||||||
|
showCodeBytes.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
fOpcodeFormatCombo.setEnabled(showCodeBytes.getSelection());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showCodeBytes.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showCodeBytesTooltip);
|
||||||
|
label = DisassemblyMessages.DisassemblyPreferencePage_OpcodeFormat;
|
||||||
|
fOpcodeFormatCombo = addComboBox(composite, label, DisassemblyPreferenceConstants.OPCODE_RADIX, fcRadixItems);
|
||||||
|
fOpcodeFormatCombo.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_OpcodeFormatTooltip);
|
||||||
// label = DisassemblyMessages.DisassemblyPreferencePage_instructionRadix;
|
// label = DisassemblyMessages.DisassemblyPreferencePage_instructionRadix;
|
||||||
// addComboBox(composite, label, DisassemblyPreferenceConstants.INSTRUCTION_RADIX, fcRadixItems);
|
// addComboBox(composite, label, DisassemblyPreferenceConstants.INSTRUCTION_RADIX, fcRadixItems);
|
||||||
|
|
||||||
|
@ -155,7 +168,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
// data.widthHint = convertWidthInCharsToPixels(65);
|
// data.widthHint = convertWidthInCharsToPixels(65);
|
||||||
// data.heightHint = convertHeightInCharsToPixels(3);
|
// data.heightHint = convertHeightInCharsToPixels(3);
|
||||||
// msgControl.setLayoutData(data);
|
// msgControl.setLayoutData(data);
|
||||||
|
|
||||||
Dialog.applyDialogFont(parent);
|
Dialog.applyDialogFont(parent);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
@ -185,15 +198,12 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
|
|
||||||
private Combo addComboBox(Composite parent, String label, String key, String[] items) {
|
private Combo addComboBox(Composite parent, String label, String key, String[] items) {
|
||||||
Label labelControl= new Label(parent, SWT.NONE);
|
Label labelControl= new Label(parent, SWT.NONE);
|
||||||
labelControl.setText(""); //$NON-NLS-1$
|
labelControl.setText(label);
|
||||||
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||||
|
gd.horizontalIndent = 16;
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
labelControl.setLayoutData(gd);
|
labelControl.setLayoutData(gd);
|
||||||
|
|
||||||
labelControl= new Label(parent, SWT.NONE);
|
|
||||||
labelControl.setText(label);
|
|
||||||
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
|
||||||
labelControl.setLayoutData(gd);
|
|
||||||
|
|
||||||
Combo combo = new Combo(parent, SWT.READ_ONLY);
|
Combo combo = new Combo(parent, SWT.READ_ONLY);
|
||||||
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||||
combo.setLayoutData(gd);
|
combo.setLayoutData(gd);
|
||||||
|
@ -207,7 +217,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
protected Text addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
|
protected Text addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
|
||||||
return getTextControl(addLabelledTextField(composite, label, key, textLimit, indentation, isNumber));
|
return getTextControl(addLabelledTextField(composite, label, key, textLimit, indentation, isNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static Label getLabelControl(Control[] labelledTextField){
|
// private static Label getLabelControl(Control[] labelledTextField){
|
||||||
// return (Label)labelledTextField[0];
|
// return (Label)labelledTextField[0];
|
||||||
// }
|
// }
|
||||||
|
@ -228,7 +238,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||||
gd.horizontalIndent= indentation;
|
gd.horizontalIndent= indentation;
|
||||||
labelControl.setLayoutData(gd);
|
labelControl.setLayoutData(gd);
|
||||||
|
|
||||||
Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
|
Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
|
||||||
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||||
gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
|
gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
|
||||||
|
@ -239,7 +249,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
|
||||||
fNumberFields.add(textControl);
|
fNumberFields.add(textControl);
|
||||||
textControl.addModifyListener(fNumberFieldListener);
|
textControl.addModifyListener(fNumberFieldListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Control[]{labelControl, textControl};
|
return new Control[]{labelControl, textControl};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue