1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

[302554] [disassembly][api] Provisional disassembly API should use IAddress instead of BigInteger

This commit is contained in:
Anton Leherbauer 2010-02-18 12:34:10 +00:00
parent ae828d8792
commit 1e9767d045
9 changed files with 225 additions and 232 deletions

View file

@ -1,97 +1,89 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2010 Ericsson and others. * Copyright (c) 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Ericsson - Initial API and implementation * Ericsson - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions; package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import java.math.BigInteger; import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.model.IMoveToAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget;
import org.eclipse.cdt.debug.core.model.IMoveToAddress; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
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.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection; import org.eclipse.core.runtime.CoreException;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.cdt.utils.Addr64; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugException;
import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.core.runtime.Status; import org.eclipse.jface.text.ITextSelection;
import org.eclipse.debug.core.DebugException; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection; /**
import org.eclipse.ui.IWorkbenchPart; * Move to line target adapter for the DSF Disassembly view
*
/** * @since 2.1
* Move to line target adapter for the DSF Disassembly view */
* public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget {
* @since 2.1
*/ public void moveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget { if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
if (!(selection instanceof IDisassemblySelection)) {
public void moveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) { }
if (!(selection instanceof IDisassemblySelection)) { IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); final IAddress address = disassemblySelection.getStartAddress();
}
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; if (address != null && target instanceof IAdaptable) {
BigInteger rawAddress = disassemblySelection.getStartAddress(); final IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class);
if (rawAddress == null) { if (moveToAddress != null && moveToAddress.canMoveToAddress(address)) {
return; try {
} moveToAddress.moveToAddress(address);
}
final IAddress address = new Addr64(rawAddress); catch(DebugException e) {
if (address != null && target instanceof IAdaptable) { failed(e);
final IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class); }
if (moveToAddress != null && moveToAddress.canMoveToAddress(address)) { }
try { }
moveToAddress.moveToAddress(address); }
} }
catch(DebugException e) {
failed(e); public boolean canMoveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
} if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
} IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class);
} if (moveToAddress == null) {
} return false;
} }
public boolean canMoveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) { if (!(selection instanceof IDisassemblySelection)) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) { selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class); }
if (moveToAddress == null) { IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
return false; final IAddress address = disassemblySelection.getStartAddress();
} if (address == null) {
return false;
if (!(selection instanceof IDisassemblySelection)) { }
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
} return moveToAddress.canMoveToAddress(address);
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; }
BigInteger rawAddress = disassemblySelection.getStartAddress();
if (rawAddress == null) { return false;
return false; }
}
protected void failed( Throwable e ) {
final IAddress address = new Addr64(rawAddress); MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "MoveToLine failed", null); //$NON-NLS-1$
return moveToAddress.canMoveToAddress(address); ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
} GdbUIPlugin.log(ms);
}
return false; }
}
protected void failed( Throwable e ) {
MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "MoveToLine failed", null); //$NON-NLS-1$
ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
GdbUIPlugin.log(ms);
}
}

View file

@ -1,97 +1,89 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2010 Ericsson and others. * Copyright (c) 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Ericsson - Initial API and implementation * Ericsson - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions; package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import java.math.BigInteger; import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.model.IResumeAtAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget;
import org.eclipse.cdt.debug.core.model.IResumeAtAddress; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
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.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection; import org.eclipse.core.runtime.CoreException;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.cdt.utils.Addr64; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugException;
import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.core.runtime.Status; import org.eclipse.jface.text.ITextSelection;
import org.eclipse.debug.core.DebugException; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection; /**
import org.eclipse.ui.IWorkbenchPart; * Resume at line target adapter for the DSF Disassembly view
*
/** * @since 2.1
* Resume at line target adapter for the DSF Disassembly view */
* public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget {
* @since 2.1
*/ public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget { if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
if (!(selection instanceof IDisassemblySelection)) {
public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) { }
if (!(selection instanceof IDisassemblySelection)) { IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); final IAddress address = disassemblySelection.getStartAddress();
}
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; if (address != null && target instanceof IAdaptable) {
BigInteger rawAddress = disassemblySelection.getStartAddress(); final IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class);
if (rawAddress == null) { if (resumeAtAddress != null && resumeAtAddress.canResumeAtAddress(address)) {
return; try {
} resumeAtAddress.resumeAtAddress(address);
}
final IAddress address = new Addr64(rawAddress); catch(DebugException e) {
if (address != null && target instanceof IAdaptable) { failed(e);
final IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class); }
if (resumeAtAddress != null && resumeAtAddress.canResumeAtAddress(address)) { }
try { }
resumeAtAddress.resumeAtAddress(address); }
} }
catch(DebugException e) {
failed(e); public boolean canResumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
} if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
} IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class);
} if (resumeAtAddress == null) {
} return false;
} }
public boolean canResumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) { if (!(selection instanceof IDisassemblySelection)) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) { selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class); }
if (resumeAtAddress == null) { IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
return false; final IAddress address = disassemblySelection.getStartAddress();
} if (address == null) {
return false;
if (!(selection instanceof IDisassemblySelection)) { }
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
} return resumeAtAddress.canResumeAtAddress(address);
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; }
BigInteger rawAddress = disassemblySelection.getStartAddress();
if (rawAddress == null) { return false;
return false; }
}
protected void failed( Throwable e ) {
final IAddress address = new Addr64(rawAddress); MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "Resume At Line failed", null); //$NON-NLS-1$
return resumeAtAddress.canResumeAtAddress(address); ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
} GdbUIPlugin.log(ms);
}
return false; }
}
protected void failed( Throwable e ) {
MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "Resume At Line failed", null); //$NON-NLS-1$
ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
GdbUIPlugin.log(ms);
}
}

View file

@ -10,8 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions; package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import java.math.BigInteger;
import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.IRunToAddress; import org.eclipse.cdt.debug.core.model.IRunToAddress;
@ -20,7 +18,6 @@ import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.Disassembly
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.debug.internal.ui.disassembly.provisional.IDisassemblySelection; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.utils.Addr64;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -51,12 +48,8 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
} }
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
BigInteger rawAddress = disassemblySelection.getStartAddress(); final IAddress address = disassemblySelection.getStartAddress();
if (rawAddress == null) {
return;
}
final IAddress address = new Addr64(rawAddress);
if (address != null && target instanceof IAdaptable) { if (address != null && target instanceof IAdaptable) {
final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class); final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
if (runToAddress != null && runToAddress.canRunToAddress(address)) { if (runToAddress != null && runToAddress.canRunToAddress(address)) {
@ -86,12 +79,11 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
} }
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
BigInteger rawAddress = disassemblySelection.getStartAddress(); final IAddress address = disassemblySelection.getStartAddress();
if (rawAddress == null) { if (address == null) {
return false; return false;
} }
final IAddress address = new Addr64(rawAddress);
return runToAddress.canRunToAddress(address); return runToAddress.canRunToAddress(address);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. and others. * Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,18 +10,17 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints; package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
import java.math.BigInteger;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpointType; 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.DisassemblySelection;
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.debug.internal.ui.disassembly.provisional.IDisassemblySelection; 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.filesystem.URIUtil;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -125,7 +124,7 @@ public class DisassemblyToggleBreakpointsTarget implements IToggleBreakpointsTar
return breakpoints.toArray(breakpointsArray ); return breakpoints.toArray(breakpointsArray );
} }
private void insertBreakpoint(IDisassemblySelection selection) throws CoreException { private void insertBreakpoint(IDisassemblySelection selection) throws CoreException {
BigInteger address = selection.getStartAddress(); IAddress address = selection.getStartAddress();
if (address == null) { if (address == null) {
return; return;
} }
@ -147,7 +146,7 @@ public class DisassemblyToggleBreakpointsTarget implements IToggleBreakpointsTar
CDIDebugModel.createLineBreakpoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$ CDIDebugModel.createLineBreakpoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$
} else { } else {
IResource resource = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = ResourcesPlugin.getWorkspace().getRoot();
CDIDebugModel.createAddressBreakpoint(null, null, resource, ICBreakpointType.REGULAR, new Addr64(address), true, 0, "", true); //$NON-NLS-1$ CDIDebugModel.createAddressBreakpoint(null, null, resource, ICBreakpointType.REGULAR, address, true, 0, "", true); //$NON-NLS-1$
} }
} }
} }

View file

@ -10,18 +10,17 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints; package org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;
import java.math.BigInteger;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpointType; 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.DisassemblySelection;
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.debug.internal.ui.disassembly.provisional.IDisassemblySelection; 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.filesystem.URIUtil;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -125,7 +124,7 @@ public class DisassemblyToggleTracepointsTarget implements IToggleBreakpointsTar
return breakpoints.toArray(breakpointsArray ); return breakpoints.toArray(breakpointsArray );
} }
private void insertBreakpoint(IDisassemblySelection selection) throws CoreException { private void insertBreakpoint(IDisassemblySelection selection) throws CoreException {
BigInteger address = selection.getStartAddress(); IAddress address = selection.getStartAddress();
if (address == null) { if (address == null) {
return; return;
} }
@ -147,7 +146,7 @@ public class DisassemblyToggleTracepointsTarget implements IToggleBreakpointsTar
CDIDebugModel.createLineTracepoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$ CDIDebugModel.createLineTracepoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$
} else { } else {
IResource resource = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = ResourcesPlugin.getWorkspace().getRoot();
CDIDebugModel.createAddressTracepoint(null, null, resource, ICBreakpointType.REGULAR, -1, new Addr64(address), true, 0, "", true); //$NON-NLS-1$ CDIDebugModel.createAddressTracepoint(null, null, resource, ICBreakpointType.REGULAR, -1, address, true, 0, "", true); //$NON-NLS-1$
} }
} }
} }

View file

@ -20,6 +20,7 @@ import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.IAddress;
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.ErrorPosition; import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
@ -190,8 +191,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_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_TOGGLE_STEPPING_MODE = "org.eclipse.cdt.dsf.debug.ui.debug.ui.menu.showDisassemblyAction"; //$NON-NLS-1$
public static final String KEY_BINDING_CONTEXT_DISASSEMBLY = "org.eclipse.cdt.dsf.debug.ui.disassembly.context"; //$NON-NLS-1$ public static final String KEY_BINDING_CONTEXT_DISASSEMBLY = "org.eclipse.cdt.dsf.debug.ui.disassembly.context"; //$NON-NLS-1$
@ -1341,6 +1340,15 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* /*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#gotoAddress(java.math.BigInteger) * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#gotoAddress(java.math.BigInteger)
*/ */
public final void gotoAddress(IAddress address) {
if (address != null) {
gotoAddress(address.getValue());
}
}
/*
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoAddress(java.math.BigInteger)
*/
public final void gotoAddress(BigInteger address) { public final void gotoAddress(BigInteger address) {
fFocusAddress = address; fFocusAddress = address;
if (fDebugSessionId == null) { if (fDebugSessionId == null) {

View file

@ -13,9 +13,12 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.URI; import java.net.URI;
import org.eclipse.cdt.core.IAddress;
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.dsf.debug.internal.ui.disassembly.SourcePosition; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.SourcePosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument; import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
import org.eclipse.cdt.utils.Addr64;
import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -35,7 +38,7 @@ public class DisassemblySelection implements IDisassemblySelection {
private final ITextSelection fTextSelection; private final ITextSelection fTextSelection;
private IStorage fSourceFile; private IStorage fSourceFile;
private int fSourceLine; private int fSourceLine;
private BigInteger fStartAddress; private IAddress fStartAddress;
/** /**
* Create a disassembly selection from a normal text selection and a disassembly part. * Create a disassembly selection from a normal text selection and a disassembly part.
@ -56,17 +59,26 @@ public class DisassemblySelection implements IDisassemblySelection {
} catch (BadLocationException exc) { } catch (BadLocationException exc) {
sourcePosition = null; sourcePosition = null;
} }
BigInteger docAddress = null;
if (sourcePosition != null) { if (sourcePosition != null) {
fStartAddress = sourcePosition.fAddressOffset; docAddress = sourcePosition.fAddressOffset;
if (sourcePosition.length > 0) { if (sourcePosition.length > 0) {
fSourceFile = sourcePosition.fFileInfo.fFile; fSourceFile = sourcePosition.fFileInfo.fFile;
DisassemblyPosition pos = (DisassemblyPosition) document.getDisassemblyPosition(fStartAddress); AddressRangePosition pos = document.getDisassemblyPosition(docAddress);
if (pos != null) { if (pos instanceof DisassemblyPosition) {
fSourceLine = pos.getLine(); fSourceLine = ((DisassemblyPosition) pos).getLine();
} }
} }
} else { } else {
fStartAddress = document.getAddressOfOffset(offset); docAddress = document.getAddressOfOffset(offset);
}
if (docAddress != null) {
try {
fStartAddress = new Addr64(docAddress);
} catch (RuntimeException rte) {
// not a valid address
fStartAddress = null;
}
} }
} }
@ -156,7 +168,7 @@ public class DisassemblySelection implements IDisassemblySelection {
/* /*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection#getStartAddress() * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection#getStartAddress()
*/ */
public BigInteger getStartAddress() { public IAddress getStartAddress() {
return fStartAddress; return fStartAddress;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2008, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,8 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
import java.math.BigInteger; import org.eclipse.cdt.core.IAddress;
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
@ -74,7 +73,7 @@ public interface IDisassemblyPart extends IWorkbenchPart {
* *
* @param address * @param address
*/ */
void gotoAddress(BigInteger address); void gotoAddress(IAddress address);
/** /**
* Navigate to current program counter. * Navigate to current program counter.

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. and others. * Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,9 +10,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
import java.math.BigInteger;
import java.net.URI; import java.net.URI;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextSelection;
@ -28,9 +28,9 @@ import org.eclipse.jface.text.ITextSelection;
public interface IDisassemblySelection extends ITextSelection { public interface IDisassemblySelection extends ITextSelection {
/** /**
* @return the address associated with the start of the selection * @return the address associated with the start of the selection, may be <code>null</code>
*/ */
BigInteger getStartAddress(); IAddress getStartAddress();
/** /**
* @return the {@link IFile} associated with the selection, may be <code>null</code> * @return the {@link IFile} associated with the selection, may be <code>null</code>