mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Bug 369998 - IBreakpointLocationProvider methods need a target or
viewsite parameter
This commit is contained in:
parent
4fc4a8bc3b
commit
2e5c77c1ab
3 changed files with 41 additions and 30 deletions
|
@ -9,9 +9,10 @@
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Patrick Chuong (Texas Instruments) - Bug 326670
|
* Patrick Chuong (Texas Instruments) - Bug 326670
|
||||||
* Patrick Chuong (Texas Instruments) - Bug 329682
|
* 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) - Pin and Clone Supports (331781)
|
||||||
* Patrick Chuong (Texas Instruments) - Bug 364405
|
* Patrick Chuong (Texas Instruments) - Bug 364405
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug 369998
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
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;
|
protected boolean fTrackExpression = false;
|
||||||
private String fPCLastLocationTxt = DisassemblyMessages.Disassembly_GotoLocation_initial_text;
|
private String fPCLastLocationTxt = DisassemblyMessages.Disassembly_GotoLocation_initial_text;
|
||||||
private BigInteger fPCLastAddress = PC_UNKNOWN;
|
private BigInteger fPCLastAddress = PC_UNKNOWN;
|
||||||
|
private IAdaptable fDebugContext;
|
||||||
|
|
||||||
private String fPCAnnotationColorKey;
|
private String fPCAnnotationColorKey;
|
||||||
|
|
||||||
private ArrayList<Runnable> fRunnableQueue = new ArrayList<Runnable>();
|
private ArrayList<Runnable> fRunnableQueue = new ArrayList<Runnable>();
|
||||||
|
@ -1851,22 +1853,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateDebugContext() {
|
protected void updateDebugContext() {
|
||||||
IAdaptable context = DebugUITools.getPartDebugContext(getSite());
|
fDebugContext = DebugUITools.getPartDebugContext(getSite());
|
||||||
IDisassemblyBackend prevBackend = fBackend;
|
IDisassemblyBackend prevBackend = fBackend;
|
||||||
IDisassemblyBackend newBackend = null;
|
IDisassemblyBackend newBackend = null;
|
||||||
fDebugSessionId = null;
|
fDebugSessionId = null;
|
||||||
boolean needUpdate = false;
|
boolean needUpdate = false;
|
||||||
if (context != null) {
|
if (fDebugContext != null) {
|
||||||
IDisassemblyBackend contextBackend = (IDisassemblyBackend)context.getAdapter(IDisassemblyBackend.class);
|
IDisassemblyBackend contextBackend = (IDisassemblyBackend)fDebugContext.getAdapter(IDisassemblyBackend.class);
|
||||||
// Need to compare the backend classes to prevent reusing the same backend object.
|
// 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.
|
// 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;
|
newBackend = prevBackend;
|
||||||
} else {
|
} else {
|
||||||
needUpdate = true;
|
needUpdate = true;
|
||||||
newBackend = (IDisassemblyBackend)context.getAdapter(IDisassemblyBackend.class);
|
newBackend = (IDisassemblyBackend)fDebugContext.getAdapter(IDisassemblyBackend.class);
|
||||||
if (newBackend != null) {
|
if (newBackend != null) {
|
||||||
if (newBackend.supportsDebugContext(context)) {
|
if (newBackend.supportsDebugContext(fDebugContext)) {
|
||||||
newBackend.init(this);
|
newBackend.init(this);
|
||||||
} else {
|
} else {
|
||||||
newBackend = null;
|
newBackend = null;
|
||||||
|
@ -1876,7 +1878,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
fBackend = newBackend;
|
fBackend = newBackend;
|
||||||
if (newBackend != null) {
|
if (newBackend != null) {
|
||||||
IDisassemblyBackend.SetDebugContextResult result = newBackend.setDebugContext(context);
|
IDisassemblyBackend.SetDebugContextResult result = newBackend.setDebugContext(fDebugContext);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
fDebugSessionId = result.sessionId;
|
fDebugSessionId = result.sessionId;
|
||||||
if (result.contextChanged) {
|
if (result.contextChanged) {
|
||||||
|
@ -1981,7 +1983,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
|
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
|
||||||
if (annotationModel instanceof IAnnotationModelExtension) {
|
if (annotationModel instanceof IAnnotationModelExtension) {
|
||||||
IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel;
|
IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel;
|
||||||
ame.addAnnotationModel(BREAKPOINT_ANNOTATIONS, new BreakpointsAnnotationModel());
|
ame.addAnnotationModel(BREAKPOINT_ANNOTATIONS, new BreakpointsAnnotationModel(fDebugContext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
||||||
|
@ -7,7 +7,8 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
* 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;
|
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.IMarkerDelta;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.IBreakpointListener;
|
import org.eclipse.debug.core.IBreakpointListener;
|
||||||
import org.eclipse.debug.core.IBreakpointManager;
|
import org.eclipse.debug.core.IBreakpointManager;
|
||||||
|
@ -47,7 +49,12 @@ import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
|
||||||
public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel implements IBreakpointListener, IDocumentListener {
|
public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel implements IBreakpointListener, IDocumentListener {
|
||||||
|
|
||||||
private Runnable fCatchup;
|
private Runnable fCatchup;
|
||||||
|
private IAdaptable fDebugContext;
|
||||||
|
|
||||||
|
public BreakpointsAnnotationModel(IAdaptable debugContext) {
|
||||||
|
fDebugContext = debugContext;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connect(IDocument document) {
|
public void connect(IDocument document) {
|
||||||
super.connect(document);
|
super.connect(document);
|
||||||
|
@ -159,14 +166,14 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
|
||||||
if (locationProvider != null) {
|
if (locationProvider != null) {
|
||||||
|
|
||||||
/* if there is source info, than create a source line position */
|
/* 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) {
|
if (sourceFile != null) {
|
||||||
int lineNumber = locationProvider.getLineNumber(breakpoint) - 1;
|
int lineNumber = locationProvider.getLineNumber(breakpoint, fDebugContext) - 1;
|
||||||
return createPositionFromSourceLine(sourceFile, lineNumber);
|
return createPositionFromSourceLine(sourceFile, lineNumber);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* if there is label info, than create a label position */
|
/* if there is label info, than create a label position */
|
||||||
IAddress labelAddress = locationProvider.getLabelAddress(breakpoint);
|
IAddress labelAddress = locationProvider.getLabelAddress(breakpoint, fDebugContext);
|
||||||
if (labelAddress != null) {
|
if (labelAddress != null) {
|
||||||
return createPositionFromLabel(labelAddress.getValue());
|
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
|
// 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.
|
// 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) {
|
for (int i = 0; addresses != null && i < addresses.length; ++i) {
|
||||||
BigInteger address = addresses[i].getValue();
|
BigInteger address = addresses[i].getValue();
|
||||||
Position position = createPositionFromAddress(address);
|
Position position = createPositionFromAddress(address);
|
||||||
|
|
|
@ -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
|
* 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
|
||||||
|
@ -7,11 +7,13 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 300053)
|
* 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;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
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.IBreakpoint;
|
||||||
import org.eclipse.debug.core.model.ILineBreakpoint;
|
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
|
* Returns the line number of the breakpoint or -1 if no line number is
|
||||||
* available.
|
* available.
|
||||||
*
|
*
|
||||||
* @param breakpoint
|
* @param breakpoint the breakpoint
|
||||||
* the breakpoint
|
* @param debugContext the debug context of the view
|
||||||
* @return the line number or -1
|
* @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
|
* Returns the source file path of the breakpoint or <code>null</code> if no
|
||||||
* source file is associated with this breakpoint.
|
* source file is associated with this breakpoint.
|
||||||
*
|
*
|
||||||
* @param breakpoint
|
* @param breakpoint the breakpoint
|
||||||
* the breakpoint
|
* @param debugContext the debug context of the view
|
||||||
* @return the file path, can be <code>null</code>
|
* @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
|
* Returns the label address of the breakpoint or <code>null</code> if no
|
||||||
* label is associated with this breakpoint.
|
* label is associated with this breakpoint.
|
||||||
*
|
*
|
||||||
* @param breakpoint
|
* @param breakpoint the breakpoint
|
||||||
* the breakpoint
|
* @param debugContext the debug context of the view
|
||||||
* @return the label address, can be <code>null</code>
|
* @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.
|
* Returns the addresses of the breakpoint.
|
||||||
|
@ -81,9 +83,9 @@ public interface IBreakpointLocationProvider {
|
||||||
* multiple annotations per breakpoint is up for future enhancements. </i>
|
* multiple annotations per breakpoint is up for future enhancements. </i>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param breakpoint
|
* @param breakpoint the breakpoint
|
||||||
* the breakpoint
|
* @param debugContext the debug context of the view
|
||||||
* @return the addresses, can be <code>null</code>
|
* @return the addresses, can be <code>null</code>
|
||||||
*/
|
*/
|
||||||
IAddress[] getAddresses(IBreakpoint breakpoint);
|
IAddress[] getAddresses(IBreakpoint breakpoint, IAdaptable debugContext);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue