Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8740d2998d72c84b08267b58b4609aaac5298c57 (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
/*******************************************************************************
 * Copyright (c) 2006, 2007 Wind River 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:
 *     Wind River Systems - initial API and implementation
 *     Ericsson AB - extended the API for IMemoryBlockExtension
 *     Ericsson AB - added support for 64 bit processors
 *******************************************************************************/
package org.eclipse.cdt.dsf.debug.service;

import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
import org.eclipse.cdt.dsf.service.IDsfService;
import org.eclipse.debug.core.model.MemoryByte;

/**
 * Service for accessing memory.  Memory contexts are not meant to be 
 * represented in tree or table views, so it doesn't need to implement
 * IDMService interface. 
 * 
 * @since 1.0
 */
public interface IMemory extends IDsfService {

    public interface IMemoryDMContext extends IDMContext {}

    /**
     * Event generated every time a range of bytes is modified.
     * 
     * A client wishing to receive such events has to register as a service
     * event listener and implement the corresponding eventDispatched method.
     * 
     * E.g.:
     *
     *   MyMemoryBlock(MIRunControl fRunControl)
     *   {
     *       ...
     *       fRunControl.getSession().addServiceEventListener(MyMemoryBlock.this, null);
     *       ...
     *   }
     *     
     *     @DsfServiceEventHandler
     *     public void eventDispatched(MemoryChangedEvent e) {
     *        IDMContext<?> context = e.getContext();
     *        IAddress[] addresses = e.getAddresses();
     *        // do whatever...
     *     }
     */
    public interface IMemoryChangedEvent extends IDMEvent<IMemoryDMContext> {
        IAddress[] getAddresses();
    }
    
    /**
     * Reads a memory block from the target.
     * 
     * An asynchronous memory read request at [address] + [offset] for
     * [count] memory items, each of size [word_size] bytes, will be
     * issued to the target. The result will be stored in [drm] upon
     * completion of the call.
     * 
     * The [drm] result buffer will be of size [word_size] * [count]. The
     * successfully read bytes will have their MemoryByte.READABLE flag
     * set while the bytes in error (unreachable/bad memory) will have their
     * flag byte set to 0. The bytes will respect the target "endianness".
     * 
     * @param context	the context of the target memory block
     * @param address	the memory block address (on the target)
     * @param offset	the offset from the start address
     * @param word_size	the size, in bytes, of an addressable item
     * @param count		the number of data elements to read
     * @param drm		the asynchronous data request monitor
     */
    public void getMemory(IMemoryDMContext context, IAddress address, long offset,
    		int word_size, int count, DataRequestMonitor<MemoryByte[]> drm);

    /**
     * Writes a memory block on the target.
     * 
     * An asynchronous memory write request at [address] + [offset] for
     * [count] * [word_size] bytes will be issued to the target.
     * 
     * The [buffer] must hold at least [count] * [word_size] bytes.
     * 
     * A MemoryChangedEvent will be generated for the range of addresses.
     * 
     * @param context	the context of the target memory block
     * @param address	the memory block address (on the target)
     * @param offset	the offset from the start address
     * @param word_size	the size, in bytes, of an addressable item
     * @param count		the number of data elements to write
     * @param buffer	the source buffer
     * @param rm		the asynchronous data request monitor
     */
    public void setMemory(IMemoryDMContext context, IAddress address, long offset,
    		int word_size, int count, byte[] buffer, RequestMonitor rm);

    /**
     * Writes [pattern] at memory [address] + [offset], [count] times.
     * 
     * A MemoryChangedEvent will be generated for the range of addresses.
     * 
     * @param context	the context of the target memory block
     * @param address	the memory block address (on the target)
     * @param offset	the offset from the start address
     * @param word_size	the size, in bytes, of an addressable item
     * @param count		the number of times [pattern] will be written
     * @param pattern	the source buffer
     * @param rm		the asynchronous data request monitor
     */
    public void fillMemory(IMemoryDMContext context, IAddress address, long offset,
    		int word_size, int count, byte[] pattern, RequestMonitor rm);

}

Back to the top