mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 329682 - Restore backwards compatibility
This commit is contained in:
parent
d0907f8bec
commit
1e2b8c24bb
5 changed files with 65 additions and 21 deletions
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Freescale Semiconductor - refactoring
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {
|
||||||
|
|
||||||
|
protected IDisassemblyPartCallback fCallback;
|
||||||
|
|
||||||
|
protected AbstractDisassemblyBackend() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(IDisassemblyPartCallback callback) {
|
||||||
|
assert callback != null;
|
||||||
|
fCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluate the symbol address.
|
||||||
|
*
|
||||||
|
* @param symbol the symbol
|
||||||
|
* @param suppressError true to suppress error dialogs
|
||||||
|
* @return the address, <code>null</code> if failed to evaluate symbol
|
||||||
|
*/
|
||||||
|
public abstract BigInteger evaluateSymbolAddress(String symbol, boolean suppressError);
|
||||||
|
|
||||||
|
}
|
|
@ -57,9 +57,8 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* The CDI backend to the DSF disassembly view.
|
* The CDI backend to the DSF disassembly view.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DisassemblyBackendCdi implements IDisassemblyBackend, IDebugEventSetListener {
|
public class DisassemblyBackendCdi extends AbstractDisassemblyBackend implements IDebugEventSetListener {
|
||||||
|
|
||||||
private IDisassemblyPartCallback fCallback;
|
|
||||||
private ICThread fTargetContext;
|
private ICThread fTargetContext;
|
||||||
private String fCdiSessionId;
|
private String fCdiSessionId;
|
||||||
private ICStackFrame fTargetFrameContext;
|
private ICStackFrame fTargetFrameContext;
|
||||||
|
@ -74,8 +73,7 @@ public class DisassemblyBackendCdi implements IDisassemblyBackend, IDebugEventSe
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#init(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback)
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#init(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback)
|
||||||
*/
|
*/
|
||||||
public void init(IDisassemblyPartCallback callback) {
|
public void init(IDisassemblyPartCallback callback) {
|
||||||
assert callback != null;
|
super.init(callback);
|
||||||
fCallback = callback;
|
|
||||||
DebugPlugin.getDefault().addDebugEventListener(this);
|
DebugPlugin.getDefault().addDebugEventListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ import org.eclipse.jface.text.Position;
|
||||||
* DSF backends. This interface is obtained through IAdaptable. A new instance
|
* DSF backends. This interface is obtained through IAdaptable. A new instance
|
||||||
* is provided every time the adapter is requested. The caller must invoke
|
* is provided every time the adapter is requested. The caller must invoke
|
||||||
* {@link #dispose()} when it has no further use for the instance.
|
* {@link #dispose()} when it has no further use for the instance.
|
||||||
|
*
|
||||||
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
|
* Clients should extend {@link AbstractDisassemblyBackend}.
|
||||||
*/
|
*/
|
||||||
public interface IDisassemblyBackend {
|
public interface IDisassemblyBackend {
|
||||||
|
|
||||||
|
@ -143,15 +146,6 @@ public interface IDisassemblyBackend {
|
||||||
|
|
||||||
void gotoSymbol(String symbol);
|
void gotoSymbol(String symbol);
|
||||||
|
|
||||||
/**
|
|
||||||
* Evaluate the symbol address.
|
|
||||||
*
|
|
||||||
* @param symbol the symbol
|
|
||||||
* @param suppressError true to suppress error dialogs
|
|
||||||
* @return the address, <code>null</code> if failed to evaluate symbol
|
|
||||||
*/
|
|
||||||
BigInteger evaluateSymbolAddress(String symbol, boolean suppressError);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves disassembly of the code generated by a source file, starting at
|
* Retrieves disassembly of the code generated by a source file, starting at
|
||||||
* the first line. Caller specifies the maximum number of disassembly lines
|
* the first line. Caller specifies the maximum number of disassembly lines
|
||||||
|
|
|
@ -22,10 +22,10 @@ import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AbstractDisassemblyBackend;
|
||||||
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.DisassemblyUtils;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
|
@ -68,7 +68,7 @@ import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
|
|
||||||
public class DisassemblyBackendDsf implements IDisassemblyBackend, SessionEndedListener {
|
public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements SessionEndedListener {
|
||||||
|
|
||||||
private volatile IExecutionDMContext fTargetContext;
|
private volatile IExecutionDMContext fTargetContext;
|
||||||
private DsfServicesTracker fServicesTracker;
|
private DsfServicesTracker fServicesTracker;
|
||||||
|
@ -77,8 +77,6 @@ public class DisassemblyBackendDsf implements IDisassemblyBackend, SessionEndedL
|
||||||
|
|
||||||
private String fDsfSessionId;
|
private String fDsfSessionId;
|
||||||
|
|
||||||
private IDisassemblyPartCallback fCallback;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -88,9 +86,9 @@ public class DisassemblyBackendDsf implements IDisassemblyBackend, SessionEndedL
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#init(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback)
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#init(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(IDisassemblyPartCallback callback) {
|
public void init(IDisassemblyPartCallback callback) {
|
||||||
assert callback != null;
|
super.init(callback);
|
||||||
fCallback = callback;
|
|
||||||
DsfSession.addSessionEndedListener(this);
|
DsfSession.addSessionEndedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,6 +880,7 @@ public class DisassemblyBackendDsf implements IDisassemblyBackend, SessionEndedL
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#evaluateSymbolAddress(java.lang.String, boolean)
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#evaluateSymbolAddress(java.lang.String, boolean)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BigInteger evaluateSymbolAddress(final String symbol, final boolean suppressError) {
|
public BigInteger evaluateSymbolAddress(final String symbol, final boolean suppressError) {
|
||||||
Query<BigInteger> query = new Query<BigInteger>() {
|
Query<BigInteger> query = new Query<BigInteger>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,8 +27,10 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AbstractDisassemblyBackend;
|
||||||
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.DisassemblyUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument;
|
||||||
|
@ -2964,7 +2966,21 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
|
|
||||||
public BigInteger eval(String expr, boolean suppressError) {
|
public BigInteger eval(String expr, boolean suppressError) {
|
||||||
if (fBackend != null) {
|
if (fBackend != null) {
|
||||||
BigInteger address = fBackend.evaluateSymbolAddress(expr, suppressError);
|
BigInteger address = null;
|
||||||
|
if (fBackend instanceof AbstractDisassemblyBackend) {
|
||||||
|
address = ((AbstractDisassemblyBackend) fBackend).evaluateSymbolAddress(expr, suppressError);
|
||||||
|
} else {
|
||||||
|
String value = fBackend.evaluateExpression(expr);
|
||||||
|
if (value != null) {
|
||||||
|
try {
|
||||||
|
address = DisassemblyUtils.decodeAddress(value);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
if (!suppressError) {
|
||||||
|
generateErrorDialog(DisassemblyMessages.Disassembly_log_error_expression_eval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (address != null)
|
if (address != null)
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue