Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d530c7a4f39651c253bc06611535eba650cb478c (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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>Target Communication Framework Services - Memory</title>
</head>

<body lang='EN-US'>

<h1>Target Communication Framework Services - Memory</h1>

<ul>
    <li><a href='#VersionHistory'>Version History</a>
    <li><a href='#Overview'>Overview</a>
    <li><a href='#Cmds'>Commands</a>
    <ul>
        <li><a href='#CmdGetContext'>Get Context</a>
        <li><a href='#CmdGetChildren'>Get Children</a>
        <li><a href='#CmdSetMemory'>Set Memory</a>
        <li><a href='#CmdGetMemory'>Get Memory</a>
        <li><a href='#CmdFillMemory'>Fill Memory</a>
    </ul>
    <li><a href='#Events'>Events</a>
    <li><a href='#API'>API</a>
</ul>

<h1>Memory Service</h1>

<h2><a name='VersionHistory'>Version History</a></h2>

<table border=1 cellpadding=8>
    <tr>
        <th>Version
        <th>Date
        <th>Change
    <tr>
        <td>0.1
        <td>2008-01-10
        <td>Initial contribution
    <tr>
        <td>1.0
        <td>2008-05-06
        <td>Approved
    <tr>
        <td>1.1
        <td>2009-03-16
        <td>Added context properties
</table>

<h2><a name='Overview'>Overview</a></h2>

<p>The service provides basic operations to read/write memory on a target. Command
and event parameters are encoded as zero terminated <a href='TCF JSON.html'>JSON</a> strings.</p>

<p>The service uses standard format for error reports,
see <a href='TCF Error Report Format.html'>Error Report Format</a>.</p>

<p>A single memory access can succeed for some addresses and fail for others. In such
situation result message can contain partially valid data. Array of error addresses,
in addition to error report, describes data validity on per byte basis:</p>

<pre><b><font face="Courier New" size=2 color=#333399>
<i>&lt;array of error addresses&gt;</i>
    &rArr; null
    &rArr; [ <i>&lt;error address list&gt;</i> ]

<i>&lt;error address list&gt;</i>
    &rArr; <i>&lt;error address&gt;</i>
    &rArr; <i>&lt;error address list&gt;</i> , <i>&lt;error address&gt;</i>

<i>&lt;error address&gt;</i>
    &rArr; { "addr" : <i>&lt;int: range starting address&gt;</i> , "size" : <i>&lt;int: range length in bytes&gt;</i> , "stat" : <i>&lt;int: status code&gt;</i> , "msg" : <i>&lt;object: error description&gt;</i> }
</font></b></pre>

<p>If there is no entry in error addresses array for a data byte, then status of such
byte is defined by main error report.</p>

<p>Status code is bitwise or of status flags:</p>
<dl>
    <dt><code><b>BYTE_VALID        = 0x00</b></code> <dd>no error for this byte
    <dt><code><b>BYTE_UNKNOWN      = 0x01</b></code> <dd>status is unknown
    <dt><code><b>BYTE_INVALID      = 0x02</b></code> <dd>byte value in invalid, error message describes the problem
    <dt><code><b>BYTE_CANNOT_READ  = 0x04</b></code> <dd>cannot read the byte
    <dt><code><b>BYTE_CANNOT_WRITE = 0x08</b></code> <dd>cannot write the byte
</dl>

<h2><a name='Cmds'>Commands</a></h2>

<h3><a name='CmdGetContext'>Get Context</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; <i>&lt;token&gt;</i> &bull; Memory &bull; getContext &bull; <i>&lt;string: context ID&gt;</i> &bull;
</font></b></pre>

<p>The command retrieves context info for given context ID. A context corresponds to an
execution thread, process, address space, etc. Exact
meaning of a context depends on the target. Target agent should define contexts hierarchy
that is:</p>

<ul type='disc'>
    <li>Sufficient to resolve possible ambiguity of a memory address;

    <li>Adequately reflects target memory management strategy;

    <li>Intuitive to a user.
</ul>

<p>For traditional OS, like UNIX, memory access context can be one of:</p>

<ul type='disc'>
    <li>Kernel address space;

    <li>A process.
</ul>

<p>Reply:</p>

<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;context data&gt;</i> &bull;

<i>&lt;context data&gt;</i>
    &rArr; null
    &rArr; <i>&lt;object&gt;</i>
</font></b></pre>

<p>Context data object should, at least, contain member
<b><font face="Courier New" size=2 color=#333399>"ID" : <i>&lt;string&gt;.</i></font></b>
Context data is expected to be cached by clients.
Service sends contextChanged event to notify changes in context data.</p>

<p>Predefined memory context properties are:</p>
<ul>
    <li><code><b><font face="Courier New" size=2 color=#333399>"ID" : <i>&lt;string&gt;</i></font></b></code>
    - ID of the context, same as getContext command argument.

    <li><code><b><font face="Courier New" size=2 color=#333399>"ParentID" : <i>&lt;string&gt;</i></font></b></code>
    - ID of a parent context.

    <li><code><b><font face="Courier New" size=2 color=#333399>"ProcessID" : <i>&lt;string&gt;</i></font></b></code>
    - process ID.

    <li><code><b><font face="Courier New" size=2 color=#333399>"BigEndian" : <i>&lt;boolean&gt;</i></font></b></code>
    - true if memory is big-endian.

    <li><code><b><font face="Courier New" size=2 color=#333399>"AddressSize" : <i>&lt;int&gt;</i></font></b></code>
    - size of memory address in bytes.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Name" : <i>&lt;string&gt;</i></font></b></code>
    - name of the context, can be used for UI purposes.

    <li><code><b><font face="Courier New" size=2 color=#333399>"StartBound" : <i>&lt;int&gt;</i></font></b></code>
    - lowest address (inclusive) which is valid for the context.

    <li><code><b><font face="Courier New" size=2 color=#333399>"EndBound" : <i>&lt;int&gt;</i></font></b></code>
    - highest address (inclusive) which is valid for the context.

    <li><code><b><font face="Courier New" size=2 color=#333399>"AccessTypes" : <i>&lt;array of strings&gt;</i></font></b></code>
    - Defines the access types allowed for this context.
        <p>Target system can support multiple different memory access types, like instruction and data access.
    Different access types can use different logic for address translation and memory mapping, so they can
    end up accessing different data bits, even if address is the same.
    Each distinct access type should be represented by separate memory context.
    A memory context can represent multiple access types if they are equivalent - all access same memory bits.
    Same data bits can be exposed through multiple memory contexts.</p>

    <p>Predefined access types are:</p>
    <ul>
        <li><code><b><font face="Courier New" size=2 color=#333399>"instruction"</font></b></code>
        - Context represent instructions fetch access.

        <li><code><b><font face="Courier New" size=2 color=#333399>"data"</font></b></code>
        - Context represents data access.

        <li><code><b><font face="Courier New" size=2 color=#333399>"io"</font></b></code>
        - Context represents IO peripherals.

        <li><code><b><font face="Courier New" size=2 color=#333399>"user"</font></b></code>
        - Context represents a user (e.g. application running in Linux) view to memory.

        <li><code><b><font face="Courier New" size=2 color=#333399>"supervisor"</font></b></code>
        - Context represents a supervisor (e.g. Linux kernel) view to memory.

        <li><code><b><font face="Courier New" size=2 color=#333399>"hypervisor"</font></b></code>
        - Context represents a hypervisor view to memory.

        <li><code><b><font face="Courier New" size=2 color=#333399>"virtual"</font></b></code>
        - Context uses virtual addresses.

        <li><code><b><font face="Courier New" size=2 color=#333399>"physical"</font></b></code>
        - Context uses physical addresses.

        <li><code><b><font face="Courier New" size=2 color=#333399>"cache"</font></b></code>
        - Context is a cache.

        <li><code><b><font face="Courier New" size=2 color=#333399>"tlb"</font></b></code>
        - Context is a TLB memory.
    </ul>
</ul>

<h3><a name='CmdGetChildren'>Get Children</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; <i>&lt;token&gt;</i> &bull; Memory &bull; getChildren &bull; <i>&lt;string: parent context ID&gt;</i> &bull;
</font></b></pre>

<p>The command requests a list of contexts available for memory access commands.</p>

<p>Parent context ID can be null &ndash; to retrieve top level of the hierarchy, can be one
of context IDs retrieved by previous getChildren commands, or it can be obtained from another service.
Contexts hierarchy can be simple plain list or it can form a tree. It is up to target agent developers to
choose layout that is most descriptive for a given target.</p>

<p>Reply:</p>

<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;array of context IDs&gt;</i> &bull;<i></i>

<i>&lt;array of context IDs&gt;</i>
    &rArr; null
    &rArr; [ ]
    &rArr; [ <i>&lt;context ID list&gt;</i> ]

<i>&lt;context ID list&gt;</i>
    &rArr; <i>&lt;string: context ID&gt;</i>
    &rArr; <i>&lt;context ID list&gt;</i> , <i>&lt;string: context ID&gt;</i>

</font></b></pre>

<h3><a name='CmdSetMemory'>Set Memory</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; &lt;token&gt; &bull; Memory &bull; set &bull;
    <i>&lt;string: context ID&gt;</i> &bull; <i>&lt;int: address&gt;</i> &bull; <i>&lt;int: word size&gt;</i> &bull;
    <i>&lt;int: byte count&gt;</i> &bull; <i>&lt;int: mode&gt;</i> &bull; <i>&lt;string: BASE64 encoded byte array&gt;</i> &bull;
</font></b></pre>

<p>Writes data bytes at given address in memory, "word size" bytes at a time. Address
should be aligned by "word size". Context ID must be one returned by getContexts.
Mode is logical OR of any combination of:</p>

<ul type='disc'>
    <li>0x1 &ndash; continue on error (like bus error or page fault)

    <li>0x2 &ndash; verify data after writing by reading back and compare
</ul>

<p>Result message:</p>

<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;array of error addresses&gt;</i> &bull;
</font></b></pre>

<p>Error report provides integer error code and a short, human readable explanation
of error. Error addresses, when present, let client know which bytes of data failed
to be written into memory.</p>

<h3><a name='CmdGetMemory'>Get Memory</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; &lt;token&gt; &bull; Memory &bull; get &bull;
    <i>&lt;string: context ID&gt;</i> &bull; <i>&lt;int: address&gt;</i> &bull; <i>&lt;int: word size&gt;</i> &bull;
    <i>&lt;int: byte count&gt;</i> &bull; <i>&lt;int: mode&gt;</i> &bull;
</font></b></pre>

<p>Reads data bytes at given address in memory, "word size" bytes at a time. Address
should be aligned by "word size". Context ID must be one returned by getContexts.
Mode is logical OR of any combination of:</p>

<ul type='disc'>
    <li>0x1 &ndash; continue on error (like bus error or page fault)

    <li>0x2 &ndash; verify data after reading by re-reading and compare
</ul>

<p>Result message:</p>

<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;string: BASE64 encoded byte array&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;array of error addresses&gt;</i> &bull;
</font></b></pre>

<p>Error report provides integer error code and a short, human readable explanation
of error. Error addresses, when present, let client know which bytes of data failed
to be retrieved from memory.</p>

<h3><a name='CmdFillMemory'>Fill Memory</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; &lt;token&gt; &bull; Memory &bull; fill &bull;
    <i>&lt;string: context ID&gt;</i> &bull; <i>&lt;int: address&gt;</i> &bull; <i>&lt;int: word size&gt;</i> &bull;
    &lt;int: byte count&gt; &bull; <i>&lt;int: mode&gt;</i> &bull; <i>&lt;array: array of pattern bytes&gt;</i> &bull;
</font></b></pre>

<p>Writes pattern bytes at given address in memory, "word size" bytes at a time. Address
should be aligned by "word size". If "byte count" is bigger then pattern size, then
pattern is repeated necessary number of times. Context ID must be one returned by
getContexts. Mode is logical OR of any combination of:</p>

<ul type='disc'>
    <li>0x1 &ndash; continue on error (like bus error or page fault)

    <li>0x2 &ndash; verify data after writing by reading back and compare
</ul>

<p>Result message:</p>

<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;array of error addresses&gt;</i> &bull;
</font></b></pre>

<p>Error report provides integer error code and a short, human readable explanation
of error. Error addresses, when present, let client know which bytes of data failed
to be written into memory.</p>

<h2><a name='Events'>Events</a></h2>

<p>Memory service broadcasts notification events when memory contexts are added, removed
or changed, and when memory content is altered by "set" or "fill" commands.</p>

<pre><b><font face="Courier New" size=2 color=#333399>
E &bull; Memory &bull; contextAdded &bull; <i>&lt;array of context data&gt;</i> &bull;
E &bull; Memory &bull; contextChanged &bull; <i>&lt;array of context data&gt;</i> &bull;
E &bull; Memory &bull; contextRemoved &bull; <i>&lt;array of context IDs&gt;</i> &bull;
E &bull; Memory &bull; memoryChanged &bull; <i>&lt;string: context ID&gt;</i> &bull; <i>&lt;array of address ranges&gt;</i> &bull;

<i>&lt;array of context data&gt;</i> <font face="Times New Roman" size=3>- see Get Contexts command.</font>

<i>&lt;array of context IDs&gt;</i>
    &rArr; [ <i>&lt;context ID list&gt;</i> ]

<i>&lt;context ID list&gt;</i>
    &rArr; <i>&lt;string: context ID&gt;</i>
    &rArr; <i>&lt;context ID list&gt;</i> , <i>&lt;string: context ID&gt;</i>

<i>&lt;array of address ranges&gt;</i>
    &rArr; null
    &rArr; [ <i>&lt;address ranges list&gt;</i> ]

<i>&lt;address ranges list&gt;</i>
    &rArr; <i>&lt;address range&gt;</i>
    &rArr; <i>&lt;address ranges list&gt;</i> , <i>&lt;address range&gt;</i>

<i>&lt;address range&gt;</i>
    &rArr; { "addr" : <i>&lt;int: range starting address&gt;</i> , "size" : <i>&lt;int: range length in bytes&gt;</i> }
</font></b></pre>

<h2><a name='API'>API</a></h2>

<pre>
<font color=#3F5FBF>/**
 * IMemory service provides basic operations to read/write memory on a target.
 *
 * The service represents memory addresses in number of bytes, regardless of actual addressable unit size.
 * Clients can translate between byte and word addresses using value of "AddressableUnitSize".
 * Byte is 8 bits.
 *
 * <font color=#7F9FBF>@noimplement</font> This interface is not intended to be implemented by clients.
 */</font>
<font color=#7F0055>public interface</font> IMemory <font color=#7F0055>extends</font> IService {

    <font color=#3F5FBF>/**
     * This service name, as it appears on the wire - a TCF name of the service.
     */</font>
    <font color=#7F0055>static final</font> String NAME = "Memory";

    <font color=#3F5FBF>/**
     * Context property names.
     */</font>
    <font color=#7F0055>static final</font> String
        PROP_ID = "ID",                         <font color=#3F5FBF>/** String, ID of the context, same as getContext command argument */</font>
        PROP_PARENT_ID = "ParentID",            <font color=#3F5FBF>/** String, ID of a parent context */</font>
        PROP_PROCESS_ID = "ProcessID",          <font color=#3F5FBF>/** String, process ID, see Processes service */</font>
        PROP_BIG_ENDIAN = "BigEndian",          <font color=#3F5FBF>/** Boolean, true if memory is big-endian */</font>
        PROP_ADDRESS_SIZE = "AddressSize",      <font color=#3F5FBF>/** Number, size of memory address in bytes */</font>
        PROP_NAME = "Name",                     <font color=#3F5FBF>/** String, name of the context, can be used for UI purposes */</font>
        PROP_START_BOUND = "StartBound",        <font color=#3F5FBF>/** Number, lowest address (inclusive) which is valid for the context */</font>
        PROP_END_BOUND = "EndBound",            <font color=#3F5FBF>/** Number, highest address (inclusive) which is valid for the context */</font>
        PROP_ACCESS_TYPES = "AccessTypes";      <font color=#3F5FBF>/** Array of String, the access types allowed for this context */</font>
    <font color=#3F5FBF>/** <font color=#7F9FBF>@since</font> 1.3*/
    <font color=#7F0055>static final</font> String
        PROP_ADDRESSABLE_UNIT_SIZE = "AddressableUnitSize", <font color=#3F5FBF>/** Number, addressable unit size in number of bytes */</font>
        PROP_DEFAULT_WORD_SIZE = "DefaultWordSize"; <font color=#3F5FBF>/** Number, default word size in number of bytes */</font>

    <font color=#3F5FBF>/**
     * Values of "AccessTypes".
     * Target system can support multiple different memory access types, like instruction and data access.
     * Different access types can use different logic for address translation and memory mapping, so they can
     * end up accessing different data bits, even if address is the same.
     * Each distinct access type should be represented by separate memory context.
     * A memory context can represent multiple access types if they are equivalent - all access same memory bits.
     * Same data bits can be exposed through multiple memory contexts.
     */</font>
    <font color=#7F0055>static final</font> String
        ACCESS_INSTRUCTION = "instruction",     <font color=#3F5FBF>/** Context represent instructions fetch access */</font>
        ACCESS_DATA = "data",                   <font color=#3F5FBF>/** Context represents data access */</font>
        ACCESS_IO = "io",                       <font color=#3F5FBF>/** Context represents IO peripherals */</font>
        ACCESS_USER = "user",                   <font color=#3F5FBF>/** Context represents a user (e.g. application running in Linux) view to memory */</font>
        ACCESS_SUPERVISOR = "supervisor",       <font color=#3F5FBF>/** Context represents a supervisor (e.g. Linux kernel) view to memory */</font>
        ACCESS_HYPERVISOR = "hypervisor",       <font color=#3F5FBF>/** Context represents a hypervisor view to memory */</font>
        ACCESS_VIRTUAL = "virtual",             <font color=#3F5FBF>/** Context uses virtual addresses */</font>
        ACCESS_PHYSICAL = "physical",           <font color=#3F5FBF>/** Context uses physical addresses */</font>
        ACCESS_CACHE = "cache",                 <font color=#3F5FBF>/** Context is a cache */</font>
        ACCESS_TLB = "tlb";                     <font color=#3F5FBF>/** Context is a TLB memory */</font>

    <font color=#3F5FBF>/**
     * Retrieve context info for given context ID.
     *
     * <font color=#7F9FBF>@param</font> id - context ID.
     * <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
     * <font color=#7F9FBF>@return</font> - pending command handle.
     */</font>
    IToken getContext(String id, DoneGetContext done);

    <font color=#3F5FBF>/**
     * Client call back interface for getContext().
     */</font>
    <font color=#7F0055>interface</font> DoneGetContext {
        <font color=#3F5FBF>/**
         * Called when context data retrieval is done.
         * <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
         * <font color=#7F9FBF>@param</font> context - context data.
         */</font>
        <font color=#7F0055>void</font> doneGetContext(IToken token, Exception error, MemoryContext context);
    }

    <font color=#3F5FBF>/**
     * Retrieve contexts available for memory commands.
     * A context corresponds to an execution thread, process, address space, etc.
     * A context can belong to a parent context. Contexts hierarchy can be simple
     * plain list or it can form a tree. It is up to target agent developers to choose
     * layout that is most descriptive for a given target. Context IDs are valid across
     * all services. In other words, all services access same hierarchy of contexts,
     * with same IDs, however, each service accesses its own subset of context's
     * attributes and functionality, which is relevant to that service.
     *
     * <font color=#7F9FBF>@param</font> parent_context_id - parent context ID. Can be null -
     * to retrieve top level of the hierarchy, or one of context IDs retrieved
     * by previous getChildren commands.
     * <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
     * <font color=#7F9FBF>@return</font> - pending command handle.
     */</font>
    IToken getChildren(String parent_context_id, DoneGetChildren done);

    <font color=#3F5FBF>/**
     * Client call back interface for getChildren().
     */</font>
    <font color=#7F0055>interface</font> DoneGetChildren {
        <font color=#3F5FBF>/**
         * Called when context list retrieval is done.
         * <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
         * <font color=#7F9FBF>@param</font> context_ids - array of available context IDs.
         */</font>
        <font color=#7F0055>void</font> doneGetChildren(IToken token, Exception error, String[] context_ids);
    }

    <font color=#3F5FBF>/**
     * Memory access mode:
     * Carry on when some of the memory cannot be accessed and
     * return MemoryError at the end if any of the bytes
     * were not processed correctly.
     */</font>
    <font color=#7F0055>static final int</font> MODE_CONTINUEONERROR = 0x1;

    <font color=#3F5FBF>/**
     * Memory access mode:
     * Verify result of memory operations (by reading and comparing).
     */</font>
    <font color=#7F0055>static final int</font> MODE_VERIFY = 0x2;

    <font color=#3F5FBF>/**
     * <font color=#7F9FBF>@noimplement</font> This interface is not intended to be implemented by clients.
     */</font>
    <font color=#7F0055>interface</font> MemoryContext {

        <font color=#3F5FBF>/**
         * Get context ID.
         * <font color=#7F9FBF>@return</font> context ID.
         */</font>
        String getID();

        <font color=#3F5FBF>/**
         * Get parent context ID.
         * <font color=#7F9FBF>@return</font> parent ID.
         */</font>
        String getParentID();

        <font color=#3F5FBF>/**
         * Get process ID, if applicable.
         * <font color=#7F9FBF>@return</font> process ID.
         */</font>
        String getProcessID();

        <font color=#3F5FBF>/**
         * Get memory endianness.
         * <font color=#7F9FBF>@return</font> true if memory is big-endian.
         */</font>
        <font color=#7F0055>boolean</font> isBigEndian();

        <font color=#3F5FBF>/**
         * Get memory address size.
         * <font color=#7F9FBF>@return</font> number of bytes used to store memory address value.
         */</font>
        <font color=#7F0055>int</font> getAddressSize();

        <font color=#3F5FBF>/**
         * Get memory context name.
         * The name can be used for UI purposes.
         * <font color=#7F9FBF>@return</font> context name.
         */</font>
        String getName();

        <font color=#3F5FBF>/**
         * Get lowest address (inclusive) which is valid for the context.
         * <font color=#7F9FBF>@return</font> lowest address.
         */</font>
        Number getStartBound();

        <font color=#3F5FBF>/**
         * Get highest address (inclusive) which is valid for the context.
         * <font color=#7F9FBF>@return</font> highest address.
         */</font>
        Number getEndBound();

        <font color=#3F5FBF>/**
         * Get the access types allowed for this context.
         * <font color=#7F9FBF>@return</font> collection of access type names.
         */</font>
        Collection&lt;String&gt; getAccessTypes();

        <font color=#3F5FBF>/**
         * Get this memory context's addressable unit size in number of bytes.
         * The addressable size indicates the minimum number of bytes that
         * can be retrieved as a single unit.
         * <font color=#7F9FBF>@return</font> addressable unit size in bytes.
         * <font color=#7F9FBF>@since</font> 1.3
         */</font>
        <font color=#7F0055>int</font> getAddressableUnitSize();

        <font color=#3F5FBF>/**
         * Get default word size in number of bytes.
         * The size is supposed to be used as the default memory view word representation.
         * Returns zero is word size is unknown.
         * <font color=#7F9FBF>@return</font> word size in bytes.
         * <font color=#7F9FBF>@since</font> 1.3
         */</font>
        <font color=#7F0055>int</font> getDefaultWordSize();

        <font color=#3F5FBF>/**
         * Get context properties.
         * <font color=#7F9FBF>@return</font> all available context properties.
         */</font>
        Map&lt;String,Object&gt; getProperties();

        <font color=#3F5FBF>/**
         * Set target memory.
         * If 'word_size' is 0 it means client does not care about word size.
         */</font>
        IToken set(Number addr, <font color=#7F0055>int</font> word_size, <font color=#7F0055>byte</font>[] buf,
                <font color=#7F0055>int</font> offs, <font color=#7F0055>int</font> size, <font color=#7F0055>int</font> mode, DoneMemory done);

        <font color=#3F5FBF>/**
         * Read target memory.
         */</font>
        IToken get(Number addr, <font color=#7F0055>int</font> word_size, <font color=#7F0055>byte</font>[] buf,
                <font color=#7F0055>int</font> offs, <font color=#7F0055>int</font> size, <font color=#7F0055>int</font> mode, DoneMemory done);

        <font color=#3F5FBF>/**
         * Fill target memory with given pattern.
         * 'size' is number of bytes to fill.
         */</font>
        IToken fill(Number addr, <font color=#7F0055>int</font> word_size, <font color=#7F0055>byte</font>[] value,
                <font color=#7F0055>int</font> size, <font color=#7F0055>int</font> mode, DoneMemory done);
    }

    <font color=#3F5FBF>/**
     * Client call back interface for set(), get() and fill() commands.
     */</font>
    <font color=#7F0055>interface</font> DoneMemory {
        <font color=#7F0055>public</font> <font color=#7F0055>void</font> doneMemory(IToken token, MemoryError error);
    }

    <font color=#7F0055>class</font> MemoryError <font color=#7F0055>extends</font> Exception {

        <font color=#7F0055>private static final long</font> serialVersionUID = 1L;

        <font color=#7F0055>public</font> MemoryError(String msg) {
            super(msg);
        }
    }

    <font color=#3F5FBF>/**
     * ErrorOffset interface can be implemented by MemoryError object,
     * which is returned by get, set and fill commands.
     *
     * get/set/fill () returns this exception when reading failed
     * for some but not all bytes, and MODE_CONTINUEONERROR
     * has been set in mode. (For example, when only part of the request
     * translates to valid memory addresses.)
     * Exception.getMessage can be used for generalized message of the
     * possible reasons of partial memory operation.
     */</font>
    <font color=#7F0055>interface</font> ErrorOffset {

        // Error may have per byte information
        <font color=#7F0055>static final int</font>
            BYTE_VALID        = 0x00,
            BYTE_UNKNOWN      = 0x01, // e.g. out of range
            BYTE_INVALID      = 0x02,
            BYTE_CANNOT_READ  = 0x04,
            BYTE_CANNOT_WRITE = 0x08;

        <font color=#7F0055>static final</font> String
            RANGE_KEY_ADDR  = "addr",
            RANGE_KEY_SIZE  = "size",
            RANGE_KEY_STAT  = "stat",
            RANGE_KEY_MSG   = "msg";

        <font color=#7F0055>int</font> getStatus(<font color=#7F0055>int</font> offset);

        <font color=#3F5FBF>/**
         * Returns the detail message string about the
         * byte associated with specified location.
         * <font color=#7F9FBF>@return</font>  the detail error message string.
         */</font>
        String getMessage(<font color=#7F0055>int</font> offset);

    }

    <font color=#3F5FBF>/**
     * Add memory service event listener.
     * <font color=#7F9FBF>@param</font> listener - event listener implementation.
     */</font>
    <font color=#7F0055>void</font> addListener(MemoryListener listener);

    <font color=#3F5FBF>/**
     * Remove memory service event listener.
     * <font color=#7F9FBF>@param</font> listener - event listener implementation.
     */</font>
    <font color=#7F0055>void</font> removeListener(MemoryListener listener);

    <font color=#3F5FBF>/**
     * Memory event listener is notified when memory context hierarchy
     * changes, and when memory is modified by memory service commands.
     */</font>
    <font color=#7F0055>interface</font> MemoryListener {

        <font color=#3F5FBF>/**
         * Called when a new memory access context(s) is created.
         */</font>
        <font color=#7F0055>void</font> contextAdded(MemoryContext[] contexts);

        <font color=#3F5FBF>/**
         * Called when a memory access context(s) properties changed.
         */</font>
        <font color=#7F0055>void</font> contextChanged(MemoryContext[] contexts);

        <font color=#3F5FBF>/**
         * Called when memory access context(s) is removed.
         */</font>
        <font color=#7F0055>void</font> contextRemoved(String[] context_ids);

        <font color=#3F5FBF>/**
         * Called when target memory content was changed and clients
         * need to update themselves. Clients, at least, should invalidate
         * corresponding cached memory data.
         * Not every change is notified - it is not possible,
         * only those, which are not caused by normal execution of the debuggee.
         * 'addr' and 'size' can be null if unknown.
         */</font>
        <font color=#7F0055>void</font> memoryChanged(String context_id, Number[] addr, <font color=#7F0055>long</font>[] size);
    }
}
</pre>

</body>
</html>

Back to the top