Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: aa417dbc04436f2be318ced3c7bf85d7b07476f4 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*******************************************************************************
 * Copyright (c) 2004 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.core.model;

import java.math.BigInteger;

import org.eclipse.debug.core.DebugException;

/**
 * Represents a memory block.
 * 
 * When the memory block is changed, fire a CHANGE Debug Event.
 * 
 *  When firing change event, be aware of the following:
 *  - whenever a change event is fired, the content provider for Memory View / Memory Rendering
 *    view checks to see if memory has actually changed.  
 *  - If memory has actually changed, a refresh will commence.  Changes to the memory block
 *    will be computed and will be shown with the delta icons.
 *  - If memory has not changed, content will not be refreshed.  However, previous delta information 
 * 	  will be erased.  The screen will be refreshed to show that no memory has been changed.  (All
 *    delta icons will be removed.)
 * 
 * Please note that these APIs will be called multiple times by the Memory View.
 * To improve performance, debug adapters need to cache the content of its memory block and only
 * retrieve updated data when necessary.
 * @since 3.1
 */
public interface IMemoryBlockExtension extends IMemoryBlock {
	
	/**
	 * Returns the expression of this memory block.
	 * The expression will be used to construct the tab label of the memory view.
	 *
	 * @return expression of the memory block.
	 * @exception DebugException if this method fails.  Reasons include:
	 * <ul><li>Failure communicating with the engine.  The DebugException's
	 * status code contains the underlying exception responsible for
	 * the failure.</li>
	 */
	public String getExpression() throws DebugException;	
	
	/**
	 * Get the base address of this memory block in BigInteger
	 * @return the base address of this memory block
	 */
	public BigInteger getBigBaseAddress();
	
	/**
	 * @return address size in number of bytes
	 */
	public int getAddressSize();
	
	
	/**
	 * Indicate if the base address of this memory block block could be modified
	 * If return true, setBaseAddress will be used to change the base address
	 * of this memory block.
	 * * @return if the memory block supports base address modification
	 */
	public boolean supportBaseAddressModification();
	
	/**
	 * @return true to indicate that the memory block manages the changes in the
	 * memory block.  If the memory block manages changes, the memory block is
	 * expected to cache the MemoryByte array returned by getBytesFromOffset and
	 * getBytesFromAddress.  The change information will not be calculated by
	 * the memory view.  Intead, the memory block keeps track of the bytes
	 * and marks the bytes as changed/unchanged.  Turn off both the CHANGE and UNCHANGED
	 * bits if the memory block does not contain history for the address.
	 * 
	 * If this function returns false, the Memory View will calculate
	 * delta information for each byte based on its history.
	 */
	public boolean supportsChangeManagement();
	
	/**
	 * Set the base address of this memory block
	 * @param address
	 * @throws DebugException if the method fails.  Reasons inlucde:
	 * <ul><li>Failure communicating with the engine.  The DebugException's
	 * status code contains the underlying exception responsible for
	 * the failure.</li>
	 */
	public void setBaseAddress(BigInteger address) throws DebugException;

	
	/**
	 * Get bytes based on offset and length.  Memory at base address + offset 
	 * should be returned.
	 * Return an array of IMemory.  Each IMemory object represents a section of the
	 * memory block.  The IMemory object allows debug adapters to provide more information
	 * about a section of memory.  Refer to IMemory for details. 
	 * 
	 * @param offset
	 * @param length is the number of units of memory to return 
	 * @return an array of bytes from the memory block based on the given offset and length
	 * The size of the array returned needs to be equal to 
	 * length * IMemoryBlockExtensionRetrieval.getAddressibleSize()
	 * @throws DebugException if the method fails.
	 */
	public MemoryByte[] getBytesFromOffset(long offset, long length) throws DebugException;
	
	
	/**
	 * Get bytes based on a given address.  
	 * 
	 * Return an array of IMemory.  Each IMemory object represents a section of the
	 * memory block.  The IMemory object allows debug adapters to provide more information
	 * about a section of memory.  Refer to IMemory for details. 
	 * 
	 * @param address
	 * @param length is the number of units of memory to return 
	 * @return an array of bytes from the memory block based on the given offset and length
	 * The size of the array returned needs to be equal to 
	 * length * IMemoryBlockExtensionRetrieval.getAddressibleSize()
	 * @throws DebugException if method fails
	 */
	public MemoryByte[] getBytesFromAddress(BigInteger address, long length) throws DebugException;	

	/**
	 * @return true if the platform is big endian, false otherwise
	 */
	public boolean isBigEndian();

	
	/**
	 * Connect a view to the memory block. Called by UI when a view that displays
	 * the memory block is visible.
	 * @param object 
	 */
	public void connect(Object object);
	
	
	/**
	 * Disconnect a view from the memory block. Called by UI when a view
	 * that displays the memory block is hidden.
	 * @param object 
	 */
	public void disconnect(Object object);
	
	/**
	 * @return objects that are currently connected to the memory block.
	 * Return an empty array if nothing is connected
	 */
	public Object[] getConnected();
	
	
	/**
	 * Dispose this memory block.
	 */
	public void dispose();
	
	/**
	 * @return the IMemoryBlockRetrieval responsible for creating this memory block
	 */
	public IMemoryBlockRetrieval getMemoryBlockRetrieval();
	
	/**
	 * @return addssible size in number of bytes
	 */
	int getAddressibleSize();
}

Back to the top