diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyMoveToLineAdapter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyMoveToLineAdapter.java index cff0f2c4e82..867a9ac3ae5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyMoveToLineAdapter.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyMoveToLineAdapter.java @@ -1,97 +1,89 @@ -/******************************************************************************* - * Copyright (c) 2010 Ericsson 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: - * Ericsson - Initial API and implementation - *******************************************************************************/ -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.debug.core.model.IMoveToAddress; -import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget; -import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; -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.dsf.gdb.internal.ui.GdbUIPlugin; -import org.eclipse.cdt.utils.Addr64; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.ISuspendResume; -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 - */ -public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget { - - public void moveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { - if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) { - if (!(selection instanceof IDisassemblySelection)) { - selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); - } - IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; - BigInteger rawAddress = disassemblySelection.getStartAddress(); - if (rawAddress == null) { - return; - } - - final IAddress address = new Addr64(rawAddress); - if (address != null && target instanceof IAdaptable) { - 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; - } - - if (!(selection instanceof IDisassemblySelection)) { - selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); - } - IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; - BigInteger rawAddress = disassemblySelection.getStartAddress(); - if (rawAddress == null) { - return false; - } - - final IAddress address = new Addr64(rawAddress); - return moveToAddress.canMoveToAddress(address); - } - - 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); - } -} +/******************************************************************************* + * Copyright (c) 2010 Ericsson 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: + * Ericsson - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.internal.ui.actions; + +import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.debug.core.CDIDebugModel; +import org.eclipse.cdt.debug.core.model.IMoveToAddress; +import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget; +import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; +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.dsf.gdb.internal.ui.GdbUIPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.ISuspendResume; +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 + */ +public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget { + + public void moveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { + if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) { + if (!(selection instanceof IDisassemblySelection)) { + selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); + } + IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; + final IAddress address = disassemblySelection.getStartAddress(); + + if (address != null && target instanceof IAdaptable) { + 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; + } + + if (!(selection instanceof IDisassemblySelection)) { + selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); + } + IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; + final IAddress address = disassemblySelection.getStartAddress(); + if (address == null) { + return false; + } + + return moveToAddress.canMoveToAddress(address); + } + + 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); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyResumeAtLineAdapter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyResumeAtLineAdapter.java index 1fbd842d7c5..daa352bd5e0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyResumeAtLineAdapter.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyResumeAtLineAdapter.java @@ -1,97 +1,89 @@ -/******************************************************************************* - * Copyright (c) 2010 Ericsson 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: - * Ericsson - Initial API and implementation - *******************************************************************************/ -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.debug.core.model.IResumeAtAddress; -import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget; -import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; -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.dsf.gdb.internal.ui.GdbUIPlugin; -import org.eclipse.cdt.utils.Addr64; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.ISuspendResume; -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 - */ -public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget { - - public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { - if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) { - if (!(selection instanceof IDisassemblySelection)) { - selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); - } - IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; - BigInteger rawAddress = disassemblySelection.getStartAddress(); - if (rawAddress == null) { - return; - } - - final IAddress address = new Addr64(rawAddress); - if (address != null && target instanceof IAdaptable) { - 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; - } - - if (!(selection instanceof IDisassemblySelection)) { - selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); - } - IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; - BigInteger rawAddress = disassemblySelection.getStartAddress(); - if (rawAddress == null) { - return false; - } - - final IAddress address = new Addr64(rawAddress); - return resumeAtAddress.canResumeAtAddress(address); - } - - 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); - } -} +/******************************************************************************* + * Copyright (c) 2010 Ericsson 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: + * Ericsson - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.internal.ui.actions; + +import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.debug.core.CDIDebugModel; +import org.eclipse.cdt.debug.core.model.IResumeAtAddress; +import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget; +import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; +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.dsf.gdb.internal.ui.GdbUIPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.ISuspendResume; +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 + */ +public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget { + + public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { + if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) { + if (!(selection instanceof IDisassemblySelection)) { + selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); + } + IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; + final IAddress address = disassemblySelection.getStartAddress(); + + if (address != null && target instanceof IAdaptable) { + 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; + } + + if (!(selection instanceof IDisassemblySelection)) { + selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); + } + IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; + final IAddress address = disassemblySelection.getStartAddress(); + if (address == null) { + return false; + } + + return resumeAtAddress.canResumeAtAddress(address); + } + + 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); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyRunToLineAdapter.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyRunToLineAdapter.java index 8d52e698cf3..c49fc4d57f4 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyRunToLineAdapter.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/actions/DisassemblyRunToLineAdapter.java @@ -10,8 +10,6 @@ *******************************************************************************/ 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.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.IDisassemblySelection; 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.IAdaptable; import org.eclipse.core.runtime.IStatus; @@ -51,12 +48,8 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget { selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); } IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; - BigInteger rawAddress = disassemblySelection.getStartAddress(); - if (rawAddress == null) { - return; - } - - final IAddress address = new Addr64(rawAddress); + final IAddress address = disassemblySelection.getStartAddress(); + if (address != null && target instanceof IAdaptable) { final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class); if (runToAddress != null && runToAddress.canRunToAddress(address)) { @@ -86,12 +79,11 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget { selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part); } IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection; - BigInteger rawAddress = disassemblySelection.getStartAddress(); - if (rawAddress == null) { + final IAddress address = disassemblySelection.getStartAddress(); + if (address == null) { return false; } - final IAddress address = new Addr64(rawAddress); return runToAddress.canRunToAddress(address); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java index cf589a1cdea..f3848214d11 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleBreakpointsTarget.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,18 +10,17 @@ *******************************************************************************/ 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.core.IAddress; 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; @@ -125,7 +124,7 @@ public class DisassemblyToggleBreakpointsTarget implements IToggleBreakpointsTar return breakpoints.toArray(breakpointsArray ); } private void insertBreakpoint(IDisassemblySelection selection) throws CoreException { - BigInteger address = selection.getStartAddress(); + IAddress address = selection.getStartAddress(); if (address == null) { return; } @@ -147,7 +146,7 @@ public class DisassemblyToggleBreakpointsTarget implements IToggleBreakpointsTar 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$ + CDIDebugModel.createAddressBreakpoint(null, null, resource, ICBreakpointType.REGULAR, address, true, 0, "", true); //$NON-NLS-1$ } } } \ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java index 99e4f2809ec..feb90c85e84 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/breakpoints/DisassemblyToggleTracepointsTarget.java @@ -10,18 +10,17 @@ *******************************************************************************/ 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.core.IAddress; 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; @@ -125,7 +124,7 @@ public class DisassemblyToggleTracepointsTarget implements IToggleBreakpointsTar return breakpoints.toArray(breakpointsArray ); } private void insertBreakpoint(IDisassemblySelection selection) throws CoreException { - BigInteger address = selection.getStartAddress(); + IAddress address = selection.getStartAddress(); if (address == null) { return; } @@ -147,7 +146,7 @@ public class DisassemblyToggleTracepointsTarget implements IToggleBreakpointsTar CDIDebugModel.createLineTracepoint(filePath, resource, ICBreakpointType.REGULAR, srcLine + 1, true, 0, "", true); //$NON-NLS-1$ } else { 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$ } } } \ No newline at end of file diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java index 6d73ad51e63..087de50297e 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.ListIterator; 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.DisassemblyPosition; 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_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_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$ @@ -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) */ + 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) { fFocusAddress = address; if (fDebugSessionId == null) { diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java index 1e74767b06d..5fd760e5b74 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java @@ -13,9 +13,12 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; import java.math.BigInteger; 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.dsf.debug.internal.ui.disassembly.SourcePosition; 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.resources.IFile; import org.eclipse.core.resources.IResource; @@ -35,7 +38,7 @@ public class DisassemblySelection implements IDisassemblySelection { private final ITextSelection fTextSelection; private IStorage fSourceFile; private int fSourceLine; - private BigInteger fStartAddress; + private IAddress fStartAddress; /** * 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) { sourcePosition = null; } + BigInteger docAddress = null; if (sourcePosition != null) { - fStartAddress = sourcePosition.fAddressOffset; + docAddress = sourcePosition.fAddressOffset; if (sourcePosition.length > 0) { fSourceFile = sourcePosition.fFileInfo.fFile; - DisassemblyPosition pos = (DisassemblyPosition) document.getDisassemblyPosition(fStartAddress); - if (pos != null) { - fSourceLine = pos.getLine(); + AddressRangePosition pos = document.getDisassemblyPosition(docAddress); + if (pos instanceof DisassemblyPosition) { + fSourceLine = ((DisassemblyPosition) pos).getLine(); } } } 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() */ - public BigInteger getStartAddress() { + public IAddress getStartAddress() { return fStartAddress; } diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java index bcbbcc132e9..415e94bbe7f 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,8 +10,7 @@ *******************************************************************************/ 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.text.source.ISourceViewer; import org.eclipse.ui.IWorkbenchPart; @@ -74,7 +73,7 @@ public interface IDisassemblyPart extends IWorkbenchPart { * * @param address */ - void gotoAddress(BigInteger address); + void gotoAddress(IAddress address); /** * Navigate to current program counter. diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java index b206df6879c..06531ad14f1 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; -import java.math.BigInteger; import java.net.URI; +import org.eclipse.cdt.core.IAddress; import org.eclipse.core.resources.IFile; import org.eclipse.jface.text.ITextSelection; @@ -28,9 +28,9 @@ import org.eclipse.jface.text.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 null */ - BigInteger getStartAddress(); + IAddress getStartAddress(); /** * @return the {@link IFile} associated with the selection, may be null