diff options
author | Patrick Chuong | 2012-02-06 17:58:53 +0000 |
---|---|---|
committer | Patrick Chuong | 2012-02-06 17:58:53 +0000 |
commit | 2e5c77c1ab91a033296cfab467d53c1c9a260e54 (patch) | |
tree | 4dd7721d0eea16e649b735b6c5b04638ecb64ce7 | |
parent | 4fc4a8bc3badd4c58a9e15b60cf6fc64e3e1bd36 (diff) | |
download | org.eclipse.cdt-2e5c77c1ab91a033296cfab467d53c1c9a260e54.tar.gz org.eclipse.cdt-2e5c77c1ab91a033296cfab467d53c1c9a260e54.tar.xz org.eclipse.cdt-2e5c77c1ab91a033296cfab467d53c1c9a260e54.zip |
Bug 369998 - IBreakpointLocationProvider methods need a target or
viewsite parameter
3 files changed, 41 insertions, 30 deletions
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 086a186bff3..308999dadbc 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 @@ -9,9 +9,10 @@ * Wind River Systems - initial API and implementation * Patrick Chuong (Texas Instruments) - Bug 326670 * Patrick Chuong (Texas Instruments) - Bug 329682 - * Patrick Chuong (Texas Instruments) - bug 330259 + * Patrick Chuong (Texas Instruments) - Bug 330259 * Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781) * Patrick Chuong (Texas Instruments) - Bug 364405 + * Patrick Chuong (Texas Instruments) - Bug 369998 *******************************************************************************/ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly; @@ -303,7 +304,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem protected boolean fTrackExpression = false; private String fPCLastLocationTxt = DisassemblyMessages.Disassembly_GotoLocation_initial_text; private BigInteger fPCLastAddress = PC_UNKNOWN; - + private IAdaptable fDebugContext; + private String fPCAnnotationColorKey; private ArrayList<Runnable> fRunnableQueue = new ArrayList<Runnable>(); @@ -1851,22 +1853,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem } protected void updateDebugContext() { - IAdaptable context = DebugUITools.getPartDebugContext(getSite()); + fDebugContext = DebugUITools.getPartDebugContext(getSite()); IDisassemblyBackend prevBackend = fBackend; IDisassemblyBackend newBackend = null; fDebugSessionId = null; boolean needUpdate = false; - if (context != null) { - IDisassemblyBackend contextBackend = (IDisassemblyBackend)context.getAdapter(IDisassemblyBackend.class); + if (fDebugContext != null) { + IDisassemblyBackend contextBackend = (IDisassemblyBackend)fDebugContext.getAdapter(IDisassemblyBackend.class); // Need to compare the backend classes to prevent reusing the same backend object. // sub class can overwrite the standard disassembly backend to provide its own customization. - if ((prevBackend != null) && (contextBackend != null) && prevBackend.getClass().equals(contextBackend.getClass()) && prevBackend.supportsDebugContext(context)) { + if ((prevBackend != null) && (contextBackend != null) && prevBackend.getClass().equals(contextBackend.getClass()) && prevBackend.supportsDebugContext(fDebugContext)) { newBackend = prevBackend; } else { needUpdate = true; - newBackend = (IDisassemblyBackend)context.getAdapter(IDisassemblyBackend.class); + newBackend = (IDisassemblyBackend)fDebugContext.getAdapter(IDisassemblyBackend.class); if (newBackend != null) { - if (newBackend.supportsDebugContext(context)) { + if (newBackend.supportsDebugContext(fDebugContext)) { newBackend.init(this); } else { newBackend = null; @@ -1876,7 +1878,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem } fBackend = newBackend; if (newBackend != null) { - IDisassemblyBackend.SetDebugContextResult result = newBackend.setDebugContext(context); + IDisassemblyBackend.SetDebugContextResult result = newBackend.setDebugContext(fDebugContext); if (result != null) { fDebugSessionId = result.sessionId; if (result.contextChanged) { @@ -1981,7 +1983,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem IAnnotationModel annotationModel = fViewer.getAnnotationModel(); if (annotationModel instanceof IAnnotationModelExtension) { IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel; - ame.addAnnotationModel(BREAKPOINT_ANNOTATIONS, new BreakpointsAnnotationModel()); + ame.addAnnotationModel(BREAKPOINT_ANNOTATIONS, new BreakpointsAnnotationModel(fDebugContext)); } } diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java index 0a33a546846..730db8b7991 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2012 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 @@ -7,7 +7,8 @@ * * Contributors: * Anton Leherbauer (Wind River Systems) - initial API and implementation - * Patrick Chuong (Texas Instruments) - bug 300053 + * Patrick Chuong (Texas Instruments) - Bug 300053 + * Patrick Chuong (Texas Instruments) - Bug 369998 *******************************************************************************/ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model; @@ -25,6 +26,7 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointListener; import org.eclipse.debug.core.IBreakpointManager; @@ -47,7 +49,12 @@ import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel implements IBreakpointListener, IDocumentListener { private Runnable fCatchup; - + private IAdaptable fDebugContext; + + public BreakpointsAnnotationModel(IAdaptable debugContext) { + fDebugContext = debugContext; + } + @Override public void connect(IDocument document) { super.connect(document); @@ -159,14 +166,14 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple if (locationProvider != null) { /* if there is source info, than create a source line position */ - String sourceFile = locationProvider.getSourceFile(breakpoint); + String sourceFile = locationProvider.getSourceFile(breakpoint, fDebugContext); if (sourceFile != null) { - int lineNumber = locationProvider.getLineNumber(breakpoint) - 1; + int lineNumber = locationProvider.getLineNumber(breakpoint, fDebugContext) - 1; return createPositionFromSourceLine(sourceFile, lineNumber); } else { /* if there is label info, than create a label position */ - IAddress labelAddress = locationProvider.getLabelAddress(breakpoint); + IAddress labelAddress = locationProvider.getLabelAddress(breakpoint, fDebugContext); if (labelAddress != null) { return createPositionFromLabel(labelAddress.getValue()); @@ -178,7 +185,7 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple // // So for now, we only create an annotation for the first valid address. We can add // support for multiple annotations per breakpoint when it's needed. - IAddress[] addresses = locationProvider.getAddresses(breakpoint); + IAddress[] addresses = locationProvider.getAddresses(breakpoint, fDebugContext); for (int i = 0; addresses != null && i < addresses.length; ++i) { BigInteger address = addresses[i].getValue(); Position position = createPositionFromAddress(address); diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java index 221b3b4fb36..37551e26f4d 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java @@ -1,5 +1,5 @@ /***************************************************************** - * Copyright (c) 2010 Texas Instruments and others + * Copyright (c) 2010, 2012 Texas Instruments 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 @@ -7,11 +7,13 @@ * * Contributors: * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 300053) + * Patrick Chuong (Texas Instruments) - Bug 369998 *****************************************************************/ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint; @@ -46,31 +48,31 @@ public interface IBreakpointLocationProvider { * Returns the line number of the breakpoint or -1 if no line number is * available. * - * @param breakpoint - * the breakpoint + * @param breakpoint the breakpoint + * @param debugContext the debug context of the view * @return the line number or -1 */ - int getLineNumber(IBreakpoint breakpoint); + int getLineNumber(IBreakpoint breakpoint, IAdaptable debugContext); /** * Returns the source file path of the breakpoint or <code>null</code> if no * source file is associated with this breakpoint. * - * @param breakpoint - * the breakpoint + * @param breakpoint the breakpoint + * @param debugContext the debug context of the view * @return the file path, can be <code>null</code> */ - String getSourceFile(IBreakpoint breakpoint); + String getSourceFile(IBreakpoint breakpoint, IAdaptable debugContext); /** * Returns the label address of the breakpoint or <code>null</code> if no * label is associated with this breakpoint. * - * @param breakpoint - * the breakpoint + * @param breakpoint the breakpoint + * @param debugContext the debug context of the view * @return the label address, can be <code>null</code> */ - IAddress getLabelAddress(IBreakpoint breakpoint); + IAddress getLabelAddress(IBreakpoint breakpoint, IAdaptable debugContext); /** * Returns the addresses of the breakpoint. @@ -81,9 +83,9 @@ public interface IBreakpointLocationProvider { * multiple annotations per breakpoint is up for future enhancements. </i> * </p> * - * @param breakpoint - * the breakpoint + * @param breakpoint the breakpoint + * @param debugContext the debug context of the view * @return the addresses, can be <code>null</code> */ - IAddress[] getAddresses(IBreakpoint breakpoint); + IAddress[] getAddresses(IBreakpoint breakpoint, IAdaptable debugContext); } |