Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java121
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java709
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java42
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java379
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java215
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java366
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java103
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java33
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties0
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java27
10 files changed, 0 insertions, 1995 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java
deleted file mode 100644
index fbe0a8608a8..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/CDIDisassemblyRetrieval.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2015 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:
- * Anton Leherbauer (Wind River Systems) - initial API and implementation
- * Freescale Semiconductor - refactoring
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
-
-import java.math.BigInteger;
-
-import org.eclipse.cdt.core.IAddress;
-import org.eclipse.cdt.debug.core.cdi.CDIException;
-import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
-import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
-import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.model.ICStackFrame;
-import org.eclipse.cdt.debug.core.model.IDisassemblyBlock;
-import org.eclipse.cdt.debug.internal.core.model.DisassemblyBlock;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- */
-public class CDIDisassemblyRetrieval implements IDisassemblyRetrieval {
-
- private ICDebugTarget fDebugTarget;
-
- /**
- * Constructor
- */
- public CDIDisassemblyRetrieval(ICDebugTarget debugTarget) {
- fDebugTarget= debugTarget;
- }
-
- /*
- * @see org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval#asyncGetDisassembly(java.math.BigInteger, java.math.BigInteger, java.lang.String, int, org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval.DisassemblyRequest)
- */
- @Override
- public void asyncGetDisassembly(final BigInteger startAddress, final BigInteger endAddress, final String file, final int lineNumber, final int lines, final boolean mixed, final DisassemblyRequest disassemblyRequest) {
- Runnable op= new Runnable() {
- @Override
- public void run() {
- ICDITarget cdiTarget= fDebugTarget.getAdapter(ICDITarget.class);
- try {
- ICDIMixedInstruction[] mixedInstructions= null;
- ICDIInstruction[] asmInstructions= null;
- if (file != null) {
- if (mixed) {
- mixedInstructions= cdiTarget.getMixedInstructions(file, lineNumber, lines);
- } else {
- asmInstructions= cdiTarget.getInstructions(file, lineNumber, lines);
- }
- }
- else if (startAddress != null) {
- if (mixed) {
- mixedInstructions= cdiTarget.getMixedInstructions(startAddress, endAddress);
- }
- if (mixedInstructions == null || mixedInstructions.length == 0) {
- mixedInstructions= null;
- asmInstructions= cdiTarget.getInstructions(startAddress, endAddress);
- } else if (mixedInstructions.length == 1 && mixedInstructions[0].getInstructions().length == 0) {
- mixedInstructions= null;
- asmInstructions= cdiTarget.getInstructions(startAddress, endAddress);
- }
- }
- if (mixedInstructions != null) {
- IDisassemblyBlock block= DisassemblyBlock.create(fDebugTarget.getDisassembly(), mixedInstructions);
- disassemblyRequest.setDisassemblyBlock(block);
- } else if (asmInstructions != null) {
- IDisassemblyBlock block= DisassemblyBlock.create(fDebugTarget.getDisassembly(), asmInstructions);
- disassemblyRequest.setDisassemblyBlock(block);
- }
- } catch (CDIException exc) {
- disassemblyRequest.setStatus(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), exc.getDetailMessage(), exc));
- } catch (DebugException exc) {
- disassemblyRequest.setStatus(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), exc.getMessage(), exc));
- } finally {
- disassemblyRequest.done();
- }
-
- }
- };
- Display.getDefault().asyncExec(op);
- }
-
- /*
- * @see org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval#asyncGetFrameAddress(org.eclipse.debug.core.model.IStackFrame, org.eclipse.cdt.debug.ui.infinitedisassembly.views.IDisassemblyRetrieval.AddressRequest)
- */
- @Override
- public void asyncGetFrameAddress(final IStackFrame stackFrame, final AddressRequest addressRequest) {
- Runnable op= new Runnable() {
- @Override
- public void run() {
- if (stackFrame instanceof ICStackFrame) {
- IAddress address = ((ICStackFrame)stackFrame).getAddress();
- if (address != null ) {
- addressRequest.setAddress(address.getValue());
- } else {
- addressRequest.setStatus(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), "Internal error: Cannot retrieve frame address")); //$NON-NLS-1$
- }
- } else {
- addressRequest.cancel();
- }
- addressRequest.done();
- }
- };
- Display.getDefault().asyncExec(op);
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java
deleted file mode 100644
index 1ffc3e62486..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdi.java
+++ /dev/null
@@ -1,709 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- * Freescale Semiconductor - refactoring
- * Patrick Chuong (Texas Instruments) - Bug fix (329682)
- * Patrick Chuong (Texas Instruments) - Bug fix (304108)
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
-
-import java.math.BigInteger;
-
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.debug.core.cdi.CDIException;
-import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
-import org.eclipse.cdt.debug.core.model.IAsmInstruction;
-import org.eclipse.cdt.debug.core.model.IAsmSourceLine;
-import org.eclipse.cdt.debug.core.model.ICDebugElement;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.model.ICStackFrame;
-import org.eclipse.cdt.debug.core.model.ICThread;
-import org.eclipse.cdt.debug.core.model.ICType;
-import org.eclipse.cdt.debug.core.model.ICValue;
-import org.eclipse.cdt.debug.core.model.IDisassemblyBlock;
-import org.eclipse.cdt.debug.internal.core.CRequest;
-import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
-import org.eclipse.cdt.debug.internal.core.model.CExpression;
-import org.eclipse.cdt.debug.internal.core.model.CStackFrame;
-import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Position;
-
-import com.ibm.icu.text.MessageFormat;
-
-/**
- * The CDI backend to the DSF disassembly view.
- *
- */
-public class DisassemblyBackendCdi extends AbstractDisassemblyBackend implements IDebugEventSetListener {
-
- private ICThread fTargetContext;
- private String fCdiSessionId;
- private ICStackFrame fTargetFrameContext;
- private CDIDisassemblyRetrieval fDisassemblyRetrieval;
- /* The frame level as the disassembly callback expects it (0 = topmost frame) */
- private int fFrameLevel;
-
- public DisassemblyBackendCdi() {
- }
-
- /* (non-Javadoc)
- * @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) {
- super.init(callback);
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#hasDebugContext()
- */
- @Override
- public boolean hasDebugContext() {
- return fTargetContext != null;
- }
-
- /**
- * Unlike DSF, CDI sessions don't have an ID. But to appease the DSF
- * Disassembly view, we fabricate one.
- *
- * @param debugElement
- * the debug element which represents the process being debugged
- * @return the session ID
- */
- private String getSessionId(ICDebugElement debugElement) {
- return "cdi-" + System.identityHashCode(debugElement.getDebugTarget()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#setDebugContext(org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public SetDebugContextResult setDebugContext(IAdaptable context) {
- assert supportsDebugContext(context) : "caller should not have invoked us"; //$NON-NLS-1$
-
- SetDebugContextResult result = new SetDebugContextResult();
-
- ICDebugTarget cdiDebugTarget = (ICDebugTarget)((ICDebugElement)context).getDebugTarget();
- String cdiSessionId = getSessionId(cdiDebugTarget);
-
- fDisassemblyRetrieval = new CDIDisassemblyRetrieval(cdiDebugTarget);
-
- if (!cdiSessionId.equals(fCdiSessionId)) {
- fTargetContext = null;
- fTargetFrameContext = null;
- result.contextChanged = true;
-
- if (context instanceof ICStackFrame) {
- fFrameLevel = 0;
- fTargetContext = (ICThread)((ICStackFrame)context).getThread();
- try {
- // Get the topmost stack frame. Note that the state of the
- // thread may have changed by now. It may be running, in
- // which case we'll get null here. See bugzilla 317226
- IStackFrame topFrame = fTargetContext.getTopStackFrame();
- if (topFrame != null) {
- fTargetFrameContext = (ICStackFrame)context;
-
- // CDI frame levels are ordered opposite of DSF. Frame 0 is the
- // root frame of the thread where in DSF it's the topmost frame
- // (where the PC is). Do a little math to flip reverse the value
- fFrameLevel = ((CStackFrame)topFrame).getLevel() - fTargetFrameContext.getLevel();
- }
- } catch (DebugException e) {
- }
- }
-
- if (fTargetContext != null) {
- result.sessionId = fCdiSessionId = cdiSessionId;
- }
- }
- else if (context instanceof ICStackFrame) {
- result.sessionId = fCdiSessionId;
- fTargetFrameContext = null;
- fFrameLevel = 0;
- ICThread newTargetContext = (ICThread)((ICStackFrame)context).getThread();
- ICThread oldTargetContext = fTargetContext;
- fTargetContext = newTargetContext;
- if (oldTargetContext == null) {
- result.contextChanged = true;
- } else if (/*oldTargetContext != null && */newTargetContext != null) {
- result.contextChanged = !oldTargetContext.getDebugTarget().equals(newTargetContext.getDebugTarget());
- }
- try {
- // Get the topmost stack frame. Note that the state of the
- // thread may have changed by now. It may be running, in
- // which case we'll get null here. See bugzilla 317226
- IStackFrame topFrame = fTargetContext.getTopStackFrame();
- if (topFrame != null) {
- fTargetFrameContext = (ICStackFrame)context;
-
- // CDI frame levels are ordered opposite of DSF. Frame 0 is the
- // root frame of the thread where in DSF it's the topmost frame
- // (where the PC is). Do a little math to flip reverse the value
- fFrameLevel = ((CStackFrame)topFrame).getLevel() - fTargetFrameContext.getLevel();
- }
- } catch (DebugException e) {
- }
- if (!result.contextChanged) {
- fCallback.gotoFrame(fFrameLevel);
- }
- } else {
- fTargetContext = null;
- fTargetFrameContext = null;
- result.contextChanged = true;
- }
-
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#supportsDebugContext(org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public boolean supportsDebugContext(IAdaptable context) {
- return supportsDebugContext_(context);
- }
-
- /**
- * @param context
- * @return
- */
- public static boolean supportsDebugContext_(IAdaptable context) {
- return (context != null) && (context.getAdapter(ICDebugElement.class) != null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#clearDebugContext()
- */
- @Override
- public void clearDebugContext() {
- fTargetContext= null;
- fCdiSessionId = null;
- fTargetFrameContext = null;
- fDisassemblyRetrieval = null;
- fFrameLevel = 0;
- }
-
- private class AddressRequest extends CRequest implements IDisassemblyRetrieval.AddressRequest {
- private BigInteger fAddress;
- @Override
- public BigInteger getAddress() { return fAddress; }
- @Override
- public void setAddress(BigInteger address) { fAddress = address; }
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#retrieveFrameAddress(int)
- */
- @Override
- public void retrieveFrameAddress(final int targetFrame) {
- try {
- final IStackFrame[] stackFrames= fTargetContext.getStackFrames();
- if (stackFrames.length <= targetFrame) {
- fCallback.setUpdatePending(false);
- return;
- }
- IStackFrame stackFrame= stackFrames[targetFrame];
- fDisassemblyRetrieval.asyncGetFrameAddress(stackFrame, new AddressRequest() {
- @Override
- public void done() {
- fCallback.setUpdatePending(false);
- if (isSuccess()) {
- BigInteger address= getAddress();
- if (targetFrame == 0) {
- fCallback.updatePC(address);
- } else {
- fCallback.gotoFrame(targetFrame, address);
- }
- }
- }
- });
-
- } catch (DebugException exc) {
- DisassemblyUtils.internalError(exc);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameLevel()
- */
- @Override
- public int getFrameLevel() {
- return fFrameLevel;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#isSuspended()
- */
- @Override
- public boolean isSuspended() {
- return fTargetContext != null && fTargetContext.isSuspended();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameFile()
- */
- @Override
- public String getFrameFile() {
- return fTargetFrameContext != null ? fTargetFrameContext.getFile() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameLine()
- */
- @Override
- public int getFrameLine() {
- return fTargetFrameContext.getFrameLineNumber();
- }
-
- private class DisassemblyRequest extends CRequest implements IDisassemblyRetrieval.DisassemblyRequest {
- private IDisassemblyBlock fBlock;
- @Override
- public IDisassemblyBlock getDisassemblyBlock() { return fBlock; }
- @Override
- public void setDisassemblyBlock(IDisassemblyBlock block) { fBlock = block; }
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#retrieveDisassembly(java.math.BigInteger, java.math.BigInteger, java.lang.String, boolean, boolean, boolean, int, int, int)
- */
- @Override
- public void retrieveDisassembly(final BigInteger startAddress,
- BigInteger endAddress, final String file, int lineNumber, final int lines, final boolean mixed,
- final boolean showSymbols, final boolean showDisassembly, final int linesHint) {
-
- if (fTargetContext == null || fTargetContext.isTerminated()) {
- return;
- }
- final BigInteger addressLength= BigInteger.valueOf(lines * 4);
- if (endAddress.subtract(startAddress).compareTo(addressLength) > 0) {
- endAddress= startAddress.add(addressLength);
- }
- // make sure address range is no less than 32 bytes
- // this is an attempt to get better a response from the backend (bug 302925)
- final BigInteger finalEndAddress= startAddress.add(BigInteger.valueOf(32)).max(endAddress);
- final IDisassemblyRetrieval.DisassemblyRequest disassemblyRequest= new DisassemblyRequest() {
- @Override
- public void done() {
- if (isSuccess() && getDisassemblyBlock() != null) {
- if (!insertDisassembly(startAddress, finalEndAddress, getDisassemblyBlock(), mixed, showSymbols, showDisassembly)) {
- // did not get disassembly data for startAddress - try fallbacks
- if (file != null) {
- // previous attempt used the file; retry using the address
- fCallback.setUpdatePending(true);
- retrieveDisassembly(startAddress, finalEndAddress, null, -1, lines, mixed, showSymbols, showDisassembly, linesHint);
- } else if (mixed) {
- // retry using non-mixed mode
- fCallback.setUpdatePending(true);
- retrieveDisassembly(startAddress, finalEndAddress, null, -1, lines, false, showSymbols, showDisassembly, linesHint);
- } else {
- // give up
- fCallback.doScrollLocked(new Runnable() {
- @Override
- public void run() {
- fCallback.insertError(startAddress, "Unable to retrieve disassembly data from backend."); //$NON-NLS-1$
- }
- });
- }
- }
- } else {
- final IStatus status= getStatus();
- if (status != null && !status.isOK()) {
- fCallback.doScrollLocked(new Runnable() {
- @Override
- public void run() {
- fCallback.insertError(startAddress, status.getMessage());
- }
- });
- }
- fCallback.setUpdatePending(false);
- }
- }
- };
- fDisassemblyRetrieval.asyncGetDisassembly(startAddress, finalEndAddress, file, lineNumber, lines, mixed, disassemblyRequest);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#insertSource(org.eclipse.jface.text.Position, java.math.BigInteger, java.lang.String, int)
- */
- @Override
- public Object insertSource(Position pos, BigInteger address,
- String file, int lineNumber) {
- ISourceLocator locator = fTargetContext.getLaunch().getSourceLocator();
- if (locator instanceof ISourceLookupDirector) {
- return ((ISourceLookupDirector)locator).getSourceElement(file);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#hasFrameContext()
- */
- @Override
- public boolean hasFrameContext() {
- return fTargetFrameContext != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#gotoSymbol(java.lang.String)
- */
- @Override
- public void gotoSymbol(String symbol) {
- final BigInteger address = evaluateAddressExpression(symbol, false);
- if (address != null) {
- fCallback.asyncExec(new Runnable() {
- @Override
- public void run() {
- fCallback.gotoAddress(address);
- }});
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#evaluateSymbolAddress(java.lang.String, boolean)
- */
- @Override
- public BigInteger evaluateAddressExpression(String symbol, final boolean suppressError) {
- if (fTargetFrameContext != null) {
- try {
- // This logic was lifted from CMemoryBlockRetrievalExtension.getExtendedMemoryBlock(String, Object)
- CStackFrame cstackFrame = (CStackFrame)fTargetFrameContext;
- ICDIExpression cdiExpression = cstackFrame.getCDITarget().createExpression(symbol);
- CExpression cdtExpression = new CExpression(cstackFrame, cdiExpression, null);
- IValue value = cdtExpression.getValue();
- if (value instanceof ICValue) {
- ICType type = ((ICValue)value).getType();
- if (type != null) {
- // get the address for the expression, allow all types
- String rawExpr = cdtExpression.getExpressionString();
- String voidExpr = "(void *)(" + rawExpr + ')'; //$NON-NLS-1$
- String attempts[] = { rawExpr, voidExpr };
- for (int i = 0; i < attempts.length; i++) {
- String expr = attempts[i];
- String addressStr = cstackFrame.evaluateExpressionToString(expr);
- if (addressStr != null) {
- try {
- return (addressStr.startsWith("0x")) ? new BigInteger(addressStr.substring(2), 16) : new BigInteger(addressStr); //$NON-NLS-1$
-
- } catch (NumberFormatException e) {
- if (i >= attempts.length) {
- throw new DebugException(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID,
- MessageFormat.format(CDebugUIMessages.getString("DisassemblyBackendCdi_Symbol_Evaluation_Unusable"), new String[]{symbol}))); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
- else {
- throw new DebugException(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID,
- MessageFormat.format(CDebugUIMessages.getString("DisassemblyBackendCdi_Symbol_Didnt_Evaluate"), new String[]{symbol}))); //$NON-NLS-1$
- }
- }
- catch (final CDIException exc) {
- if (!suppressError) {
- fCallback.asyncExec(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(fCallback.getSite().getShell(),
- CDebugUIMessages.getString("DisassemblyBackendCdi_Error_Dlg_Title"), //$NON-NLS-1$
- null, new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, exc.getLocalizedMessage()));
- }});
- }
- }
- catch (final DebugException exc) {
- if (!suppressError) {
- fCallback.asyncExec(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(fCallback.getSite().getShell(),
- CDebugUIMessages.getString("DisassemblyBackendCdi_Error_Dlg_Title"), //$NON-NLS-1$
- null, exc.getStatus());
- }});
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#retrieveDisassembly(java.lang.String, int, java.math.BigInteger, boolean, boolean, boolean)
- */
- @Override
- public void retrieveDisassembly(String file, int lines,
- final BigInteger endAddress, final boolean mixed, final boolean showSymbols,
- final boolean showDisassembly) {
- final IDisassemblyRetrieval.DisassemblyRequest disassemblyRequest= new DisassemblyRequest() {
- @Override
- public void done() {
- if (isSuccess() && getDisassemblyBlock() != null) {
- insertDisassembly(null, endAddress, getDisassemblyBlock(), mixed, showSymbols, showDisassembly);
- } else {
- final IStatus status= getStatus();
- if (status != null && !status.isOK()) {
- fCallback.asyncExec(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
- }
- });
- }
- fCallback.setUpdatePending(false);
- }
- }
- };
-
- assert !fCallback.getUpdatePending();
- fCallback.setUpdatePending(true);
- fDisassemblyRetrieval.asyncGetDisassembly(null, endAddress, file, 1, lines, mixed, disassemblyRequest);
- }
-
- /**
- * @param startAddress
- * an address the caller is hoping will be covered by this
- * insertion. I.e., [disassemblyBlock] may or may not contain
- * that address; the caller wants to know if it does, and so we
- * indicate that via our return value. Can be null to indicate n/a,
- * in which case we return true as long as any instruction was inserted
- * @param endAddress
- * cut-off address. Any elements in [disassemblyBlock] that
- * extend beyond this address are ignored.
- * @param disassemblyBlock
- * @param mixed
- * @param showSymbols
- * @param showDisassembly
- * @return whether [startAddress] was inserted
- */
- private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IDisassemblyBlock disassemblyBlock, boolean mixed, boolean showSymbols, boolean showDisassembly) {
- if (!fCallback.hasViewer() || fCdiSessionId == null) {
- // return true to avoid a retry
- return true;
- }
-
- if (!fCallback.getUpdatePending()) {
- // safe-guard in case something weird is going on
- assert false;
- // return true to avoid a retry
- return true;
- }
-
- // indicates whether [startAddress] was inserted
- boolean insertedStartAddress = startAddress == null;
-
- try {
- fCallback.lockScroller();
-
- final IDisassemblyDocument document = fCallback.getDocument(); // for convenience
- IAsmSourceLine[] srcLines= disassemblyBlock.getSourceLines();
- AddressRangePosition p = null;
- Object srcElement= disassemblyBlock.getSourceElement();
- for (int i = 0; i < srcLines.length; i++) {
- IAsmSourceLine srcLine= srcLines[i];
-
- // If the caller doesn't want mixed, set line number to -1 so we
- // create a pure disassembly position object
- int lineNumber= mixed ? srcLine.getLineNumber() - 1 : -1;
-
- IAsmInstruction[] instructions= srcLine.getInstructions();
- for (int j = 0; j < instructions.length; j++) {
- IAsmInstruction instruction = instructions[j];
- BigInteger address= instruction.getAdress().getValue();
- if (startAddress == null) {
- startAddress = address;
- fCallback.setGotoAddressPending(address);
- }
- if (p == null || !p.containsAddress(address)) {
- p = fCallback.getPositionOfAddress(address);
- }
- if (p instanceof ErrorPosition && p.fValid) {
- p.fValid = false;
- document.addInvalidAddressRange(p);
- } else if (p == null || address.compareTo(endAddress) > 0) {
- return insertedStartAddress;
- } else if (p.fValid) {
- if (srcElement != null && lineNumber >= 0 || p.fAddressLength == BigInteger.ONE) {
- // override probably unaligned disassembly
- p.fValid = false;
- document.addInvalidAddressRange(p);
- } else {
- return insertedStartAddress;
- }
- }
- boolean hasSource= false;
- String compilationPath= null;
- if (srcElement != null && lineNumber >= 0) {
- if (srcElement instanceof LocalFileStorage) {
- compilationPath = ((LocalFileStorage)srcElement).getFullPath().toString();
- }
- else if (srcElement instanceof IFile) {
- compilationPath = ((IFile)srcElement).getLocation().toString();
- }
- else if (srcElement instanceof java.io.File) {
- compilationPath = ((java.io.File)srcElement).getAbsolutePath();
- }
- else if (srcElement instanceof ITranslationUnit) {
- IPath location = ((ITranslationUnit) srcElement).getLocation();
- if (location != null) {
- compilationPath = location.toString();
- }
- }
- else {
- assert false : "missing support for source element of type " + srcElement.getClass().toString(); //$NON-NLS-1$
- }
- if (compilationPath != null) {
- p = fCallback.insertSource(p, address, compilationPath, lineNumber);
- hasSource = fCallback.getStorageForFile(compilationPath) != null;
- }
- else {
- hasSource = false;
- }
- }
- // insert symbol label
- final String functionName= instruction.getFunctionName();
- if (functionName != null && functionName.length() > 0 && instruction.getOffset() == 0) {
- p = document.insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly));
- }
- // determine instruction byte length
- BigInteger instrLength= null;
- if (j < instructions.length - 1) {
- instrLength= instructions[j+1].getAdress().distanceTo(instruction.getAdress()).abs();
- } else if (i < srcLines.length - 1) {
- int nextSrcLineIdx= i+1;
- while (nextSrcLineIdx < srcLines.length) {
- IAsmInstruction[] nextInstrs= srcLines[nextSrcLineIdx].getInstructions();
- if (nextInstrs.length > 0) {
- instrLength= nextInstrs[0].getAdress().distanceTo(instruction.getAdress()).abs();
- break;
- }
- ++nextSrcLineIdx;
- }
- if (nextSrcLineIdx >= srcLines.length) {
- break;
- }
- } else {
-// if (instructions.length == 1) {
-// if (p.fAddressLength.compareTo(BigInteger.valueOf(8)) <= 0) {
-// instrLength= p.fAddressLength;
-// }
-// }
- }
- if (instrLength == null) {
- // cannot determine length of last instruction
- break;
- }
- final String opCode;
- // insert function name+offset instead of opcode bytes
- if (functionName != null && functionName.length() > 0) {
- opCode= functionName + '+' + instruction.getOffset();
- } else {
- opCode= ""; //$NON-NLS-1$
- }
- if (!showDisassembly && hasSource) {
- p = document.insertDisassemblyLine(p, address, instrLength.intValue(), opCode, "", compilationPath, lineNumber); //$NON-NLS-1$
- } else {
- p = document.insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstructionText(), compilationPath, lineNumber); //$NON-NLS-1
- }
- insertedStartAddress= insertedStartAddress || address.compareTo(startAddress) == 0;
- if (p == null && insertedStartAddress) {
- break;
- }
- }
- }
-
-
- } catch (BadLocationException e) {
- // should not happen
- DisassemblyUtils.internalError(e);
- } finally {
- fCallback.setUpdatePending(false);
- if (insertedStartAddress) {
- fCallback.updateInvalidSource();
- fCallback.unlockScroller();
- fCallback.doPending();
- fCallback.updateVisibleArea();
- } else {
- fCallback.unlockScroller();
- }
- }
- return insertedStartAddress;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
- */
- @Override
- public void handleDebugEvents(DebugEvent[] events) {
- for (DebugEvent event : events) {
- if (event.getKind() == DebugEvent.TERMINATE) {
- Object eventSource = event.getSource();
- if ((eventSource instanceof CDebugTarget) && (getSessionId((CDebugTarget)eventSource).equals(fCdiSessionId))) {
- fCallback.handleTargetEnded();
- return;
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#dispose()
- */
- @Override
- public void dispose() {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#evaluateExpression(java.lang.String)
- */
- @Override
- public String evaluateExpression(String expression) {
- // This is called to service text hovering. We either resolve the
- // expression or we don't. No error reporting needed.
- if (fTargetFrameContext != null) {
- try {
- // This logic was lifted from CMemoryBlockRetrievalExtension.getExtendedMemoryBlock(String, Object)
- CStackFrame cstackFrame = (CStackFrame)fTargetFrameContext;
- ICDIExpression cdiExpression = cstackFrame.getCDITarget().createExpression(expression);
- CExpression cdtExpression = new CExpression(cstackFrame, cdiExpression, null);
- IValue value = cdtExpression.getValue();
- if (value instanceof ICValue) {
- ICType type = ((ICValue)value).getType();
- if (type != null) {
- return cstackFrame.evaluateExpressionToString(cdtExpression.getExpressionString());
- }
- }
- }
- catch (Exception exc) {
-
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java
deleted file mode 100644
index b4c5e4cf2d3..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/DisassemblyBackendCdiFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2012 Freescale Semiconductor, 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:
- * Freescale Semiconductor - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IAdapterFactory;
-
-public class DisassemblyBackendCdiFactory implements IAdapterFactory {
-
- private static final Class<?>[] ADAPTERS = { IDisassemblyBackend.class };
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- @Override
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (IDisassemblyBackend.class.equals(adapterType)) {
- if (adaptableObject instanceof IAdaptable && DisassemblyBackendCdi.supportsDebugContext_((IAdaptable)adaptableObject)) {
- return new DisassemblyBackendCdi();
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- @SuppressWarnings("rawtypes")
- public Class[] getAdapterList() {
- return ADAPTERS;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
deleted file mode 100644
index 957e6416e1d..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2015 ARM Limited 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:
- * ARM Limited - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.disassembly.editor;
-
-import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider;
-import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerAction;
-import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualSourceViewer;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusableEditor, IDebugContextListener, IPropertyChangeListener {
-
- private DisassemblyPane fDisassemblyPane;
-
- public DisassemblyEditor() {
- super();
- fDisassemblyPane = new DisassemblyPane( "#DisassemblyEditorContext", "#DisassemblyEditorRulerContext" ); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void doSave( IProgressMonitor monitor ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSaveAs()
- */
- @Override
- public void doSaveAs() {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
- @Override
- public void init( IEditorSite site, IEditorInput input ) throws PartInitException {
- setSite( site );
- setInput( input );
- ((DisassemblyDocumentProvider)getDocumentProvider()).
- getDocumentPresentation( input ).
- addPropertyChangeListener( this );
- DebugUITools.getDebugContextManager().addDebugContextListener( this );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#isDirty()
- */
- @Override
- public boolean isDirty() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
- */
- @Override
- public boolean isSaveAsAllowed() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createPartControl( Composite parent ) {
- fDisassemblyPane.create( parent );
- createActions();
-
- // register the context menu such that other plugins may contribute to it
- if ( getSite() != null ) {
- getSite().registerContextMenu( fDisassemblyPane.getViewContextMenuId(), fDisassemblyPane.getTextMenuManager(), getViewer() );
- }
-
- if ( getSite() != null ) {
- getSite().registerContextMenu( fDisassemblyPane.getRulerContextMenuId(), fDisassemblyPane.getTextMenuManager(), getViewer() );
- }
-
- VirtualSourceViewer viewer = fDisassemblyPane.getViewer();
- IEditorInput input = getEditorInput();
- if ( input instanceof DisassemblyEditorInput ) {
- Object debugContext = ((DisassemblyEditorInput)input).getDebugContext();
- VirtualDocument document = (VirtualDocument)getDocumentProvider().getDocument( input );
- IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel( input );
- viewer.setDocument( document, annotationModel );
- ((VirtualDocument)viewer.getDocument()).getContentProvider().changeInput( viewer, document.getPresentationContext(), null, debugContext, document.getCurrentOffset() );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
- @Override
- public void setFocus() {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- */
- @Override
- public void dispose() {
- DebugUITools.getDebugContextManager().removeDebugContextListener( this );
- ((DisassemblyDocumentProvider)getDocumentProvider()).
- getDocumentPresentation( getEditorInput() ).
- removePropertyChangeListener( this );
- getDocumentProvider().disconnect( getEditorInput() );
- fDisassemblyPane.dispose();
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput)
- */
- @Override
- public final void setInput( IEditorInput input ) {
- super.setInput( input );
- Object debugContext = ((DisassemblyEditorInput)input).getDebugContext();
- try {
- getDocumentProvider().connect( input );
- }
- catch( CoreException e ) {
- // shouldn't happen
- }
- VirtualDocument document = (VirtualDocument)getDocumentProvider().getDocument( input );
- VirtualSourceViewer viewer = getViewer();
- if ( document != null && viewer != null ) {
- DocumentContentProvider contentProvider = document.getContentProvider();
- Object oldInput = contentProvider.getInput();
- contentProvider.changeInput( getViewer(), document.getPresentationContext(), oldInput, debugContext, document.getCurrentOffset() );
-// getViewer().refresh( false, true );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
- */
- @Override
- public void debugContextChanged( DebugContextEvent event ) {
- ISelection selection = event.getContext();
- if ( selection instanceof IStructuredSelection ) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- Object context = ss.getFirstElement();
- if ( context != null ) {
- IDisassemblyContextProvider contextProvider = getDisassemblyContextProvider( context );
- if ( contextProvider != null ) {
- Object disassemblyContext = contextProvider.getDisassemblyContext( context );
- if ( disassemblyContext != null ) {
- DisassemblyEditorInput oldInput = (DisassemblyEditorInput)getEditorInput();
- if ( oldInput.getDisassemblyContext().equals( disassemblyContext ) ) {
- setInput( new DisassemblyEditorInput( context, disassemblyContext ) );
- }
- }
- }
- }
- }
- }
-
- private IDisassemblyContextProvider getDisassemblyContextProvider( Object element ) {
- IDisassemblyContextProvider adapter = null;
- if ( element instanceof IDisassemblyContextProvider ) {
- adapter = (IDisassemblyContextProvider)element;
- }
- else if ( element instanceof IAdaptable ) {
- IAdaptable adaptable = (IAdaptable)element;
- adapter = adaptable.getAdapter( IDisassemblyContextProvider.class );
- }
- return adapter;
- }
-
- private VirtualSourceViewer getViewer() {
- return fDisassemblyPane.getViewer();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#close(boolean)
- */
- @Override
- public void close( boolean save ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#doRevertToSaved()
- */
- @Override
- public void doRevertToSaved() {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#getAction(java.lang.String)
- */
- @Override
- public IAction getAction( String actionId ) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#getDocumentProvider()
- */
- @Override
- public IDocumentProvider getDocumentProvider() {
- return CDebugUIPlugin.getDefault().getDisassemblyEditorManager().getDocumentProvider();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#getHighlightRange()
- */
- @Override
- public IRegion getHighlightRange() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#getSelectionProvider()
- */
- @Override
- public ISelectionProvider getSelectionProvider() {
- VirtualSourceViewer viewer = getViewer();
- return ( viewer != null ) ? viewer.getSelectionProvider() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#isEditable()
- */
- @Override
- public boolean isEditable() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#removeActionActivationCode(java.lang.String)
- */
- @Override
- public void removeActionActivationCode( String actionId ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#resetHighlightRange()
- */
- @Override
- public void resetHighlightRange() {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#selectAndReveal(int, int)
- */
- @Override
- public void selectAndReveal( int offset, int length ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#setAction(java.lang.String, org.eclipse.jface.action.IAction)
- */
- @Override
- public void setAction( String actionID, IAction action ) {
- fDisassemblyPane.setAction( actionID, action );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#setActionActivationCode(java.lang.String, char, int, int)
- */
- @Override
- public void setActionActivationCode( String actionId, char activationCharacter, int activationKeyCode, int activationStateMask ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#setHighlightRange(int, int, boolean)
- */
- @Override
- public void setHighlightRange( int offset, int length, boolean moveCursor ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#showHighlightRangeOnly(boolean)
- */
- @Override
- public void showHighlightRangeOnly( boolean showHighlightRangeOnly ) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.ITextEditor#showsHighlightRangeOnly()
- */
- @Override
- public boolean showsHighlightRangeOnly() {
- // TODO Auto-generated method stub
- return false;
- }
-
- protected void createActions() {
- IVerticalRuler ruler = fDisassemblyPane.getVerticalRuler();
- IAction action= new ToggleBreakpointAction( this, null, ruler );
- setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action );
- action= new EnableDisableBreakpointRulerAction( this, ruler );
- setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action );
- action= new CBreakpointPropertiesRulerAction( this, ruler );
- setAction( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES, action );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- @Override
- public void propertyChange( PropertyChangeEvent event ) {
- getViewer().refresh();
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if (IDocument.class.equals(adapter)) {
- return getDocumentProvider().getDocument(getEditorInput());
- }
- return super.getAdapter(adapter);
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java
deleted file mode 100644
index 7a7c99325b1..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2012 QNX Software Systems 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.disassembly.rendering;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-
-/**
- * Annotation model for Disassembly view.
- */
-public class DisassemblyAnnotationModel extends AnnotationModel {
-
- private DisassemblyEditorInput fInput;
-
-// private IDocument fDisassemblyDocument;
-
- /**
- * Constructor for DisassemblyAnnotationModel.
- */
- public DisassemblyAnnotationModel() {
- super();
- }
-
- protected void breakpointsAdded( final IBreakpoint[] breakpoints, final IDocument document ) {
- DisassemblyEditorInput input = getInput();
- if ( DisassemblyEditorInput.EMPTY_EDITOR_INPUT.equals( input ) ||
- DisassemblyEditorInput.PENDING_EDITOR_INPUT.equals( input ) )
- return;
- asyncExec( new Runnable() {
- @Override
- public void run() {
- breakpointsAdded0( breakpoints, document );
- }
- } );
- }
-
- protected void breakpointsRemoved( final IBreakpoint[] breakpoints, final IDocument document ) {
- DisassemblyEditorInput input = getInput();
- if ( DisassemblyEditorInput.EMPTY_EDITOR_INPUT.equals( input ) ||
- DisassemblyEditorInput.PENDING_EDITOR_INPUT.equals( input ) )
- return;
- asyncExec( new Runnable() {
- @Override
- public void run() {
- breakpointsRemoved0( breakpoints, document );
- }
- } );
- }
-
- protected void breakpointsChanged( final IBreakpoint[] breakpoints, final IDocument document ) {
- DisassemblyEditorInput input = getInput();
- if ( DisassemblyEditorInput.EMPTY_EDITOR_INPUT.equals( input ) ||
- DisassemblyEditorInput.PENDING_EDITOR_INPUT.equals( input ) )
- return;
- asyncExec( new Runnable() {
- @Override
- public void run() {
- breakpointsChanged0( breakpoints, document );
- }
- } );
- }
-
- protected void breakpointsAdded0( IBreakpoint[] breakpoints, IDocument document ) {
- for ( int i = 0; i < breakpoints.length; ++i ) {
- if ( breakpoints[i] instanceof ICLineBreakpoint && isApplicable( breakpoints[i] ) ) {
- addBreakpointAnnotation( (ICLineBreakpoint)breakpoints[i], document );
- }
- }
- fireModelChanged();
- }
-
- protected void breakpointsRemoved0( IBreakpoint[] breakpoints, IDocument document ) {
- removeAnnotations( findAnnotationsforBreakpoints( breakpoints ), true, false );
- }
-
- protected void breakpointsChanged0( IBreakpoint[] breakpoints, IDocument document ) {
- List annotations = findAnnotationsforBreakpoints( breakpoints );
- List markers = new ArrayList( annotations.size() );
- Iterator it = annotations.iterator();
- while( it.hasNext() ) {
- MarkerAnnotation ma = (MarkerAnnotation)it.next();
- markers.add( ma.getMarker() );
- modifyAnnotationPosition( ma, getPosition( ma ), false );
- }
- for ( int i = 0; i < breakpoints.length; ++i ) {
- if ( breakpoints[i] instanceof ICLineBreakpoint && !markers.contains( breakpoints[i].getMarker() ) ) {
- addBreakpointAnnotation( (ICLineBreakpoint)breakpoints[i], document );
- }
- }
- fireModelChanged();
- }
-
- protected DisassemblyEditorInput getInput() {
- return this.fInput;
- }
-
- protected void setInput( DisassemblyEditorInput input, IDocument document ) {
- DisassemblyEditorInput oldInput = this.fInput;
- this.fInput = input;
- if ( this.fInput != null && !this.fInput.equals( oldInput ) )
- updateAnnotations( document );
- }
-
- private boolean isApplicable( IBreakpoint breakpoint ) {
- return true;
- }
-
- private void addBreakpointAnnotation( ICLineBreakpoint breakpoint, IDocument document ) {
- Position position = createBreakpointPosition( breakpoint, document );
- if ( position != null ) {
- try {
- addAnnotation( createMarkerAnnotation( breakpoint ), position, false );
- }
- catch( BadLocationException e ) {
- }
- }
- }
-
- private Position createBreakpointPosition( ICLineBreakpoint breakpoint, IDocument document ) {
- Position position = null;
- DisassemblyEditorInput input = getInput();
- if ( input != null ) {
- int start = -1;
- if ( document != null ) {
- int instrNumber = input.getInstructionLine( breakpoint );
- if ( instrNumber > 0 ) {
- try {
- start = fDocument.getLineOffset( instrNumber - 1 );
- if ( start > -1 ) {
- // Avoid the document boundaries; see bugzilla 178485
- int lineLen = document.getLineLength(instrNumber - 1);
- if (start == 0) {
- start++;
- lineLen--;
- }
- if (start + lineLen == document.getLength()) {
- lineLen--;
- }
- return new Position( start, lineLen );
- }
- }
- catch( BadLocationException e ) {
- }
- }
- }
- }
- return position;
- }
-
- private MarkerAnnotation createMarkerAnnotation( IBreakpoint breakpoint ) {
- return new MarkerAnnotation( breakpoint.getMarker() );
- }
-
- protected void dispose() {
- }
-
- private List findAnnotationsforBreakpoints( IBreakpoint[] breakpoints ) {
- List annotations = new LinkedList();
- Iterator it = getAnnotationIterator();
- while ( it.hasNext() ) {
- Annotation ann = (Annotation)it.next();
- if ( ann instanceof MarkerAnnotation ) {
- IMarker marker = ((MarkerAnnotation)ann).getMarker();
- if ( marker != null ) {
- for ( int i = 0; i < breakpoints.length; ++i ) {
- if ( marker.equals( breakpoints[i].getMarker() ) ) {
- annotations.add( ann );
- }
- }
- }
- }
- }
- return annotations;
- }
-
- private void asyncExec( Runnable r ) {
- Display display = Display.getDefault();
- if ( display != null )
- display.asyncExec( r );
- }
-
- private void updateAnnotations( final IDocument document ) {
- asyncExec( new Runnable() {
- @Override
- public void run() {
- doUpdateAnnotations( document );
- }
- } );
- }
-
- protected void doUpdateAnnotations( IDocument document ) {
- breakpointsAdded0( DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(), document );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java
deleted file mode 100644
index 7203b04cc7a..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2015 QNX Software Systems 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.disassembly.rendering;
-
-import java.util.Arrays;
-import org.eclipse.cdt.core.IAddress;
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.IAsmInstruction;
-import org.eclipse.cdt.debug.core.model.IAsmSourceLine;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICStackFrame;
-import org.eclipse.cdt.debug.core.model.IDisassembly;
-import org.eclipse.cdt.debug.core.model.IDisassemblyBlock;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Editor input associated with a debug element.
- */
-public class DisassemblyEditorInput implements IEditorInput {
-
- public static final IEditorInput EMPTY_EDITOR_INPUT = new DisassemblyEditorInput();
-
- public static final IEditorInput PENDING_EDITOR_INPUT =
- new DisassemblyEditorInput() {
- @Override
- public String getContents() {
- return DisassemblyMessages.getString( "DisassemblyDocumentProvider.Pending_1" ); //$NON-NLS-1$
- }
- };
-
- /**
- * Disassembly block associated with this editor input
- */
- private IDisassemblyBlock fBlock;
-
- private String fContents = ""; //$NON-NLS-1$
-
- private IRegion[] fSourceRegions = new IRegion[0];
-
- /**
- * Constructor for DisassemblyEditorInput.
- */
- protected DisassemblyEditorInput() {
- }
-
- /**
- * Constructor for DisassemblyEditorInput.
- *
- * @param disassembly
- * @param instructions
- */
- private DisassemblyEditorInput( IDisassemblyBlock block) {
- fBlock = block;
- createContents();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- @Override
- public boolean exists() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- @Override
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter( Class adapter ) {
- return null;
- }
-
- public boolean contains( ICStackFrame frame ) {
- if ( fBlock != null ) {
- return fBlock.contains( frame );
- }
- return false;
- }
-
- public String getContents() {
- return fContents;
- }
-
- public int getInstructionLine( IAddress address ) {
- if ( fBlock != null ) {
- IAsmSourceLine[] lines = fBlock.getSourceLines();
- int result = 0;
- for ( int i = 0; i < lines.length; ++i ) {
- IAsmInstruction[] instructions = lines[i].getInstructions();
- if ( fBlock.isMixedMode() )
- ++result;
- for ( int j = 0; j < instructions.length; ++j ) {
- ++result;
- if ( address.equals( instructions[j].getAdress() ) ) {
- return result;
- }
- }
- }
- }
- return -1;
- }
-
- public int getInstructionLine( ICLineBreakpoint breakpoint ) {
- if ( fBlock != null ) {
- IDisassembly dis = fBlock.getDisassembly();
- if ( dis != null ) {
- ICDebugTarget target = dis.getDebugTarget().getAdapter( ICDebugTarget.class );
- if ( target != null ) {
- try {
- IAddress address = target.getBreakpointAddress( breakpoint );
- if ( address != null && !address.isZero() )
- return getInstructionLine( address );
- }
- catch( DebugException e ) {
- }
- }
- }
- }
- return -1;
- }
-
- public IAddress getAddress( int lineNumber ) {
- if ( fBlock != null ) {
- IAsmSourceLine[] lines = fBlock.getSourceLines();
- int current = 0;
- for ( int i = 0; i < lines.length; ++i ) {
- IAsmInstruction[] instructions = lines[i].getInstructions();
- if ( fBlock.isMixedMode() ) {
- ++current;
- }
- if ( lineNumber == current && instructions.length > 0 )
- return instructions[0].getAdress();
- if ( lineNumber > current && lineNumber <= current + instructions.length )
- return instructions[lineNumber - current - 1].getAdress();
- current += instructions.length;
- }
- }
- return null;
- }
-
- public String getModuleFile() {
- return ( fBlock != null ) ? fBlock.getModuleFile() : null;
- }
-
- public String getSourceFile() {
- if ( fBlock != null ) {
- Object element = fBlock.getSourceElement();
- if ( element instanceof IFile ) {
- return ((IFile)element).getLocation().toOSString();
- }
- else if ( element instanceof IStorage ) {
- return ((IStorage)element).getFullPath().toOSString();
- }
- }
- return null;
- }
-
- public int getSourceLine( int instrNumber ) {
- if ( fBlock != null ) {
- IAsmSourceLine[] sl = fBlock.getSourceLines();
- int current = 0;
- for ( int i = 0; i < sl.length; ++i ) {
- ++current;
- IAsmInstruction[] ins = sl[i].getInstructions();
- if ( instrNumber >= current && instrNumber <= current + ins.length )
- return sl[i].getLineNumber();
- current += ins.length;
- }
- }
- return -1;
- }
-
- public static DisassemblyEditorInput create( ICStackFrame frame ) throws DebugException {
- DisassemblyEditorInput input = null;
- ICDebugTarget target = ((ICDebugTarget)frame.getDebugTarget());
- IDisassembly disassembly = target.getDisassembly();
- if ( disassembly != null ) {
- IDisassemblyBlock block = disassembly.getDisassemblyBlock( frame );
- input = new DisassemblyEditorInput( block);
- }
- return input;
- }
-
- public static DisassemblyEditorInput create( IDisassemblyBlock block) throws DebugException {
- return new DisassemblyEditorInput(block);
- }
- private void createContents() {
- fSourceRegions = new IRegion[0];
- StringBuffer lines = new StringBuffer();
- int maxFunctionName = 0;
- int maxOpcodeLength = 0;
- long maxOffset = 0;
- if ( fBlock != null ) {
- IAsmSourceLine[] mi = fBlock.getSourceLines();
- for ( int j = 0; j < mi.length; ++j ) {
- IAsmInstruction[] instructions = mi[j].getInstructions();
- for( int i = 0; i < instructions.length; ++i ) {
- String functionName = instructions[i].getFunctionName();
- if ( functionName.length() > maxFunctionName ) {
- maxFunctionName = functionName.length();
- }
- String opcode = instructions[i].getOpcode();
- if ( opcode.length() > maxOpcodeLength )
- maxOpcodeLength = opcode.length();
- long offset = Math.abs( instructions[i].getOffset() );
- if ( offset > maxOffset ) {
- maxOffset = offset;
- }
- }
- }
- int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset );
- int argPosition = instrPos + maxOpcodeLength + 1;
- if ( fBlock.isMixedMode() )
- fSourceRegions = new IRegion[mi.length];
- for ( int j = 0; j < mi.length; ++j ) {
- if ( fBlock.isMixedMode() ) {
- String sl = getSourceLineString( mi[j] );
- fSourceRegions[j] = new Region( lines.length(), sl.length() );
- lines.append( sl );
- }
- IAsmInstruction[] instructions = mi[j].getInstructions();
- for( int i = 0; i < instructions.length; ++i ) {
- lines.append( getInstructionString( instructions[i], instrPos, argPosition ) );
- }
- }
- }
- fContents = lines.toString();
- }
-
- private String getInstructionString( IAsmInstruction instruction, int instrPosition, int argPosition ) {
- int worstCaseSpace = Math.max( instrPosition, argPosition );
- char[] spaces = new char[worstCaseSpace];
- Arrays.fill( spaces, ' ' );
- StringBuffer sb = new StringBuffer();
- if ( instruction != null ) {
- sb.append( instruction.getAdress().toHexAddressString() );
- sb.append( ' ' );
- String functionName = instruction.getFunctionName();
- if ( functionName != null && functionName.length() > 0 ) {
- sb.append( '<' );
- sb.append( functionName );
- long offset = instruction.getOffset();
- if ( offset != 0 ) {
- if ( offset > 0 )
- sb.append( '+' );
- sb.append( instruction.getOffset() );
- }
- sb.append( ">:" ); //$NON-NLS-1$
- sb.append( spaces, 0, instrPosition - sb.length() );
- }
- sb.append( instruction.getOpcode() );
- sb.append( spaces, 0, argPosition - sb.length() );
- sb.append( instruction.getArguments() );
- sb.append( '\n' );
- }
- return sb.toString();
- }
-
- private int calculateInstructionPosition( int maxFunctionName, long maxOffset ) {
- //(Address prefix address representation in chars) + (space) + (<) + (+) + (>) + (:) + (space)
- int addressLength = getDisassembly().getAddressFactory().getMax().getCharsNum();
- return ( addressLength + 6 + maxFunctionName + Long.toString( maxOffset ).length() );
- }
-
- private String getSourceLineString( IAsmSourceLine line ) {
- String text = line.toString();
- if ( text == null ) {
- text = DisassemblyMessages.getString( "DisassemblyEditorInput.source_line_is_not_available_1" ) + '\n'; //$NON-NLS-1$
- }
- return text;
- }
-
- public IRegion[] getSourceRegions() {
- return this.fSourceRegions;
- }
-
- protected IDisassembly getDisassembly() {
- return ( fBlock != null ) ? fBlock.getDisassembly() : null;
- }
-
- /**
- * @return the disassembly block
- */
- public IDisassemblyBlock getDisassemblyBlock() {
- return fBlock;
- }
-
- public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException {
- Assert.isTrue( address != null );
- IDisassembly dis = getDisassembly();
- if ( dis != null ) {
- ICDebugTarget bt = dis.getDebugTarget().getAdapter( ICDebugTarget.class );
- if ( bt != null ) {
- String modelId = CDIDebugModel.getPluginIdentifier();
- IBreakpoint[] bps = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints( modelId );
- for ( int i = 0; i < bps.length; ++i ) {
- if ( bps[i] instanceof ICLineBreakpoint ) {
- ICLineBreakpoint b = (ICLineBreakpoint)bps[i];
- try {
- IAddress a = bt.getBreakpointAddress( b );
- if ( a != null && address.compareTo( a ) == 0 )
- return b;
- }
- catch( NumberFormatException e ) {
- }
- catch( CoreException e ) {
- }
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java
deleted file mode 100644
index 1e9f5176c59..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2015 ARM Limited 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:
- * ARM Limited - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.disassembly.rendering;
-
-import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument;
-import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualSourceViewer;
-import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class DisassemblyMemoryRendering extends AbstractMemoryRendering {
-
- protected SashForm fSashForm;
- protected DisassemblyPane fDisassemblyPane;
-
- public DisassemblyMemoryRendering( String renderingId ) {
- super( renderingId );
- fDisassemblyPane = new DisassemblyPane( "#DisassemblyRenderingContext", "#DisassemblyRenderingRulerContext" ); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public Control createControl( Composite parent ) {
- Composite composite = new Composite( parent, SWT.BORDER );
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- composite.setLayout( layout );
- composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
- createViewer( composite );
- return composite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.memory.IMemoryRendering#getControl()
- */
- @Override
- public Control getControl() {
- return fDisassemblyPane.getControl();
- }
-
- protected VirtualSourceViewer getViewer() {
- return fDisassemblyPane.getViewer();
- }
-
- protected void createViewer( final Composite parent ) {
- fSashForm = new SashForm( parent, SWT.VERTICAL );
- fSashForm.setLayoutData( new GridData( GridData.FILL_BOTH ) );
-
- fDisassemblyPane.create( fSashForm );
-
-// createGoToAddressComposite( fSashForm );
-// hideGotoAddressComposite();
-
- IMemoryBlock memoryBlock = getMemoryBlock();
- IDisassemblyContextProvider contextProvider = getDisassemblyContextProvider( memoryBlock );
- Object disassemblyContext = null;
- if ( contextProvider != null ) {
- disassemblyContext = contextProvider.getDisassemblyContext( memoryBlock );
- }
- DisassemblyAnnotationModel annotationModel = new DisassemblyAnnotationModel();
- VirtualDocument document = new VirtualDocument( annotationModel, getDocumentPresentationContext(), disassemblyContext );
- getViewer().setDocument( document );
- document.getContentProvider().changeInput( getViewer(), document.getPresentationContext(), null, getMemoryBlock(), document.getCurrentOffset() );
- }
-
- private IDocumentPresentation getDocumentPresentationContext() {
- return null;
- }
-
- private IDisassemblyContextProvider getDisassemblyContextProvider( Object element ) {
- IDisassemblyContextProvider adapter = null;
- if ( element instanceof IDisassemblyContextProvider ) {
- adapter = (IDisassemblyContextProvider)element;
- }
- else if ( element instanceof IAdaptable ) {
- IAdaptable adaptable = (IAdaptable)element;
- adapter = adaptable.getAdapter( IDisassemblyContextProvider.class );
- }
- return adapter;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java
deleted file mode 100644
index 2f57fa0728f..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.disassembly.rendering;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class DisassemblyMessages {
-
- private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
-
- private DisassemblyMessages() {
- }
-
- public static String getString( String key ) {
- try {
- return RESOURCE_BUNDLE.getString( key );
- }
- catch( MissingResourceException e ) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties
+++ /dev/null
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java
deleted file mode 100644
index fb31d63e89f..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2012 ARM Limited 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:
- * ARM Limited - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.disassembly.rendering;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate;
-
-public class DisassemblyRenderingTypeDelegate implements IMemoryRenderingTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate#createRendering(java.lang.String)
- */
- @Override
- public IMemoryRendering createRendering( String id ) throws CoreException {
- return new DisassemblyMemoryRendering( id );
- }
-}

Back to the top