mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
[285225] [disassembly view] DSF Disassembly view does not respect selected breakpoint type
This commit is contained in:
parent
1b7d9e2dda
commit
8c5477d2d0
25 changed files with 758 additions and 170 deletions
|
@ -19,7 +19,10 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.ui.ide,
|
||||
org.eclipse.core.variables,
|
||||
org.eclipse.core.expressions,
|
||||
org.eclipse.ui.console
|
||||
org.eclipse.ui.console,
|
||||
org.eclipse.jface.text;bundle-version="3.4.0",
|
||||
org.eclipse.ui.editors;bundle-version="3.4.0",
|
||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Export-Package: org.eclipse.cdt.dsf.gdb.internal.ui.actions;x-internal:=true,
|
||||
|
|
|
@ -186,7 +186,16 @@
|
|||
name="Filter">
|
||||
<filter name="debugModelId" value="org.eclipse.cdt.dsf.gdb"/>
|
||||
<enabledWhen>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
|
||||
<and>
|
||||
<adapt
|
||||
type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||
</adapt>
|
||||
<not>
|
||||
<adapt
|
||||
type="org.eclipse.cdt.debug.core.model.ICTracepoint">
|
||||
</adapt>
|
||||
</not>
|
||||
</and>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
</extension>
|
||||
|
@ -703,5 +712,16 @@
|
|||
class="org.eclipse.cdt.dsf.gdb.internal.ui.preferences.GdbPreferenceInitializer">
|
||||
</initializer>
|
||||
</extension>
|
||||
|
||||
|
||||
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
|
||||
<toggleTargetFactory
|
||||
id="org.eclipse.cdt.dsf.gdb.ui.ToggleBreakpointsTargetFactory"
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.ToggleBreakpointsTargetFactory">
|
||||
<enablement>
|
||||
<!-- Enable the breakpoint toggle for DSF Disassembly -->
|
||||
<instanceof value="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart"/>
|
||||
</enablement>
|
||||
</toggleTargetFactory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.gdb.internal.ui.breakpoints;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
|
||||
import org.eclipse.cdt.utils.Addr64;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||
|
||||
/**
|
||||
* Toggle breakpoint target implementation for the disassembly part.
|
||||
*/
|
||||
public class DisassemblyToggleBreakpointsTarget implements IToggleBreakpointsTargetExtension {
|
||||
|
||||
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
assert part instanceof IDisassemblyPart && selection instanceof ITextSelection;
|
||||
|
||||
if (!(selection instanceof IDisassemblySelection)) {
|
||||
selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
|
||||
}
|
||||
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
|
||||
int line = disassemblySelection.getStartLine();
|
||||
IBreakpoint[] bp = getBreakpointsAtLine((IDisassemblyPart) part, line);
|
||||
if (bp == null || bp.length == 0) {
|
||||
insertBreakpoint(disassemblySelection);
|
||||
} else {
|
||||
for (int i = 0; i < bp.length; i++) {
|
||||
bp[i].delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return part instanceof IDisassemblyPart && selection instanceof ITextSelection;
|
||||
}
|
||||
|
||||
public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
}
|
||||
|
||||
public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
}
|
||||
|
||||
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return canToggleLineBreakpoints(part, selection);
|
||||
}
|
||||
/*
|
||||
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
toggleLineBreakpoints(part, selection);
|
||||
}
|
||||
|
||||
private IBreakpoint[] getBreakpointsAtLine(IDisassemblyPart part, int line) {
|
||||
List<IBreakpoint> breakpoints = new ArrayList<IBreakpoint>();
|
||||
IAnnotationModel annotationModel = part.getTextViewer().getAnnotationModel();
|
||||
IDocument document = part.getTextViewer().getDocument();
|
||||
if (annotationModel != null) {
|
||||
Iterator<?> iterator = annotationModel.getAnnotationIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object object = iterator.next();
|
||||
if (object instanceof SimpleMarkerAnnotation) {
|
||||
SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
|
||||
IMarker marker = markerAnnotation.getMarker();
|
||||
try {
|
||||
if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
|
||||
Position position = annotationModel.getPosition(markerAnnotation);
|
||||
int bpLine = document.getLineOfOffset(position.getOffset());
|
||||
if (line == bpLine) {
|
||||
IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
|
||||
if (breakpoint != null) {
|
||||
breakpoints.add(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
} catch (BadLocationException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IBreakpoint[] breakpointsArray = new IBreakpoint[breakpoints.size()];
|
||||
return breakpoints.toArray(breakpointsArray );
|
||||
}
|
||||
private void insertBreakpoint(IDisassemblySelection selection) throws CoreException {
|
||||
BigInteger address = selection.getStartAddress();
|
||||
if (address == null) {
|
||||
return;
|
||||
}
|
||||
URI fileUri = selection.getSourceLocationURI();
|
||||
if (fileUri != null) {
|
||||
String filePath = null;
|
||||
IResource resource = selection.getSourceFile();
|
||||
if (resource != null) {
|
||||
final IPath location= resource.getLocation();
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
filePath = location.toOSString();
|
||||
} else {
|
||||
resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||
filePath = URIUtil.toPath(fileUri).toOSString();
|
||||
}
|
||||
int srcLine = selection.getSourceLine();
|
||||
CDIDebugModel.createLineBreakpoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$
|
||||
} else {
|
||||
IResource resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||
CDIDebugModel.createAddressBreakpoint(null, null, resource, ICBreakpointType.REGULAR, new Addr64(address), true, 0, "", true); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.gdb.internal.ui.breakpoints;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class Messages extends NLS {
|
||||
private static final String BUNDLE_NAME= "org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.messages"; //$NON-NLS-1$
|
||||
|
||||
public static String ToggleBreakpointsTargetFactory_description;
|
||||
public static String ToggleBreakpointsTargetFactory_name;
|
||||
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
}
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.gdb.internal.ui.breakpoints;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Toggle breakpoints target factory for disassembly parts.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetFactory {
|
||||
|
||||
/**
|
||||
* Toggle breakpoint target-id for normal C breakpoints.
|
||||
* Note: The id must be the same as in <code>ToggleCBreakpointsTargetFactory</code>
|
||||
*/
|
||||
public static final String TOGGLE_C_BREAKPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCBreakpointTarget"; //$NON-NLS-1$
|
||||
// public static final String TOGGLE_C_TRACEPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCTracepointTarget"; //$NON-NLS-1$
|
||||
|
||||
private static final Set<String> TOGGLE_TARGET_IDS = new HashSet<String>(2);
|
||||
static {
|
||||
TOGGLE_TARGET_IDS.add(TOGGLE_C_BREAKPOINT_TARGET_ID);
|
||||
// TOGGLE_TARGET_IDS.add(TOGGLE_C_TRACEPOINT_TARGET_ID);
|
||||
}
|
||||
|
||||
private static final IToggleBreakpointsTarget fgDisassemblyToggleBreakpointsTarget = new DisassemblyToggleBreakpointsTarget();
|
||||
|
||||
public ToggleBreakpointsTargetFactory() {
|
||||
}
|
||||
|
||||
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
|
||||
if (TOGGLE_C_BREAKPOINT_TARGET_ID.equals(targetID)) {
|
||||
return fgDisassemblyToggleBreakpointsTarget;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
|
||||
if (part instanceof IDisassemblyPart) {
|
||||
return TOGGLE_C_BREAKPOINT_TARGET_ID;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getToggleTargetDescription(String targetID) {
|
||||
return Messages.ToggleBreakpointsTargetFactory_description;
|
||||
}
|
||||
|
||||
public String getToggleTargetName(String targetID) {
|
||||
return Messages.ToggleBreakpointsTargetFactory_name;
|
||||
}
|
||||
|
||||
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||
return TOGGLE_TARGET_IDS;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2009 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
|
||||
###############################################################################
|
||||
|
||||
ToggleBreakpointsTargetFactory_description=Standard C/C++ Breakpoint Type
|
||||
ToggleBreakpointsTargetFactory_name=C/C++ Breakpoint
|
|
@ -15,13 +15,13 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.5.0",
|
|||
org.eclipse.cdt.debug.ui;bundle-version="6.0.0",
|
||||
org.eclipse.jface.text;bundle-version="3.4.0",
|
||||
org.eclipse.ui.editors;bundle-version="3.4.0",
|
||||
org.eclipse.ui.workbench.texteditor;bundle-version="3.4.0",
|
||||
org.eclipse.ui.ide;bundle-version="3.5.0",
|
||||
org.eclipse.cdt.ui;bundle-version="5.1.0",
|
||||
org.eclipse.core.expressions;bundle-version="3.4.0",
|
||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.update.provisional;x-internal:=true,
|
||||
Export-Package: org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional,
|
||||
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.update.provisional;x-internal:=true,
|
||||
org.eclipse.cdt.dsf.debug.ui,
|
||||
org.eclipse.cdt.dsf.debug.ui.actions,
|
||||
org.eclipse.cdt.dsf.debug.ui.contexts,
|
||||
|
|
|
@ -23,12 +23,15 @@ command.gotoAddress.name=Go to Address...
|
|||
command.gotoAddress.description=Navigate to address
|
||||
command.gotoSymbol.name=Go to Symbol...
|
||||
command.gotoSymbol.description=Navigate to symbolic address
|
||||
command.rulerToggleBreakpoint.name=Toggle Breakpoint
|
||||
command.rulerToggleBreakpoint.description=Toggle breakpoint in disassembly ruler
|
||||
|
||||
commandContext.name= In DSF Disassembly
|
||||
commandContext.description= When debugging in assembly mode
|
||||
|
||||
# actions
|
||||
action.breakpointProperties.label = Breakpoint Properties...
|
||||
action.toggleBreakpoint.label = Toggle Breakpoint
|
||||
|
||||
menu.updatePolicy = Update Policy
|
||||
menu.threadsUpdatePolicy = Threads Update Policy
|
||||
|
|
|
@ -444,6 +444,13 @@
|
|||
description="%command.gotoSymbol.description"
|
||||
id="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.gotoSymbol"
|
||||
name="%command.gotoSymbol.name"/>
|
||||
<command
|
||||
categoryId="org.eclipse.debug.ui.category.run"
|
||||
defaultHandler="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.RulerToggleBreakpointHandler"
|
||||
description="%command.rulerToggleBreakpoint.description"
|
||||
id="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.rulerToggleBreakpoint"
|
||||
name="%command.rulerToggleBreakpoint.name">
|
||||
</command>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.bindings">
|
||||
|
@ -512,6 +519,13 @@
|
|||
label="%action.breakpointProperties.label"
|
||||
menubarPath="debug">
|
||||
</action>
|
||||
<action
|
||||
class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.RulerToggleBreakpointActionDelegate"
|
||||
definitionId="org.eclipse.cdt.dsf.debug.ui.disassembly.commands.rulerToggleBreakpoint"
|
||||
id="org.eclipse.debug.ui.actions.RulerToggleBreakpointAction"
|
||||
label="%action.toggleBreakpoint.label"
|
||||
menubarPath="debug">
|
||||
</action>
|
||||
</viewerContribution>
|
||||
</extension>
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||
|
@ -49,6 +46,7 @@ import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourceFileInfo;
|
|||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourcePosition;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation.DisassemblyIPAnnotation;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.util.HSL;
|
||||
import org.eclipse.cdt.dsf.debug.service.IDisassembly;
|
||||
import org.eclipse.cdt.dsf.debug.service.IExpressions;
|
||||
|
@ -76,15 +74,14 @@ import org.eclipse.cdt.dsf.service.DsfSession;
|
|||
import org.eclipse.cdt.dsf.service.DsfSession.SessionEndedListener;
|
||||
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||
import org.eclipse.cdt.internal.ui.dnd.TextViewerDragAdapter;
|
||||
import org.eclipse.cdt.utils.Addr64;
|
||||
import org.eclipse.core.commands.NotEnabledException;
|
||||
import org.eclipse.core.commands.NotHandledException;
|
||||
import org.eclipse.core.commands.common.NotDefinedException;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IStorage;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -92,11 +89,8 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IBreakpointManager;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.core.model.ISuspendResume;
|
||||
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.actions.IRunToLineTarget;
|
||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.GroupMarker;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
@ -116,7 +110,6 @@ import org.eclipse.jface.text.IFindReplaceTarget;
|
|||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.ITextOperationTarget;
|
||||
import org.eclipse.jface.text.ITextPresentationListener;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.ITextViewerExtension;
|
||||
import org.eclipse.jface.text.IViewportListener;
|
||||
import org.eclipse.jface.text.Position;
|
||||
|
@ -140,7 +133,6 @@ import org.eclipse.jface.text.source.OverviewRuler;
|
|||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -169,7 +161,6 @@ import org.eclipse.ui.IActionBars;
|
|||
import org.eclipse.ui.IPartListener2;
|
||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||
import org.eclipse.ui.IWorkbenchCommandConstants;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchPartReference;
|
||||
import org.eclipse.ui.IWorkbenchPartSite;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
@ -223,7 +214,7 @@ 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_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.debug.ui.commands.ToggleBreakpoint"; //$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_TOGGLE_STEPPING_MODE = "org.eclipse.cdt.dsf.debug.ui.debug.ui.menu.showDisassemblyAction"; //$NON-NLS-1$
|
||||
|
||||
|
@ -234,7 +225,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
protected AbstractDisassemblyAction fActionGotoPC;
|
||||
protected AbstractDisassemblyAction fActionGotoAddress;
|
||||
private AbstractDisassemblyAction fActionGotoSymbol;
|
||||
private AbstractDisassemblyAction fActionToggleBreakpoint;
|
||||
protected AbstractDisassemblyAction fActionToggleSource;
|
||||
private AbstractDisassemblyAction fActionToggleFunctionColumn;
|
||||
private AbstractDisassemblyAction fActionToggleSymbols;
|
||||
|
@ -397,43 +387,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
}
|
||||
}
|
||||
|
||||
private final class ActionToggleBreakpoint extends AbstractDisassemblyAction {
|
||||
private IBreakpoint fBreakpoint;
|
||||
private int fLine;
|
||||
public ActionToggleBreakpoint() {
|
||||
super(DisassemblyPart.this);
|
||||
setText(DisassemblyMessages.Disassembly_action_AddBreakpoint_label);
|
||||
setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_ToggleBreakpoint));
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (fBreakpoint != null) {
|
||||
fBreakpoint.delete();
|
||||
} else {
|
||||
insertBreakpoint(fLine, false);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
DsfUIPlugin.getDefault().getLog().log(e.getStatus());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (isEnabled()) {
|
||||
fLine = fVerticalRuler.getLineOfLastMouseButtonActivity();
|
||||
IBreakpoint[] bps = getBreakpointsAtLine(fLine);
|
||||
if (bps == null) {
|
||||
fBreakpoint = null;
|
||||
setText(DisassemblyMessages.Disassembly_action_AddBreakpoint_label);
|
||||
} else {
|
||||
fBreakpoint = bps[0];
|
||||
setText(DisassemblyMessages.Disassembly_action_RemoveBreakpoint_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class ActionToggleBreakpointEnablement extends AbstractDisassemblyAction {
|
||||
private IBreakpoint fBreakpoint;
|
||||
public ActionToggleBreakpointEnablement() {
|
||||
|
@ -587,45 +540,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
public void gotoMarker(IMarker marker) {
|
||||
DisassemblyPart.this.gotoMarker(marker);
|
||||
}};
|
||||
} else if (IToggleBreakpointsTarget.class.equals(required)) {
|
||||
return new IToggleBreakpointsTarget() {
|
||||
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
ITextSelection textSelection = (ITextSelection)selection;
|
||||
int line = textSelection.getStartLine();
|
||||
IBreakpoint[] bp = getBreakpointsAtLine(line);
|
||||
if (bp == null || bp.length == 0) {
|
||||
insertBreakpoint(line, false);
|
||||
} else {
|
||||
for (int i = 0; i < bp.length; i++) {
|
||||
bp[i].delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return fDebugSessionId != null;
|
||||
}
|
||||
public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
}
|
||||
public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}
|
||||
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
|
||||
}
|
||||
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
|
||||
return false;
|
||||
}};
|
||||
} else if (IRunToLineTarget.class.equals(required)) {
|
||||
return new IRunToLineTarget() {
|
||||
public void runToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
|
||||
// ITextSelection textSelection = (ITextSelection)selection;
|
||||
// int line = textSelection.getStartLine();
|
||||
// BigInteger address = getAddressOfLine(line);
|
||||
// TLETODO [disassembly] run to line
|
||||
// getRunControl().runUntil(...);
|
||||
}
|
||||
public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
|
||||
return fTargetContext != null && isSuspended(fTargetContext) ;
|
||||
}};
|
||||
}
|
||||
return super.getAdapter(required);
|
||||
}
|
||||
|
@ -1265,7 +1179,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
|
||||
private void contributeToActionBars() {
|
||||
IWorkbenchPartSite site = getSite();
|
||||
site.setSelectionProvider(fViewer);
|
||||
site.setSelectionProvider(new DisassemblySelectionProvider(this));
|
||||
IContextService ctxService = (IContextService)site.getService(IContextService.class);
|
||||
fContextActivation = ctxService.activateContext(KEY_BINDING_CONTEXT_DISASSEMBLY);
|
||||
contributeToActionBars(getActionBars());
|
||||
|
@ -1315,14 +1229,12 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
}
|
||||
|
||||
protected void fillRulerContextMenu(IMenuManager manager) {
|
||||
fActionToggleBreakpoint.update();
|
||||
fActionToggleBreakpointEnablement.update();
|
||||
fActionToggleAddressColumn.update();
|
||||
fActionToggleFunctionColumn.update();
|
||||
|
||||
manager.add(new GroupMarker("group.top")); // ICommonMenuConstants.GROUP_TOP //$NON-NLS-1$
|
||||
manager.add(new Separator("group.breakpoints")); //$NON-NLS-1$
|
||||
manager.add(fActionToggleBreakpoint);
|
||||
manager.add(fActionToggleBreakpointEnablement);
|
||||
manager.add(new GroupMarker("debug")); //$NON-NLS-1$
|
||||
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||
|
@ -1397,15 +1309,20 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
|
||||
fActionToggleSource = new ActionToggleSource();
|
||||
fStateDependentActions.add(fActionToggleSource);
|
||||
fActionToggleBreakpoint = new ActionToggleBreakpoint();
|
||||
// fActionToggleBreakpoint.setActionDefinitionId(COMMAND_ID_TOGGLE_BREAKPOINT);
|
||||
// registerWithHandlerService(fActionToggleBreakpoint);
|
||||
fVerticalRuler.getControl().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
fActionToggleBreakpoint.update();
|
||||
if (fActionToggleBreakpoint.isEnabled()) {
|
||||
fActionToggleBreakpoint.run();
|
||||
// invoke toggle breakpoint
|
||||
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
|
||||
if (handlerService != null) {
|
||||
try {
|
||||
handlerService.executeCommand(COMMAND_ID_TOGGLE_BREAKPOINT, null);
|
||||
} catch (org.eclipse.core.commands.ExecutionException exc) {
|
||||
DsfUIPlugin.log(exc);
|
||||
} catch (NotDefinedException exc) {
|
||||
} catch (NotEnabledException exc) {
|
||||
} catch (NotHandledException exc) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1413,8 +1330,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
fActionToggleAddressColumn = new ActionToggleAddressColumn();
|
||||
fActionToggleFunctionColumn = new ActionToggleFunctionColumn();
|
||||
fActionToggleSymbols = new ActionToggleSymbols();
|
||||
// fActionSourceSteppingMode.setActionDefinitionId(COMMAND_ID_TOGGLE_STEPPING_MODE);
|
||||
// registerWithHandlerService(fActionSourceSteppingMode);
|
||||
fActionRefreshView = new ActionRefreshView();
|
||||
fStateDependentActions.add(fActionRefreshView);
|
||||
fGlobalActions.put(ActionFactory.REFRESH.getId(), fActionRefreshView);
|
||||
|
@ -3372,48 +3287,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
}
|
||||
|
||||
|
||||
private IBreakpoint insertBreakpoint(int line, boolean edit) throws CoreException {
|
||||
SourcePosition srcPos = null;
|
||||
try {
|
||||
int lineOffset = fDocument.getLineOffset(line);
|
||||
srcPos = fDocument.getSourcePosition(lineOffset);
|
||||
} catch (BadLocationException e) {
|
||||
// should not happen, but its safe to ignore anyway
|
||||
}
|
||||
|
||||
IResource resource;
|
||||
ICBreakpoint bp;
|
||||
|
||||
if (srcPos != null && srcPos.length > 0) {
|
||||
SourceFileInfo srcInfo = srcPos.fFileInfo;
|
||||
String filePath = null;
|
||||
resource = (IResource)srcInfo.fFile.getAdapter(IResource.class);
|
||||
if (resource != null) {
|
||||
final IPath location= resource.getLocation();
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
filePath = location.toOSString();
|
||||
} else {
|
||||
resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||
filePath = srcInfo.fFile.getFullPath().toOSString();
|
||||
}
|
||||
BigInteger address = srcPos.fAddressOffset;
|
||||
AddressRangePosition pos = fDocument.getDisassemblyPosition(address);
|
||||
int srcLine = -1;
|
||||
if (pos instanceof DisassemblyPosition) {
|
||||
srcLine = ((DisassemblyPosition)pos).getLine();
|
||||
}
|
||||
bp= CDIDebugModel.createLineBreakpoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$
|
||||
} else {
|
||||
resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||
BigInteger address = getAddressOfLine(line);
|
||||
bp= CDIDebugModel.createAddressBreakpoint(null, null, resource, ICBreakpointType.REGULAR, new Addr64(address), true, 0, "", true); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return bp;
|
||||
}
|
||||
|
||||
private AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file, int lineNr) {
|
||||
Object sourceElement = null;
|
||||
if (fFile2Storage.containsKey(file)) {
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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;
|
||||
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.source.ISourceViewer;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
|
||||
/**
|
||||
* Selection provider for disassembly selections.
|
||||
* Wraps the selection provider of the underlying text viewer and provides
|
||||
* {@link IDisassemblySelection}s instead of {@link ITextSelection}s.
|
||||
*
|
||||
* @since 2.1
|
||||
* @see IDisassemblySelection
|
||||
*/
|
||||
class DisassemblySelectionProvider implements ISelectionProvider {
|
||||
|
||||
private final ListenerList fListenerList = new ListenerList(ListenerList.IDENTITY);
|
||||
private final ISelectionChangedListener fListener = new ISelectionChangedListener() {
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
fireSelectionChanged(event);
|
||||
}
|
||||
};
|
||||
private final DisassemblyPart fPart;
|
||||
|
||||
DisassemblySelectionProvider(DisassemblyPart disassemblyPart) {
|
||||
fPart = disassemblyPart;
|
||||
fPart.getTextViewer().getSelectionProvider().addSelectionChangedListener(fListener);
|
||||
}
|
||||
|
||||
private void fireSelectionChanged(SelectionChangedEvent event) {
|
||||
SelectionChangedEvent newEvent = new SelectionChangedEvent(this, getSelection());
|
||||
Object[] listeners = fListenerList.getListeners();
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
|
||||
listener.selectionChanged(newEvent);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
|
||||
*/
|
||||
public void addSelectionChangedListener(ISelectionChangedListener listener) {
|
||||
fListenerList.add(listener);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
|
||||
*/
|
||||
public ISelection getSelection() {
|
||||
final ISourceViewer textViewer= fPart.getTextViewer();
|
||||
ISelectionProvider provider = textViewer.getSelectionProvider();
|
||||
if (provider != null) {
|
||||
return new DisassemblySelection((ITextSelection) provider.getSelection(), fPart);
|
||||
}
|
||||
return StructuredSelection.EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
|
||||
*/
|
||||
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
|
||||
fListenerList.remove(listener);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void setSelection(ISelection selection) {
|
||||
ISelectionProvider provider = fPart.getTextViewer().getSelectionProvider();
|
||||
if (provider != null) {
|
||||
provider.setSelection(selection);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.ui.IPropertyListener;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -14,7 +14,7 @@ import java.math.BigInteger;
|
|||
|
||||
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.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.IInputValidator;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -11,7 +11,7 @@
|
|||
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.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
|
||||
public final class ActionGotoProgramCounter extends AbstractDisassemblyAction {
|
||||
public ActionGotoProgramCounter(IDisassemblyPart disassemblyPart) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -11,7 +11,7 @@
|
|||
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.IDisassemblyPart;
|
||||
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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
|||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyMessages;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
|
@ -26,6 +26,7 @@ import org.eclipse.ui.dialogs.PropertyDialogAction;
|
|||
/**
|
||||
* Ruler action to display breakpoint properties.
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpointRulerAction {
|
||||
|
||||
private Object fContext;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.provisional.IDisassemblyPart;
|
||||
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
|
||||
/**
|
||||
* Ruler toggle breakpoint action delegate for disassembly parts.
|
||||
*
|
||||
* @since 2.1
|
||||
*
|
||||
* @see org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate
|
||||
*/
|
||||
public class RulerToggleBreakpointActionDelegate extends AbstractDisassemblyRulerActionDelegate {
|
||||
|
||||
private ToggleBreakpointAction fDelegate;
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyRulerActionDelegate#createAction(org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart, org.eclipse.jface.text.source.IVerticalRulerInfo)
|
||||
*/
|
||||
@Override
|
||||
protected IAction createAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
|
||||
if (fDelegate != null) {
|
||||
fDelegate.dispose();
|
||||
}
|
||||
return fDelegate = new ToggleBreakpointAction(disassemblyPart, disassemblyPart.getTextViewer().getDocument(), rulerInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.ui.actions.ActionDelegate#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (fDelegate != null) {
|
||||
fDelegate.dispose();
|
||||
fDelegate = null;
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.provisional.IDisassemblyPart;
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
/**
|
||||
* Default handler for the toggle breakpoint command in the disassembly ruler.
|
||||
* Invoked on double click in the ruler.
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RulerToggleBreakpointHandler extends AbstractHandler {
|
||||
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
|
||||
if (part instanceof IDisassemblyPart) {
|
||||
IDisassemblyPart disassemblyPart = (IDisassemblyPart) part;
|
||||
IDocument document = disassemblyPart.getTextViewer().getDocument();
|
||||
final IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) part.getAdapter(IVerticalRulerInfo.class);
|
||||
if (rulerInfo != null) {
|
||||
final ToggleBreakpointAction toggleBpAction= new ToggleBreakpointAction(part, document, rulerInfo);
|
||||
toggleBpAction.update();
|
||||
if (toggleBpAction.isEnabled()) {
|
||||
toggleBpAction.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.provisional;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyPosition;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourcePosition;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IStorage;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link IDisassemblySelection}.
|
||||
*
|
||||
* @since 2.1
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
public class DisassemblySelection implements IDisassemblySelection {
|
||||
|
||||
private final ITextSelection fTextSelection;
|
||||
private IStorage fSourceFile;
|
||||
private int fSourceLine;
|
||||
private BigInteger fStartAddress;
|
||||
|
||||
/**
|
||||
* Create a disassembly selection from a normal text selection and a disassembly part.
|
||||
*
|
||||
* @param selection the text selection
|
||||
* @param part the disassembly part
|
||||
*/
|
||||
public DisassemblySelection(ITextSelection selection, IDisassemblyPart part) {
|
||||
this(selection, (DisassemblyDocument) part.getTextViewer().getDocument());
|
||||
}
|
||||
|
||||
DisassemblySelection(ITextSelection selection, DisassemblyDocument document) {
|
||||
fTextSelection = selection;
|
||||
int offset = selection.getOffset();
|
||||
SourcePosition sourcePosition;
|
||||
try {
|
||||
sourcePosition = document.getSourcePosition(offset);
|
||||
} catch (BadLocationException exc) {
|
||||
sourcePosition = null;
|
||||
}
|
||||
if (sourcePosition != null) {
|
||||
fStartAddress = sourcePosition.fAddressOffset;
|
||||
if (sourcePosition.length > 0) {
|
||||
fSourceFile = sourcePosition.fFileInfo.fFile;
|
||||
DisassemblyPosition pos = (DisassemblyPosition) document.getDisassemblyPosition(fStartAddress);
|
||||
if (pos != null) {
|
||||
fSourceLine = pos.getLine();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fStartAddress = document.getAddressOfOffset(offset);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.viewers.ISelection#isEmpty()
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return fTextSelection.isEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.text.ITextSelection#getEndLine()
|
||||
*/
|
||||
public int getEndLine() {
|
||||
return fTextSelection.getEndLine();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.text.ITextSelection#getLength()
|
||||
*/
|
||||
public int getLength() {
|
||||
return fTextSelection.getLength();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.text.ITextSelection#getOffset()
|
||||
*/
|
||||
public int getOffset() {
|
||||
return fTextSelection.getOffset();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.text.ITextSelection#getStartLine()
|
||||
*/
|
||||
public int getStartLine() {
|
||||
return fTextSelection.getStartLine();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.text.ITextSelection#getText()
|
||||
*/
|
||||
public String getText() {
|
||||
return fTextSelection.getText();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection#getSourceFile()
|
||||
*/
|
||||
public IFile getSourceFile() {
|
||||
if (fSourceFile != null) {
|
||||
IResource resource = (IResource) fSourceFile.getAdapter(IResource.class);
|
||||
if (resource instanceof IFile) {
|
||||
return (IFile) resource;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection#getSourceLine()
|
||||
*/
|
||||
public int getSourceLine() {
|
||||
if (fSourceFile != null) {
|
||||
return fSourceLine;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection#getSourceLocationURI()
|
||||
*/
|
||||
public URI getSourceLocationURI() {
|
||||
if (fSourceFile != null) {
|
||||
IResource resource = (IResource) fSourceFile.getAdapter(IResource.class);
|
||||
if (resource instanceof IFile) {
|
||||
return resource.getLocationURI();
|
||||
} else {
|
||||
IPath location = fSourceFile.getFullPath();
|
||||
if (location != null) {
|
||||
return URIUtil.toURI(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection#getStartAddress()
|
||||
*/
|
||||
public BigInteger getStartAddress() {
|
||||
return fStartAddress;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||
* 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
|
||||
|
@ -8,8 +8,7 @@
|
|||
* Contributors:
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
@ -19,6 +18,10 @@ import org.eclipse.ui.IWorkbenchPart;
|
|||
|
||||
/**
|
||||
* Interface which the disassembly view and editor implement.
|
||||
*
|
||||
* @since 2.1
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IDisassemblyPart extends IWorkbenchPart {
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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.provisional;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
|
||||
/**
|
||||
* This interface represents a selection in a {@link IDisassemblyPart}.
|
||||
* In addition to text selection attributes this interface provides information
|
||||
* about the address and source file position for the start offset of the selection.
|
||||
*
|
||||
* @since 2.1
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
*/
|
||||
public interface IDisassemblySelection extends ITextSelection {
|
||||
|
||||
/**
|
||||
* @return the address associated with the start of the selection
|
||||
*/
|
||||
BigInteger getStartAddress();
|
||||
|
||||
/**
|
||||
* @return the {@link IFile} associated with the selection, may be <code>null</code>
|
||||
*/
|
||||
IFile getSourceFile();
|
||||
|
||||
/**
|
||||
* @return the source location {@link URI} of the associated source file, may be <code>null</code>
|
||||
*/
|
||||
URI getSourceLocationURI();
|
||||
|
||||
/**
|
||||
* @return the 0-based line number of the source file associated with the selection, -1 if not available
|
||||
*/
|
||||
int getSourceLine();
|
||||
}
|
Loading…
Add table
Reference in a new issue