mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 326670 - [Disassembly View] Enhancement request for unlink and re-evaluate expression
Patch from Patrick Chuong (TI)
This commit is contained in:
parent
8e0defd439
commit
4473ddf01f
8 changed files with 194 additions and 48 deletions
|
@ -447,6 +447,7 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.views">
|
point="org.eclipse.ui.views">
|
||||||
<view
|
<view
|
||||||
|
allowMultiple="true"
|
||||||
category="org.eclipse.debug.ui"
|
category="org.eclipse.debug.ui"
|
||||||
class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyView"
|
class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyView"
|
||||||
icon="icons/disassembly.gif"
|
icon="icons/disassembly.gif"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2009 Wind River Systems and others.
|
* Copyright (c) 2007, 2010 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
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
@ -40,6 +41,8 @@ public class DisassemblyImageRegistry extends AbstractImageRegistry {
|
||||||
public static final String ICON_Copy_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dtool16"}, "copy_edit.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
public static final String ICON_Copy_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dtool16"}, "copy_edit.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
public static final String ICON_Home_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "home_nav.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
public static final String ICON_Home_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "home_nav.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
public static final String ICON_Home_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "home_nav.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
public static final String ICON_Home_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "home_nav.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
public static final String ICON_Sync_enabled = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "synced.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
public static final String ICON_Sync_disabled = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "synced.gif"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
private static DisassemblyImageRegistry INSTANCE= new DisassemblyImageRegistry(DsfUIPlugin.getDefault());
|
private static DisassemblyImageRegistry INSTANCE= new DisassemblyImageRegistry(DsfUIPlugin.getDefault());
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
@ -41,6 +42,8 @@ public final class DisassemblyMessages extends NLS {
|
||||||
public static String Disassembly_action_EnableBreakpoint_label;
|
public static String Disassembly_action_EnableBreakpoint_label;
|
||||||
public static String Disassembly_action_RefreshView_label;
|
public static String Disassembly_action_RefreshView_label;
|
||||||
public static String Disassembly_action_OpenPreferences_label;
|
public static String Disassembly_action_OpenPreferences_label;
|
||||||
|
public static String Disassembly_action_Sync_label;
|
||||||
|
public static String Disassembly_action_TrackExpression_label;
|
||||||
public static String Disassembly_GotoAddressDialog_title;
|
public static String Disassembly_GotoAddressDialog_title;
|
||||||
public static String Disassembly_GotoAddressDialog_label;
|
public static String Disassembly_GotoAddressDialog_label;
|
||||||
public static String Disassembly_GotoAddressDialog_error_invalid_address;
|
public static String Disassembly_GotoAddressDialog_error_invalid_address;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# Wind River Systems - initial API and implementation
|
# Wind River Systems - initial API and implementation
|
||||||
|
# Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
Disassembly_action_ShowAddresses_label=Show Addresses
|
Disassembly_action_ShowAddresses_label=Show Addresses
|
||||||
|
@ -23,6 +24,8 @@ Disassembly_action_DisableBreakpoint_label=Disable Breakpoint
|
||||||
Disassembly_action_EnableBreakpoint_label=Enable Breakpoint
|
Disassembly_action_EnableBreakpoint_label=Enable Breakpoint
|
||||||
Disassembly_action_RefreshView_label=Re&fresh View
|
Disassembly_action_RefreshView_label=Re&fresh View
|
||||||
Disassembly_action_OpenPreferences_label=&Preferences...
|
Disassembly_action_OpenPreferences_label=&Preferences...
|
||||||
|
Disassembly_action_Sync_label=Link with Active Debug Context
|
||||||
|
Disassembly_action_TrackExpression_label=Track Expression
|
||||||
|
|
||||||
Disassembly_GotoAddressDialog_title=Go to Address
|
Disassembly_GotoAddressDialog_title=Go to Address
|
||||||
Disassembly_GotoAddressDialog_label=Address expression:
|
Disassembly_GotoAddressDialog_label=Address expression:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
@ -22,11 +23,13 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument;
|
||||||
|
@ -202,9 +205,9 @@ 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 fActionToggleSymbols;
|
protected AbstractDisassemblyAction fActionToggleSymbols;
|
||||||
protected AbstractDisassemblyAction fActionRefreshView;
|
protected AbstractDisassemblyAction fActionRefreshView;
|
||||||
private Action fActionOpenPreferences;
|
protected Action fActionOpenPreferences;
|
||||||
private AbstractDisassemblyAction fActionToggleAddressColumn;
|
private AbstractDisassemblyAction fActionToggleAddressColumn;
|
||||||
private AbstractDisassemblyAction fActionToggleBreakpointEnablement;
|
private AbstractDisassemblyAction fActionToggleBreakpointEnablement;
|
||||||
|
|
||||||
|
@ -267,6 +270,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
private int fPCHistorySizeMax = 4;
|
private int fPCHistorySizeMax = 4;
|
||||||
private boolean fGotoFramePending;
|
private boolean fGotoFramePending;
|
||||||
|
|
||||||
|
protected Action fTrackExpressionAction;
|
||||||
|
protected Action fSyncAction;
|
||||||
|
protected boolean fSynchWithActiveDebugContext = true;
|
||||||
|
protected boolean fTrackExpression = false;
|
||||||
|
private String fPCLastLocationTxt = DisassemblyMessages.Disassembly_GotoLocation_initial_text;
|
||||||
|
private BigInteger fPCLastAddress = PC_UNKNOWN;
|
||||||
|
|
||||||
private String fPCAnnotationColorKey;
|
private String fPCAnnotationColorKey;
|
||||||
|
|
||||||
private ArrayList<Runnable> fRunnableQueue = new ArrayList<Runnable>();
|
private ArrayList<Runnable> fRunnableQueue = new ArrayList<Runnable>();
|
||||||
|
@ -315,6 +325,34 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
private AddressBarContributionItem fAddressBar = null;
|
private AddressBarContributionItem fAddressBar = null;
|
||||||
private Action fJumpToAddressAction = new JumpToAddressAction(this);
|
private Action fJumpToAddressAction = new JumpToAddressAction(this);
|
||||||
|
|
||||||
|
private final class SyncActiveDebugContextAction extends Action {
|
||||||
|
public SyncActiveDebugContextAction() {
|
||||||
|
setChecked(DisassemblyPart.this.isSyncWithActiveDebugContext());
|
||||||
|
setText(DisassemblyMessages.Disassembly_action_Sync_label);
|
||||||
|
setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Sync_enabled));
|
||||||
|
setDisabledImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Sync_disabled));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
DisassemblyPart.this.setSyncWithDebugView(this.isChecked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class TrackExpressionAction extends Action {
|
||||||
|
public TrackExpressionAction() {
|
||||||
|
setChecked(DisassemblyPart.this.isTrackExpression());
|
||||||
|
setEnabled(!fSynchWithActiveDebugContext);
|
||||||
|
setText(DisassemblyMessages.Disassembly_action_TrackExpression_label);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
DisassemblyPart.this.setTrackExpression(this.isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private final class ActionRefreshView extends AbstractDisassemblyAction {
|
private final class ActionRefreshView extends AbstractDisassemblyAction {
|
||||||
public ActionRefreshView() {
|
public ActionRefreshView() {
|
||||||
super(DisassemblyPart.this);
|
super(DisassemblyPart.this);
|
||||||
|
@ -324,6 +362,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
fPCLastAddress = getTopAddress();
|
||||||
refreshView(10);
|
refreshView(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1157,11 +1196,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
fActionToggleSymbols.update();
|
fActionToggleSymbols.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$
|
||||||
manager.add(new Separator("group.breakpoints")); //$NON-NLS-1$
|
manager.add(new Separator("group.breakpoints")); //$NON-NLS-1$
|
||||||
manager.add(new Separator(IWorkbenchActionConstants.GO_TO));
|
|
||||||
manager.add(new Separator("group.debug")); //$NON-NLS-1$
|
manager.add(new Separator("group.debug")); //$NON-NLS-1$
|
||||||
manager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
|
manager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
|
||||||
manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
|
manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
|
||||||
manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
|
manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
|
||||||
|
// TODO add only if this is an editor
|
||||||
manager.add(new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
|
manager.add(new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
|
||||||
manager.add(fActionToggleSource);
|
manager.add(fActionToggleSource);
|
||||||
manager.add(fActionToggleSymbols);
|
manager.add(fActionToggleSymbols);
|
||||||
|
@ -1206,7 +1245,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
manager.add(new Separator());
|
manager.add(new Separator());
|
||||||
manager.add(fActionRefreshView);
|
manager.add(fActionRefreshView);
|
||||||
manager.add(fActionGotoPC);
|
manager.add(fActionGotoPC);
|
||||||
|
manager.add(fSyncAction);
|
||||||
manager.add(fActionToggleSource);
|
manager.add(fActionToggleSource);
|
||||||
|
// Other plug-ins can contribute their actions here
|
||||||
|
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateSelectionDependentActions() {
|
protected void updateSelectionDependentActions() {
|
||||||
|
@ -1286,6 +1328,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
fActionToggleFunctionColumn = new ActionToggleFunctionColumn();
|
fActionToggleFunctionColumn = new ActionToggleFunctionColumn();
|
||||||
fActionToggleSymbols = new ActionToggleSymbols();
|
fActionToggleSymbols = new ActionToggleSymbols();
|
||||||
fActionRefreshView = new ActionRefreshView();
|
fActionRefreshView = new ActionRefreshView();
|
||||||
|
fSyncAction = new SyncActiveDebugContextAction();
|
||||||
|
fTrackExpressionAction = new TrackExpressionAction();
|
||||||
fStateDependentActions.add(fActionRefreshView);
|
fStateDependentActions.add(fActionRefreshView);
|
||||||
fGlobalActions.put(ActionFactory.REFRESH.getId(), fActionRefreshView);
|
fGlobalActions.put(ActionFactory.REFRESH.getId(), fActionRefreshView);
|
||||||
fActionOpenPreferences = new ActionOpenPreferences(getSite().getShell());
|
fActionOpenPreferences = new ActionOpenPreferences(getSite().getShell());
|
||||||
|
@ -1309,7 +1353,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
*/
|
*/
|
||||||
public final void gotoProgramCounter() {
|
public final void gotoProgramCounter() {
|
||||||
if (fPCAddress != PC_RUNNING) {
|
if (fPCAddress != PC_RUNNING) {
|
||||||
updatePC(fPCAddress);
|
fPCLastAddress = PC_UNKNOWN;
|
||||||
|
gotoFrame(getActiveStackFrame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1322,6 +1367,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void gotoLocationByUser(BigInteger address, String locationTxt) {
|
||||||
|
fPCLastAddress = address;
|
||||||
|
fPCLastLocationTxt = locationTxt;
|
||||||
|
gotoAddress(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void gotoActiveFrameByUser() {
|
||||||
|
gotoFrame(getActiveStackFrame());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoAddress(java.math.BigInteger)
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoAddress(java.math.BigInteger)
|
||||||
*/
|
*/
|
||||||
|
@ -2043,6 +2098,24 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
public void gotoFrame(int frame, BigInteger address) {
|
public void gotoFrame(int frame, BigInteger address) {
|
||||||
assert isGuiThread();
|
assert isGuiThread();
|
||||||
if (DEBUG) System.out.println("gotoFrame " + frame + " " + getAddressText(address)); //$NON-NLS-1$ //$NON-NLS-2$
|
if (DEBUG) System.out.println("gotoFrame " + frame + " " + getAddressText(address)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
// cache the last PC address
|
||||||
|
if (!isSyncWithActiveDebugContext()) {
|
||||||
|
if (isTrackExpression()) {
|
||||||
|
if (!DisassemblyMessages.Disassembly_GotoLocation_initial_text.equals(fPCLastLocationTxt))
|
||||||
|
fPCLastAddress = eval(fPCLastLocationTxt);
|
||||||
|
}
|
||||||
|
if (fPCLastAddress != PC_UNKNOWN) {
|
||||||
|
address = fPCLastAddress;
|
||||||
|
} else if (address != PC_UNKNOWN) {
|
||||||
|
fPCLastAddress = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
frame = -2; // clear the annotation
|
||||||
|
} else {
|
||||||
|
fPCLastAddress = address;
|
||||||
|
}
|
||||||
|
|
||||||
if (fGotoAddressPending == fFrameAddress) {
|
if (fGotoAddressPending == fFrameAddress) {
|
||||||
// cancel goto address from previous goto frame
|
// cancel goto address from previous goto frame
|
||||||
fGotoAddressPending = PC_UNKNOWN;
|
fGotoAddressPending = PC_UNKNOWN;
|
||||||
|
@ -2279,12 +2352,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
fPCAnnotationUpdatePending = true;
|
fPCAnnotationUpdatePending = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AddressRangePosition pos;
|
AddressRangePosition pos = null;
|
||||||
if (fTargetFrame == 0) {
|
if (fTargetFrame == 0) {
|
||||||
// clear secondary
|
// clear secondary
|
||||||
updateAddressAnnotation(fSecondaryPCAnnotation, PC_UNKNOWN);
|
updateAddressAnnotation(fSecondaryPCAnnotation, PC_UNKNOWN);
|
||||||
// set primary
|
// set primary
|
||||||
pos = updateAddressAnnotation(fPCAnnotation, fPCAddress);
|
pos = updateAddressAnnotation(fPCAnnotation, fPCAddress);
|
||||||
|
} else if (fTargetFrame < 0) {
|
||||||
|
// clear both
|
||||||
|
updateAddressAnnotation(fPCAnnotation, PC_UNKNOWN);
|
||||||
|
updateAddressAnnotation(fSecondaryPCAnnotation, PC_UNKNOWN);
|
||||||
} else {
|
} else {
|
||||||
// clear primary
|
// clear primary
|
||||||
updateAddressAnnotation(fPCAnnotation, PC_UNKNOWN);
|
updateAddressAnnotation(fPCAnnotation, PC_UNKNOWN);
|
||||||
|
@ -2805,7 +2882,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
debugContextChanged();
|
debugContextChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -2865,6 +2941,51 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigInteger eval(String expr) {
|
||||||
|
String location = evaluateExpression(expr);
|
||||||
|
if (location != null) {
|
||||||
|
StringTokenizer st = new StringTokenizer(location);
|
||||||
|
if (st.hasMoreTokens()) {
|
||||||
|
try {
|
||||||
|
return DisassemblyUtils.decodeAddress(st.nextToken());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logWarning("Failed to evaluate expression " + expr, e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PC_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isTrackExpression() {
|
||||||
|
return fTrackExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTrackExpression(boolean track) {
|
||||||
|
fTrackExpression = track;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isSyncWithActiveDebugContext() {
|
||||||
|
return fSynchWithActiveDebugContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSyncWithDebugView(boolean sync) {
|
||||||
|
fSynchWithActiveDebugContext = sync;
|
||||||
|
fTrackExpressionAction.setEnabled(!sync);
|
||||||
|
|
||||||
|
if (sync) {
|
||||||
|
gotoActiveFrameByUser();
|
||||||
|
} else {
|
||||||
|
// redraw
|
||||||
|
while (!fPCHistory.isEmpty()) {
|
||||||
|
AddressRangePosition pos = fPCHistory.removeFirst();
|
||||||
|
fViewer.invalidateTextPresentation(pos.offset, pos.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
fTargetFrame = -2; // clear the annotation
|
||||||
|
updatePCAnnotation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Most methods in IDisassemblyPartCallback require execution on the GUI thread.
|
* Most methods in IDisassemblyPartCallback require execution on the GUI thread.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||||
|
@ -19,8 +21,10 @@ import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IMemento;
|
import org.eclipse.ui.IMemento;
|
||||||
import org.eclipse.ui.IViewPart;
|
import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IViewSite;
|
import org.eclipse.ui.IViewSite;
|
||||||
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
import org.eclipse.ui.actions.ActionFactory;
|
import org.eclipse.ui.actions.ActionFactory;
|
||||||
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DisassemblyView
|
* DisassemblyView
|
||||||
|
@ -60,6 +64,15 @@ public class DisassemblyView extends DisassemblyPart implements IViewPart {
|
||||||
*/
|
*/
|
||||||
public void init(IViewSite site, IMemento memento) throws PartInitException {
|
public void init(IViewSite site, IMemento memento) throws PartInitException {
|
||||||
setSite(site);
|
setSite(site);
|
||||||
|
if (memento != null) {
|
||||||
|
Boolean trackExpression = memento.getBoolean(DisassemblyPreferenceConstants.TRACK_EXPRESSION);
|
||||||
|
if (trackExpression != null)
|
||||||
|
fTrackExpression = trackExpression;
|
||||||
|
Boolean syncContext = memento.getBoolean(DisassemblyPreferenceConstants.SYNC_ACTIVE_CONTEXT);
|
||||||
|
if (syncContext != null)
|
||||||
|
fSynchWithActiveDebugContext = syncContext;
|
||||||
|
}
|
||||||
|
|
||||||
DebugUITools.getDebugContextManager().addDebugContextListener(fDebugContextListener = new IDebugContextListener() {
|
DebugUITools.getDebugContextManager().addDebugContextListener(fDebugContextListener = new IDebugContextListener() {
|
||||||
public void debugContextChanged(DebugContextEvent event) {
|
public void debugContextChanged(DebugContextEvent event) {
|
||||||
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
|
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
|
||||||
|
@ -73,6 +86,8 @@ public class DisassemblyView extends DisassemblyPart implements IViewPart {
|
||||||
* @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
|
* @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
|
||||||
*/
|
*/
|
||||||
public void saveState(IMemento memento) {
|
public void saveState(IMemento memento) {
|
||||||
|
memento.putBoolean(DisassemblyPreferenceConstants.TRACK_EXPRESSION, isTrackExpression());
|
||||||
|
memento.putBoolean(DisassemblyPreferenceConstants.SYNC_ACTIVE_CONTEXT, isSyncWithActiveDebugContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,10 +99,18 @@ public class DisassemblyView extends DisassemblyPart implements IViewPart {
|
||||||
|
|
||||||
protected void fillLocalPullDown(IMenuManager manager) {
|
protected void fillLocalPullDown(IMenuManager manager) {
|
||||||
manager.add(fGlobalActions.get(ActionFactory.FIND.getId()));
|
manager.add(fGlobalActions.get(ActionFactory.FIND.getId()));
|
||||||
|
manager.add(new Separator("group.goto")); // ICommonMenuConstants.GROUP_GOTO //$NON-NLS-1$
|
||||||
manager.add(fActionGotoPC);
|
manager.add(fActionGotoPC);
|
||||||
manager.add(fActionGotoAddress);
|
manager.add(fActionGotoAddress);
|
||||||
|
manager.add(new Separator("group.show")); // ICommonMenuConstants.GROUP_SHOW //$NON-NLS-1$
|
||||||
|
manager.add(fSyncAction);
|
||||||
|
manager.add(fTrackExpressionAction);
|
||||||
|
manager.add(new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
|
||||||
manager.add(fActionToggleSource);
|
manager.add(fActionToggleSource);
|
||||||
manager.add(new Separator());
|
manager.add(fActionToggleSymbols);
|
||||||
|
manager.add(fActionOpenPreferences);
|
||||||
|
// Other plug-ins can contribute their actions here
|
||||||
|
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Texas Instruments[nmehregani] - initial API and implementation
|
* Texas Instruments[nmehregani] - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||||
|
@ -16,7 +17,6 @@ import java.math.BigInteger;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyMessages;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyMessages;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart;
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import static org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils.decodeAddress;
|
|
||||||
|
|
||||||
public class JumpToAddressAction extends Action {
|
public class JumpToAddressAction extends Action {
|
||||||
|
|
||||||
|
@ -30,35 +30,25 @@ public class JumpToAddressAction extends Action {
|
||||||
public void run() {
|
public void run() {
|
||||||
AddressBarContributionItem addressBar = fDisassemblyPart.getAddressBar();
|
AddressBarContributionItem addressBar = fDisassemblyPart.getAddressBar();
|
||||||
if (addressBar!=null && addressBar.isEnabled() && fDisassemblyPart.isSuspended()) {
|
if (addressBar!=null && addressBar.isEnabled() && fDisassemblyPart.isSuspended()) {
|
||||||
String location = addressBar.getText();
|
String locationTxt = addressBar.getText();
|
||||||
|
|
||||||
if (location==null || location.trim().length()==0)
|
if (locationTxt==null || locationTxt.trim().length()==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
location = location.trim();
|
locationTxt = locationTxt.trim();
|
||||||
BigInteger address = null;
|
|
||||||
try {
|
if (locationTxt.equals(DisassemblyMessages.Disassembly_GotoLocation_initial_text)) {
|
||||||
address = decodeAddress(location);
|
fDisassemblyPart.gotoActiveFrameByUser();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigInteger address = fDisassemblyPart.eval(locationTxt);
|
||||||
if (address.compareTo(BigInteger.ZERO) < 0) {
|
if (address.compareTo(BigInteger.ZERO) < 0) {
|
||||||
address = null;
|
|
||||||
addressBar.setWarningIconVisible(true);
|
addressBar.setWarningIconVisible(true);
|
||||||
fDisassemblyPart.generateErrorDialog(DisassemblyMessages.Disassembly_GotoAddressDialog_error_invalid_address);
|
fDisassemblyPart.generateErrorDialog(DisassemblyMessages.Disassembly_GotoAddressDialog_error_invalid_address);
|
||||||
return;
|
} else {
|
||||||
}
|
fDisassemblyPart.gotoLocationByUser(address, locationTxt);
|
||||||
} catch (NumberFormatException x) {
|
|
||||||
// This will be handled below. location will be treated as a symbol
|
|
||||||
}
|
|
||||||
|
|
||||||
// hide warning icon if it was shown before
|
|
||||||
addressBar.setWarningIconVisible(false);
|
addressBar.setWarningIconVisible(false);
|
||||||
|
|
||||||
/* Location is an address */
|
|
||||||
if (address!=null) {
|
|
||||||
fDisassemblyPart.gotoAddress(address);
|
|
||||||
}
|
|
||||||
/* Location is a symbol */
|
|
||||||
else {
|
|
||||||
fDisassemblyPart.gotoSymbol(location);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ public class DisassemblyPreferenceConstants {
|
||||||
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 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 SYNC_ACTIVE_CONTEXT = "disassembly.syncActiveContext"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue