Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f4e3e3965856fdbbad22d5305489eae439c019a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2011, 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 329682
 *     Patrick Chuong (Texas Instruments) - Bug 353351
 *     Patrick Chuong (Texas Instruments) - Bug 364405
 *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;

import java.math.BigInteger;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.text.source.IAnnotationModel;

public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {

	protected IDisassemblyPartCallback fCallback;

	protected AbstractDisassemblyBackend() {
	}

	public void init(IDisassemblyPartCallback callback) {
		assert callback != null;
		fCallback = callback;
	}

	/**
	 * Evaluate the expression to an address. This might be the address of a symbol or
	 * the value of the numeric evaluation depending on the type of the expression.
	 *
	 * @param expression the expression
	 * @param suppressError <code>true</code> to suppress error dialogs
	 * @return the address or <code>null</code> if the expression could not be evaluated
	 * @since 7.0
	 */
	public abstract BigInteger evaluateAddressExpression(String expression, boolean suppressError);


	public String evaluateRegister(String register) {
		return null;
	}

    public String getHoverInfoData(AddressRangePosition pos, String ident) {
    	return null;
	}

	/**
	 * Default error handler, sub-class can override this method to provide it's own error handling.
	 *  
	 * @param status
	 */
	protected void handleError(final IStatus status) {
		fCallback.asyncExec(new Runnable() {
			@Override
			public void run() {
				ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, status); //$NON-NLS-1$
			}
		});				
	}

	/**
	 * Do nothing, sub-class can override to update PC annotation.
	 */
	public void updateExtendedPCAnnotation(IAnnotationModel model) {
	}
}

Back to the top