Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3646c6d6abd2e188c54923f4773212bf988cf875 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*******************************************************************************
 * Copyright (c) 2014 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
 *******************************************************************************/
package org.eclipse.tcf.services;

import java.util.Map;

import org.eclipse.tcf.protocol.IService;
import org.eclipse.tcf.protocol.IToken;

/**
 * IMemoryMap service provides information about executable modules (files) mapped (loaded) into target memory.
 *
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IMemoryMap extends IService {

    static final String NAME = "MemoryMap";

    /**
     * Memory region property names.
     */
    static final String
        /** String, memory region ID */
        PROP_ID = "ID",

        /** String, memory region context query, see IContextQuery */
        PROP_CONTEXT_QUERY = "ContextQuery",

        /** Number, region address in memory */
        PROP_ADDRESS = "Addr",

        /** Number, region size */
        PROP_SIZE = "Size",

        /** Number, region offset in the file */
        PROP_OFFSET = "Offs",

        /** Boolean, true if the region represents BSS */
        PROP_BSS = "BSS",

        /** Object, Operation System Awareness properties */
        PROP_OSA = "OSA",

        /** Number, region memory protection flags, see FLAG_* */
        PROP_FLAGS = "Flags",

        /** String, name of the file */
        PROP_FILE_NAME = "FileName",

        /** String, name of the object file section */
        PROP_SECTION_NAME = "SectionName";

    /**
     * Memory region flags.
     */
    static final int
        /** Read access is allowed */
        FLAG_READ = 1,

        /** Write access is allowed */
        FLAG_WRITE = 2,

        /** Instruction fetch access is allowed */
        FLAG_EXECUTE = 4;

    /**
     * Memory region interface.
     */
    interface MemoryRegion {

        /**
         * Get region properties. See PROP_* definitions for property names.
         * Properties are read only, clients should not try to modify them.
         * @return Map of region properties.
         */
        Map<String,Object> getProperties();

        /**
         * Get memory region address.
         * Same as getProperties().get(PROP_ADDRESS)
         * @return region address.
         */
        Number getAddress();

        /**
         * Get memory region size.
         * Same as getProperties().get(PROP_SIZE)
         * @return region size.
         */
        Number getSize();

        /**
         * Get memory region file offset.
         * Same as getProperties().get(PROP_OFFSET)
         * @return file offset.
         */
        Number getOffset();

        /**
         * Check if the region represents BSS - data segment containing
         * statically-allocated variables represented solely by zero-valued bits initially.
         * Memory for BSS segments is not backed by a file contents.
         * Same as getProperties().get(PROP_BSS)
         * @return file offset.
         */
        boolean isBSS();

        /**
         * Get memory region flags.
         * Same as getProperties().get(PROP_FLAGS)
         * @return region flags.
         */
        int getFlags();

        /**
         * Get memory region file name.
         * Same as getProperties().get(PROP_FILE_NAME)
         * @return file name.
         */
        String getFileName();

        /**
         * Get memory region section name.
         * Same as getProperties().get(PROP_SECTION_NAME)
         * @return section name.
         */
        String getSectionName();

        /**
         * Get context query that defines scope of the region, see also IContextQuery.
         * Same as getProperties().get(PROP_CONTEXT_QUERY)
         * Only user-defined regions can have a context query property.
         * @return context query expression, or null.
         */
        String getContextQuery();
    }

    /**
     * Retrieve memory map for given context ID.
     *
     * @param id - context ID.
     * @param done - call back interface called when operation is completed.
     * @return - pending command handle.
     */
    IToken get(String id, DoneGet done);

    /**
     * Client call back interface for get().
     */
    interface DoneGet {
        /**
         * Called when memory map data retrieval is done.
         * @param error - error description if operation failed, null if succeeded.
         * @param map - memory map data.
         */
        void doneGet(IToken token, Exception error, MemoryRegion[] map);
    }

    /**
     * Set memory map for given context.
     * 'id' can be null, in such case scope of each memory region is
     * defined by its ContextQuery property.
     *
     * Using non-null 'id' is deprecated - use ContextQuery instead.
     *
     * @param id - symbols context group ID or name.
     * @param map - memory map data.
     * @param done - call back interface called when operation is completed.
     * @return - pending command handle.
     */
    IToken set(String id, MemoryRegion[] map, DoneSet done);

    /**
     * Client call back interface for set().
     */
    interface DoneSet {
        /**
         * Called when memory map set command is done.
         * @param error - error description if operation failed, null if succeeded.
         */
        void doneSet(IToken token, Exception error);
    }

    /**
     * Add memory map event listener.
     * @param listener - memory map event listener to add.
     */
    void addListener(MemoryMapListener listener);

    /**
     * Remove memory map event listener.
     * @param listener - memory map event listener to remove.
     */
    void removeListener(MemoryMapListener listener);

    /**
     * Service events listener interface.
     */
    interface MemoryMapListener {

        /**
         * Called when context memory map changes.
         * @param context_id - context ID.
         */
        void changed(String context_id);
    }
}

Back to the top