mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
[302348] [dis] Expression support: merge goto symbol and got address
This commit is contained in:
parent
730d211888
commit
ae828d8792
7 changed files with 22 additions and 109 deletions
|
@ -439,11 +439,6 @@
|
||||||
description="%command.gotoAddress.description"
|
description="%command.gotoAddress.description"
|
||||||
id="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoAddress"
|
id="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoAddress"
|
||||||
name="%command.gotoAddress.name"/>
|
name="%command.gotoAddress.name"/>
|
||||||
<command
|
|
||||||
categoryId="org.eclipse.debug.ui.category.run"
|
|
||||||
description="%command.gotoSymbol.description"
|
|
||||||
id="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoSymbol"
|
|
||||||
name="%command.gotoSymbol.name"/>
|
|
||||||
<command
|
<command
|
||||||
categoryId="org.eclipse.debug.ui.category.run"
|
categoryId="org.eclipse.debug.ui.category.run"
|
||||||
defaultHandler="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.RulerToggleBreakpointHandler"
|
defaultHandler="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.RulerToggleBreakpointHandler"
|
||||||
|
@ -462,10 +457,6 @@
|
||||||
contextId="org.eclipse.cdt.dsf.debug.ui.disassembly.context"
|
contextId="org.eclipse.cdt.dsf.debug.ui.disassembly.context"
|
||||||
commandId="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoAddress"
|
commandId="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoAddress"
|
||||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
|
||||||
<key sequence="M1+M2+G"
|
|
||||||
contextId="org.eclipse.cdt.dsf.debug.ui.disassembly.context"
|
|
||||||
commandId="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoSymbol"
|
|
||||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -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
|
||||||
|
@ -46,7 +46,6 @@ public class DisassemblyEditor extends DisassemblyPart implements IEditorPart {
|
||||||
super.fillContextMenu(manager);
|
super.fillContextMenu(manager);
|
||||||
manager.appendToGroup(IWorkbenchActionConstants.GO_TO, fActionGotoPC);
|
manager.appendToGroup(IWorkbenchActionConstants.GO_TO, fActionGotoPC);
|
||||||
manager.appendToGroup(IWorkbenchActionConstants.GO_TO, fActionGotoAddress);
|
manager.appendToGroup(IWorkbenchActionConstants.GO_TO, fActionGotoAddress);
|
||||||
manager.appendToGroup(IWorkbenchActionConstants.GO_TO, fActionGotoSymbol);
|
|
||||||
manager.appendToGroup("group.bottom", fActionRefreshView); //$NON-NLS-1$
|
manager.appendToGroup("group.bottom", fActionRefreshView); //$NON-NLS-1$
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,6 @@ public final class DisassemblyMessages extends NLS {
|
||||||
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;
|
||||||
public static String Disassembly_GotoAddressDialog_error_not_a_number;
|
public static String Disassembly_GotoAddressDialog_error_not_a_number;
|
||||||
public static String Disassembly_GotoSymbolDialog_title;
|
|
||||||
public static String Disassembly_GotoSymbolDialog_label;
|
|
||||||
public static String Disassembly_message_notConnected;
|
public static String Disassembly_message_notConnected;
|
||||||
public static String Disassembly_log_error_retrieveFrameAddress;
|
public static String Disassembly_log_error_retrieveFrameAddress;
|
||||||
public static String Disassembly_log_error_locateFile;
|
public static String Disassembly_log_error_locateFile;
|
||||||
|
|
|
@ -39,9 +39,8 @@ Disassembly_action_RefreshView_label=Re&fresh View
|
||||||
Disassembly_action_OpenPreferences_label=&Preferences...
|
Disassembly_action_OpenPreferences_label=&Preferences...
|
||||||
|
|
||||||
Disassembly_GotoAddressDialog_title=Go to Address
|
Disassembly_GotoAddressDialog_title=Go to Address
|
||||||
Disassembly_GotoAddressDialog_label=Address:
|
Disassembly_GotoAddressDialog_label=Address expression:
|
||||||
Disassembly_GotoAddressDialog_error_invalid_address=Invalid address
|
Disassembly_GotoAddressDialog_error_invalid_address=Invalid address
|
||||||
Disassembly_GotoAddressDialog_error_not_a_number=Not a valid number format
|
|
||||||
|
|
||||||
Disassembly_GotoSymbolDialog_title=Go to Symbol
|
Disassembly_GotoSymbolDialog_title=Go to Symbol
|
||||||
Disassembly_GotoSymbolDialog_label=Symbol:
|
Disassembly_GotoSymbolDialog_label=Symbol:
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoAddress;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoAddress;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoProgramCounter;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoProgramCounter;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoSymbol;
|
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionOpenPreferences;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionOpenPreferences;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AddressBarContributionItem;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AddressBarContributionItem;
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.JumpToAddressAction;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.JumpToAddressAction;
|
||||||
|
@ -190,7 +189,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
|
|
||||||
private static final String COMMAND_ID_GOTO_ADDRESS = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoAddress"; //$NON-NLS-1$
|
private static final String COMMAND_ID_GOTO_ADDRESS = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoAddress"; //$NON-NLS-1$
|
||||||
private static final String COMMAND_ID_GOTO_PC = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoPC"; //$NON-NLS-1$
|
private static final String COMMAND_ID_GOTO_PC = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoPC"; //$NON-NLS-1$
|
||||||
private static final String COMMAND_ID_GOTO_SYMBOL = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoSymbol"; //$NON-NLS-1$
|
|
||||||
private static final String COMMAND_ID_TOGGLE_BREAKPOINT = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.rulerToggleBreakpoint"; //$NON-NLS-1$
|
private static final String COMMAND_ID_TOGGLE_BREAKPOINT = "org.eclipse.cdt.dsf.debug.ui.disassembly.commands.rulerToggleBreakpoint"; //$NON-NLS-1$
|
||||||
// private static final String COMMAND_ID_RUN_TO_LINE = "org.eclipse.debug.ui.commands.RunToLine"; //$NON-NLS-1$
|
// private static final String COMMAND_ID_RUN_TO_LINE = "org.eclipse.debug.ui.commands.RunToLine"; //$NON-NLS-1$
|
||||||
// private static final String COMMAND_ID_TOGGLE_STEPPING_MODE = "org.eclipse.cdt.dsf.debug.ui.debug.ui.menu.showDisassemblyAction"; //$NON-NLS-1$
|
// private static final String COMMAND_ID_TOGGLE_STEPPING_MODE = "org.eclipse.cdt.dsf.debug.ui.debug.ui.menu.showDisassemblyAction"; //$NON-NLS-1$
|
||||||
|
@ -201,7 +199,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
|
|
||||||
protected AbstractDisassemblyAction fActionGotoPC;
|
protected AbstractDisassemblyAction fActionGotoPC;
|
||||||
protected AbstractDisassemblyAction fActionGotoAddress;
|
protected AbstractDisassemblyAction fActionGotoAddress;
|
||||||
protected AbstractDisassemblyAction fActionGotoSymbol;
|
|
||||||
protected AbstractDisassemblyAction fActionToggleSource;
|
protected AbstractDisassemblyAction fActionToggleSource;
|
||||||
private AbstractDisassemblyAction fActionToggleFunctionColumn;
|
private AbstractDisassemblyAction fActionToggleFunctionColumn;
|
||||||
private AbstractDisassemblyAction fActionToggleSymbols;
|
private AbstractDisassemblyAction fActionToggleSymbols;
|
||||||
|
@ -1289,11 +1286,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
fStateDependentActions.add(fActionGotoAddress);
|
fStateDependentActions.add(fActionGotoAddress);
|
||||||
registerWithHandlerService(fActionGotoAddress);
|
registerWithHandlerService(fActionGotoAddress);
|
||||||
|
|
||||||
fActionGotoSymbol = new ActionGotoSymbol(this);
|
|
||||||
fActionGotoSymbol.setActionDefinitionId(COMMAND_ID_GOTO_SYMBOL);
|
|
||||||
fStateDependentActions.add(fActionGotoSymbol);
|
|
||||||
registerWithHandlerService(fActionGotoSymbol);
|
|
||||||
|
|
||||||
fActionToggleSource = new ActionToggleSource();
|
fActionToggleSource = new ActionToggleSource();
|
||||||
fStateDependentActions.add(fActionToggleSource);
|
fStateDependentActions.add(fActionToggleSource);
|
||||||
fActionToggleSource.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(DsfUIPlugin.PLUGIN_ID, "icons/source.gif")); //$NON-NLS-1$
|
fActionToggleSource.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(DsfUIPlugin.PLUGIN_ID, "icons/source.gif")); //$NON-NLS-1$
|
||||||
|
|
|
@ -10,19 +10,19 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||||
|
|
||||||
import static org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils.decodeAddress;
|
|
||||||
|
|
||||||
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.provisional.IDisassemblyPart;
|
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
|
import org.eclipse.cdt.internal.ui.text.CWordFinder;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.dialogs.IInputValidator;
|
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
import org.eclipse.jface.dialogs.InputDialog;
|
||||||
import org.eclipse.jface.text.ITextSelection;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
import org.eclipse.jface.text.IRegion;
|
||||||
|
import org.eclipse.jface.text.ITextViewer;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public final class ActionGotoAddress extends AbstractDisassemblyAction {
|
public final class ActionGotoAddress extends AbstractDisassemblyAction {
|
||||||
public ActionGotoAddress(IDisassemblyPart disassemblyPart) {
|
public ActionGotoAddress(IDisassemblyPart disassemblyPart) {
|
||||||
super(disassemblyPart);
|
super(disassemblyPart);
|
||||||
|
@ -30,37 +30,31 @@ public final class ActionGotoAddress extends AbstractDisassemblyAction {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IInputValidator validator = new IInputValidator() {
|
ITextViewer viewer = getDisassemblyPart().getTextViewer();
|
||||||
public String isValid(String input) {
|
IDocument document= viewer.getDocument();
|
||||||
if (input == null || input.length() == 0)
|
IRegion wordRegion = CWordFinder.findWord(document, viewer.getSelectedRange().x);
|
||||||
return " "; //$NON-NLS-1$
|
String defaultValue = null;
|
||||||
|
if (wordRegion != null) {
|
||||||
try {
|
try {
|
||||||
BigInteger address= decodeAddress(input);
|
defaultValue = document.get(wordRegion.getOffset(), wordRegion.getLength());
|
||||||
if (address.compareTo(BigInteger.ZERO) < 0) {
|
} catch (BadLocationException e) {
|
||||||
return DisassemblyMessages.Disassembly_GotoAddressDialog_error_invalid_address;
|
// safely ignored
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException x) {
|
|
||||||
return DisassemblyMessages.Disassembly_GotoAddressDialog_error_not_a_number; //;
|
|
||||||
}
|
}
|
||||||
return null;
|
if (defaultValue == null) {
|
||||||
}
|
|
||||||
};
|
|
||||||
String defaultValue = ((ITextSelection)getDisassemblyPart().getSite().getSelectionProvider().getSelection()).getText();
|
|
||||||
if (validator.isValid(defaultValue) != null) {
|
|
||||||
defaultValue = DsfUIPlugin.getDefault().getDialogSettings().get("gotoAddress"); //$NON-NLS-1$
|
defaultValue = DsfUIPlugin.getDefault().getDialogSettings().get("gotoAddress"); //$NON-NLS-1$
|
||||||
if (validator.isValid(defaultValue) != null) {
|
if (defaultValue == null) {
|
||||||
defaultValue = ""; //$NON-NLS-1$
|
defaultValue = ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String dlgTitle = DisassemblyMessages.Disassembly_GotoAddressDialog_title;
|
String dlgTitle = DisassemblyMessages.Disassembly_GotoAddressDialog_title;
|
||||||
String dlgLabel = DisassemblyMessages.Disassembly_GotoAddressDialog_label;
|
String dlgLabel = DisassemblyMessages.Disassembly_GotoAddressDialog_label;
|
||||||
final Shell shell= getDisassemblyPart().getSite().getShell();
|
final Shell shell= getDisassemblyPart().getSite().getShell();
|
||||||
InputDialog dlg = new InputDialog(shell, dlgTitle, dlgLabel, defaultValue, validator);
|
InputDialog dlg = new InputDialog(shell, dlgTitle, dlgLabel, defaultValue, null);
|
||||||
if (dlg.open() == IDialogConstants.OK_ID) {
|
if (dlg.open() == IDialogConstants.OK_ID) {
|
||||||
String value = dlg.getValue();
|
String value = dlg.getValue();
|
||||||
BigInteger address= decodeAddress(value);
|
|
||||||
DsfUIPlugin.getDefault().getDialogSettings().put("gotoAddress", value); //$NON-NLS-1$
|
DsfUIPlugin.getDefault().getDialogSettings().put("gotoAddress", value); //$NON-NLS-1$
|
||||||
getDisassemblyPart().gotoAddress(address);
|
getDisassemblyPart().gotoSymbol(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Wind River Systems - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyMessages;
|
|
||||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
|
||||||
import org.eclipse.cdt.internal.ui.text.CWordFinder;
|
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
|
||||||
import org.eclipse.jface.text.IDocument;
|
|
||||||
import org.eclipse.jface.text.IRegion;
|
|
||||||
import org.eclipse.jface.text.ITextViewer;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public final class ActionGotoSymbol extends AbstractDisassemblyAction {
|
|
||||||
public ActionGotoSymbol(IDisassemblyPart disassemblyPart) {
|
|
||||||
super(disassemblyPart);
|
|
||||||
setText(DisassemblyMessages.Disassembly_action_GotoSymbol_label);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ITextViewer viewer = getDisassemblyPart().getTextViewer();
|
|
||||||
IDocument document= viewer.getDocument();
|
|
||||||
IRegion wordRegion = CWordFinder.findWord(document, viewer.getSelectedRange().x);
|
|
||||||
String defaultValue = null;
|
|
||||||
if (wordRegion != null) {
|
|
||||||
try {
|
|
||||||
defaultValue = document.get(wordRegion.getOffset(), wordRegion.getLength());
|
|
||||||
} catch (BadLocationException e) {
|
|
||||||
// safely ignored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (defaultValue == null) {
|
|
||||||
defaultValue = DsfUIPlugin.getDefault().getDialogSettings().get("gotoSymbol"); //$NON-NLS-1$
|
|
||||||
if (defaultValue == null) {
|
|
||||||
defaultValue = ""; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String dlgTitle = DisassemblyMessages.Disassembly_GotoSymbolDialog_title;
|
|
||||||
String dlgLabel = DisassemblyMessages.Disassembly_GotoSymbolDialog_label;
|
|
||||||
final Shell shell= getDisassemblyPart().getSite().getShell();
|
|
||||||
InputDialog dlg = new InputDialog(shell, dlgTitle, dlgLabel, defaultValue, null);
|
|
||||||
if (dlg.open() == IDialogConstants.OK_ID) {
|
|
||||||
String value = dlg.getValue();
|
|
||||||
DsfUIPlugin.getDefault().getDialogSettings().put("gotoSymbol", value); //$NON-NLS-1$
|
|
||||||
getDisassemblyPart().gotoSymbol(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue