Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fb7873a0b5e96be52177ce6c7761793680a48f62 (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
/*******************************************************************************
 * Copyright (c) 2000, 2004 QNX Software Systems and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     QNX Software Systems - Initial API and implementation
 *******************************************************************************/

package org.eclipse.cdt.debug.core.cdi.model;

import java.math.BigInteger;

import org.eclipse.cdt.debug.core.cdi.CDIException;

/**
 * 
 * A contiguous segment of memory in an execution context. A memory
 * block is represented by a starting memory address and a length.
 * 
 * @since Jul 18, 2002
 */
public interface ICDIMemoryBlock extends ICDIObject {

    /**
     * Bit mask used to indicate a byte is read-only.
     */
	public static final byte READ_ONLY	= 0x01;

	/**
	 * Bit mask used to indicate a byte is valid.
	 */
	public static final byte VALID	= 0x02;

	/**
	 * Returns the start address of this memory block.
	 * 
	 * @return the start address of this memory block
	 */
	BigInteger getStartAddress();
	
	/**
	 * Returns the length of this memory block in bytes.
	 * 
	 * @return the length of this memory block in bytes
	 */	
	long getLength();

	/**
	 * @return The size of each memory word in bytes.
	 */
	int getWordSize();

	/**
	 * Returns the values of the bytes currently contained
	 * in this this memory block.
	 * Note: the number maybe greater or lower to what
	 * was requested.
	 * @return the values of the bytes currently contained
	 *  in this this memory block
	 * @exception CDIException if this method fails.  Reasons include:
	 * <ul><li>Failure communicating with the debug target.  The CDIException's
	 * status code contains the underlying exception responsible for
	 * the failure.</li>
	 * </ul>
	 */	
	byte[] getBytes() throws CDIException;

	/**
	 * Returns this memory byte's attribute as a bit mask.
	 * The method throw IndexOutOfBoundsException if the offset
	 * is out of range of the block.
	 * 
	 * @return this memory byte's attribute as a bit mask
	 */
	public byte getFlags(int offset);

	/**
	 * Sets the value of the bytes in this memory block at the specified
	 * offset within this memory block to the spcified bytes.
	 * The offset is zero based.
	 * 
	 * @param offset the offset at which to set the new values
	 * @param bytes the new values
	 * @exception CDIException if this method fails.  Reasons include:
	 * <ul><li>Failure communicating with the debug target.  The CDIException's
	 * status code contains the underlying exception responsible for
	 * the failure.</li>
	 * <li>This memory block does not support value modification</li>
	 * <li>The specified offset is greater than or equal to the length
	 *   of this memory block, or the number of bytes specified goes
	 *   beyond the end of this memory block (index of out of range)</li>
	 * </ul>
	 */
	void setValue(long offset, byte[] bytes) throws CDIException;

	/**
	 * @return true if the block does not update.
	 */
	boolean isFrozen();

	/**
	 * A memoryBlock set frozen means that the block will
	 * not update and check for new data.
	 * @param frozen the block is frozen by default.
	 */
	void setFrozen(boolean frozen);

	/**
	 * Refresh the data, this may cause events to be trigger
	 * if the data values changed.
	 */
	void refresh() throws CDIException;

}

Back to the top