Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4e67ddb1305ccdf7080bf92385d3310ef1d19e58 (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>Target Communication Framework Services - Expressions</title>
</head>

<body lang='EN-US'>

<h1>Target Communication Framework Services - Expressions</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='#CmdCreate'>Create</a>
        <li><a href='#CmdCreateInScope'>Create In Scope</a>
        <li><a href='#CmdDispose'>Dispose</a>
        <li><a href='#CmdEvaluate'>Evaluate</a>
        <li><a href='#CmdAssign'>Assign</a>
    </ul>
    <li><a href='#API'>API</a>
</ul>

<h1>Expressions Service</h1>

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

<table border=1 cellpadding=8>
    <tr>
        <th>Version
        <th>Date
        <th>Change
    <tr>
        <td>1.0
        <td>2011-11-11
        <td>Initial
</table>

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

<p>Expressions service allows TCF client to perform expression evaluation on remote target.
The service can be used to retrieve or modify values of variables or any data structures in remote target memory.</p>

<p>After expression is created using either <a href='#CmdCreate'>Create</a> or <a href='#CmdCreateInScope'>Create In Scope</a> command,
it can be evaluated multiple times, for example, each time the target is suspended. If an expression denotes a storage location, it can be used in
<a href='#CmdAssign'>Assign</a> command to change stored value. When expression is not needed anymore, it should be disposed using
<a href='#CmdDispose'>Dispose</a> command.</p>

<p>Expressions syntax is extended C/C++ syntax. Extensions to regular C/C++ syntax are:</p>
<ol>
  <li>Special characters in identifiers: <b>$"X"</b>, or just <b>"X"</b> if followed by ::, where X is object name that can contain any characters.
  <li>Symbol IDs in expressions: <b>${X}</b>, where X is symbol ID as returned by the <a href='TCF Service - Symbols.html'>Symbols Service</a>.
  <li>CPU registers: <b>$X</b>, where X is a register name, e.g. $ax
  <li>Debug print function: <b>$printf(fmt, ...)</b>, see <a href='TCF Service - Debug Print.html'>Debug Print Service</a>.
  <li>Debug context ID: <b>$thread</b>, current context ID, same as returned by the <a href='TCF Service - Run Control.html'>Run Control Service</a>.
  <li>OS loader breakpoint address: <b>$loader_brk</b>
  <li>OS loader state address: <b>$loader_state</b>
</ol>

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

<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; Expressions &bull; getContext &bull; <i>&lt;string: context ID&gt;</i> &bull;
</font></b></pre>

<p>The command retrieves expression context info for given context ID</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;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.</p>

<p>Predefined expression 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>"SymbolID" : <i>&lt;string&gt;</i></font></b></code>
    - symbol ID if expression designates a symbol. The symbol ID can be used with <a href='TCF Service - Symbols.html'>Symbols Service</a> to get symbol data.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Expression" : <i>&lt;string&gt;</i></font></b></code>
    - text of the expression.

    <li><code><b><font face="Courier New" size=2 color=#333399>"CanAssign" : <i>&lt;boolean&gt;</i></font></b></code>
    - true if expression designates a storage location, so new value can be assigned (stored) at the location.

    <li><code><b><font face="Courier New" size=2 color=#333399>"HasFuncCall" : <i>&lt;boolean&gt;</i></font></b></code>
    - true if expression cantains a function call, which needs to be executed in the debug context.
    Evaluation of such expressions resumes and suspends target thread or CPU.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Class" : <i>&lt;number&gt;</i></font></b></code>
    - symbol class of the expression type. See <a href='TCF Service - Symbols.html'>Symbols Service</a> for definition of symbol classes.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Type" : <i>&lt;string&gt;</i></font></b></code>
    - symbol ID of the expression type.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Size" : <i>&lt;number&gt;</i></font></b></code>
    - size (in bytes) of the expression value.
</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; Expressions &bull; getChildren &bull; <i>&lt;string: parent context ID&gt;</i> &bull;
</font></b></pre>

<p>Retrieve children IDs for given parent ID.
   Meaning of the operation depends on parent kind:</p>
<ol>
    <li>parent is stack frame: children are function arguments and local variables</li>
    <li>parent is thread: children are top stack frame function arguments and local variables</li>
    <li>parent is expression with type of a struct, union, or class: children are symbol IDs of fields</li>
    <li>parent is expression with type of an enumeration: children are symbol IDs of enumerators</li>
</ol>
<p>Children list does not include IDs of expressions that were created by clients using "create" command.</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: children IDs&gt;</i> &bull;
</font></b></pre>

<h3><a name='CmdCreate'>Create</a></h3>

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

<p>Create an expression context. The context should be disposed after use.</p>
<p>"parent context ID" is a context ID that can be used to resolve symbol names. It can be process, thread or stack frame.
<p>"language" - language of expression script, null means default language.</p>
<p>"expression" - the expression script.</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;string: expression context ID&gt;</i> &bull;
</font></b></pre>

<h3><a name='CmdCreateInScope'>Create In Scope</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; <i>&lt;token&gt;</i> &bull; Expressions &bull; createInScope &bull; <i>&lt;object: scope&gt;</i> &bull; <i>&lt;string: expression&gt;</i> &bull;
</font></b></pre>

<p>Create an expression context in a scope. The context should be disposed after use.</p>
<p>"scope" controls symbols resolution and and interpretation of the expression script.</p>
<p>Predefined properties of the expression scope are:</p>
<ul>
    <li><code><b><font face="Courier New" size=2 color=#333399>"ContextID" : <i>&lt;string&gt;</i></font></b></code>
    - context ID that can be used to resolve symbol names. It can be process, thread or stack frame.
    <li><code><b><font face="Courier New" size=2 color=#333399>"Address" : <i>&lt;string&gt;</i></font></b></code>
    - code instruction address in the parent context. The address identifies compilation unit, function and/or basic block to be used as expression evaluation environment.
    <li><code><b><font face="Courier New" size=2 color=#333399>"Language" : <i>&lt;string&gt;</i></font></b></code>
    - language of expression script.
</ul>
<p>"expression" - the expression script.</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;string: expression context ID&gt;</i> &bull;
</font></b></pre>

<h3><a name='CmdDispose'>Dispose</a></h3>

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

<p>Dispose an expression context that was created by "create" or "createInScope" commands.</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;
</font></b></pre>

<h3><a name='CmdEvaluate'>Evaluate</a></h3>

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

<p>Evaluate value of an expression.</p>

<p>Reply:</p>

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

<p>Predefined properties of the expression value are:</p>
<ul>
    <li><code><b><font face="Courier New" size=2 color=#333399>"Class" : <i>&lt;number&gt;</i></font></b></code>
    - symbol class of the expression value type. See <a href='TCF Service - Symbols.html'>Symbols Service</a> for definition of symbol classes.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Type" : <i>&lt;string&gt;</i></font></b></code>
    - symbol ID of the expression value type.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Symbol" : <i>&lt;string&gt;</i></font></b></code>
    - symbol ID if the expression designates a symbol.

    <li><code><b><font face="Courier New" size=2 color=#333399>"BitStride" : <i>&lt;number&gt;</i></font></b></code>
    - if the value is an array, and if the amount of storage allocated to hold each element of the array is different from
      the amount of storage that is normally allocated to hold an individual object of the indicated element type,
      then BitStride is the size (in bits) of each element of the array.

    <li><code><b><font face="Courier New" size=2 color=#333399>"BinaryScale" : <i>&lt;number&gt;</i></font></b></code>
    - if the value is a fixed point binary number, BinaryScale is the exponent of the base two scale factor to be applied to the value.

    <li><code><b><font face="Courier New" size=2 color=#333399>"DecimalScale" : <i>&lt;number&gt;</i></font></b></code>
    - if the value is a fixed point decimal number, DecimalScale is the exponent of the base ten scale factor to be applied to the value.

    <li><code><b><font face="Courier New" size=2 color=#333399>"ImplicitPointer" : <i>&lt;boolean&gt;</i></font></b></code>
    - true if the value is result of implicit pointer dereference.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Register" : <i>&lt;string&gt;</i></font></b></code>
    - register ID if the expression designates a register.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Address" : <i>&lt;number&gt;</i></font></b></code>
    - memory address if the expression designates a location in the parent context memory.

    <li><code><b><font face="Courier New" size=2 color=#333399>"Pieces" : <i>&lt;array&gt;</i></font></b></code>
    - <font color=#FF7000>TBD</font>

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

</ul>

<h3><a name='CmdAssign'>Assign</a></h3>

<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; <i>&lt;token&gt;</i> &bull; Expressions &bull; assign &bull; <i>&lt;string: expression ID&gt;</i> &bull; <i>&lt;array of bytes: value&gt;</i> &bull;
</font></b></pre>

<p>Assign a value to memory location determined by an expression.</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;
</font></b></pre>

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

<pre>
<font color=#3F5FBF>/**
 * Expressions service allows TCF client to perform expression evaluation on remote target.
 * The service can be used to retrieve or modify values of variables or any data structures in remote target memory.
 *
 * <font color=#7F9FBF>@noimplement</font> This interface is not intended to be implemented by clients.
 */</font>
<font color=#7F0055>public interface</font> IExpressions <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 = "Expressions";

    <font color=#3F5FBF>/**
     * Expression object represent an expression that can be evaluated by remote target.
     * It has a unique ID and contains all information necessary to compute a value.
     * The object data usually includes:
     *   1. process, thread or stack frame ID that should be used to resolve symbol names;
     *   2. a script that can compute a value, like "x.y + z"
     */</font>
    <font color=#7F0055>interface</font> Expression {
        <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 context ID.
         */</font>
        String getParentID();

        <font color=#3F5FBF>/**
         * Get expression script language ID.
         * <font color=#7F9FBF>@return</font> language ID.
         */</font>
        String getLanguage();

        <font color=#3F5FBF>/**
         * Return expression string - the script part of the context.
         * <font color=#7F9FBF>@return</font> expression script string
         */</font>
        String getExpression();

        <font color=#3F5FBF>/**
         * Return symbol ID if the expression represents a symbol (e.g. local variable).
         * <font color=#7F9FBF>@return</font> symbol ID
         */</font>
        String getSymbolID();

        <font color=#3F5FBF>/**
         * Get size of expression value in bits.
         * Can be 0 if value size is even number of bytes, use getSize() in such case.
         * <font color=#7F9FBF>@return</font> size in bits.
         */</font>
        <font color=#7F0055>int</font> getBits();

        <font color=#3F5FBF>/**
         * Get size in bytes. The size can include extra (unused) bits.
         * This is "static" or "declared" size - as determined by expression type.
         * <font color=#7F9FBF>@return</font> size in bytes.
         */</font>
        <font color=#7F0055>int</font> getSize();

        <font color=#3F5FBF>/**
         * Get expression type ID. Symbols service can be used to get type properties.
         * This is "static" or "declared" type ID, actual type of a value can be different -
         * if expression language supports dynamic typing.
         * <font color=#7F9FBF>@return</font> type ID.
         */</font>
        String getTypeID();

        <font color=#3F5FBF>/**
         * Check if the expression can be assigned a new value.
         * <font color=#7F9FBF>@return</font> true if can assign.
         */</font>
        <font color=#7F0055>boolean</font> canAssign();

        <font color=#3F5FBF>/**
         * Check if the expression contains target function call.
         * Such expression can resume the target when evaluated.
         * <font color=#7F9FBF>@return</font> true if has a function call.
         */</font>
        <font color=#7F0055>boolean</font> hasFuncCall();

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

    <font color=#3F5FBF>/**
     * Expression context property names.
     */</font>
    <font color=#7F0055>static final</font> String
        PROP_ID = "ID",
        PROP_PARENT_ID = "ParentID",
        PROP_SYMBOL_ID = "SymbolID",
        PROP_LANGUAGE = "Language",
        PROP_EXPRESSION = "Expression",
        PROP_BITS = "Bits",
        PROP_SIZE = "Size",
        PROP_TYPE = "Type",
        PROP_CAN_ASSIGN = "CanAssign",
        PROP_HAS_FUNC_CALL = "HasFuncCall";

    <font color=#3F5FBF>/**
     * Expression scope attributes.
     * <font color=#7F9FBF>@since</font> 1.2
     */</font>
    <font color=#7F0055>static final</font> String
        SCOPE_CONTEXT_ID = "ContextID",
        SCOPE_ADDRESS = "Address",
        SCOPE_LANGUAGE = "Language";

    <font color=#3F5FBF>/**
     * Value represents result of expression evaluation.
     * Note that same expression can be evaluated multiple times with different results.
     * <font color=#7F9FBF>@noimplement</font> This interface is not intended to be implemented by clients.
     */</font>
    <font color=#7F0055>interface</font> Value {

        <font color=#3F5FBF>/**
         * Get value type class.
         * @see ISymbols.TypeClass
         * @return
         */</font>
        ISymbols.TypeClass getTypeClass();

        <font color=#3F5FBF>/**
         * Get value type ID. Symbols service can be used to get type properties.
         * <font color=#7F9FBF>@return</font> type ID.
         */</font>
        String getTypeID();

        <font color=#3F5FBF>/**
         * Check endianness of the values.
         * Big-endian means decreasing numeric significance with increasing byte number.
         * <font color=#7F9FBF>@return</font> true if big-endian.
         */</font>
        <font color=#7F0055>boolean</font> isBigEndian();

        <font color=#3F5FBF>/**
         * Implicit pointer means that the value represents a pointer,
         * which value is unknown or optimized away,
         * even though the value it would point to is known.
         * <font color=#7F9FBF>@return</font> true if the value is implicit pointer.
         * <font color=#7F9FBF>@since</font> 1.3
         */</font>
        <font color=#7F0055>boolean</font> isImplicitPointer();

        <font color=#3F5FBF>/**
         * Return register ID if the value represents register variable.
         * <font color=#7F9FBF>@return</font> register ID or null.
         */</font>
        String getRegisterID();

        <font color=#3F5FBF>/**
         * Return symbol ID if the value represents a symbol.
         * <font color=#7F9FBF>@return</font> symbol ID or null.
         */</font>
        String getSymbolID();

        <font color=#3F5FBF>/**
         * Return value memory address, if applicable.
         * <font color=#7F9FBF>@return</font> address or null.
         */</font>
        Number getAddress();

        <font color=#3F5FBF>/**
         * Get value as array of bytes.
         * <font color=#7F9FBF>@return</font> value as array of bytes.
         */</font>
        <font color=#7F0055>byte</font>[] getValue();

        <font color=#3F5FBF>/**
         * Get complete map of value properties.
         * <font color=#7F9FBF>@return</font> map of value properties.
         */</font>
        Map&lt;String,Object&gt; getProperties();
    }

    <font color=#3F5FBF>/**
     * Expression value property names.
     */</font>
    <font color=#7F0055>static final</font> String
        VAL_CLASS = "Class",
        VAL_TYPE = "Type",
        VAL_BIG_ENDIAN = "BigEndian",
        VAL_REGISTER = "Register",
        VAL_SYMBOL = "Symbol",
        VAL_ADDRESS = "Address";
    <font color=#3F5FBF>/** <font color=#7F9FBF>@since</font> 1.3 */</font>
    <font color=#7F0055>static final</font> String
        VAL_BINARY_SCALE = "BinaryScale",
        VAL_DECIMAL_SCALE = "DecimalScale",
        VAL_IMPLICIT_POINTER = "ImplicitPointer",
        VAL_PIECES = "Pieces";
    <font color=#3F5FBF>/** <font color=#7F9FBF>@since</font> 1.4 */</font>
    <font color=#7F0055>static final</font> String
        VAL_BIT_STRIDE = "BitStride";

    <font color=#3F5FBF>/**
     * Retrieve expression context info for given context ID.
     * @see Expression
     *
     * <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> token - command handle
         * <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
         * <font color=#7F9FBF>@param</font> context - context properties.
         */</font>
        <font color=#7F0055>void</font> doneGetContext(IToken token, Exception error, Expression context);
    }

    <font color=#3F5FBF>/**
     * Retrieve children IDs for given parent ID.
     * Meaning of the operation depends on parent kind:
     * 1. stack frame - function arguments and local variables;
     * 2. thread - top stack frame function arguments and local variables;
     * 3. expression with type of a struct, union, or class - fields;
     * 4. expression with type of an enumeration - enumerators;
     *
     * <font color=#7F9FBF>@param</font> parent_context_id - parent 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 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> token - command handle
         * <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>/**
     * Create an expression context.
     * The context should be disposed after use.
     * <font color=#7F9FBF>@param</font> parent_id - a context ID that can be used to resolve symbol names.
     * <font color=#7F9FBF>@param</font> language - language of expression script, null means default language
     * <font color=#7F9FBF>@param</font> expression - expression script
     * <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
     * <font color=#7F9FBF>@return</font> - pending command handle.
     */</font>
    IToken create(String parent_id, String language, String expression, DoneCreate done);

    <font color=#3F5FBF>/**
     * Create an expression context using given scope to resolve symbols.
     * The context should be disposed after use.
     * <font color=#7F9FBF>@param</font> scope - see SCOPE_* attribute definitions.
     * <font color=#7F9FBF>@param</font> expression - expression script
     * <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
     * <font color=#7F9FBF>@return</font> - pending command handle.
     * <font color=#7F9FBF>@since</font> 1.2
     */</font>
    IToken createInScope(Map&lt;String,Object&gt; scope, String expression, DoneCreate done);

    <font color=#3F5FBF>/**
     * Client call back interface for create() and createInScope().
     */</font>
    <font color=#7F0055>interface</font> DoneCreate {
        <font color=#3F5FBF>/**
         * Called when context create context command is done.
         * <font color=#7F9FBF>@param</font> token - command handle
         * <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
         * <font color=#7F9FBF>@param</font> context - context properties.
         */</font>
        <font color=#7F0055>void</font> doneCreate(IToken token, Exception error, Expression context);
    }

    <font color=#3F5FBF>/**
     * Dispose an expression context that was created by create()
     * <font color=#7F9FBF>@param</font> id - the expression 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 dispose(String id, DoneDispose done);

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

    <font color=#3F5FBF>/**
     * Evaluate value of an expression context.
     * <font color=#7F9FBF>@param</font> id - the expression 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 evaluate(String id, DoneEvaluate done);

    <font color=#3F5FBF>/**
     * Client call back interface for evaluate().
     */</font>
    <font color=#7F0055>interface</font> DoneEvaluate {
        <font color=#3F5FBF>/**
         * Called when context dispose command is done.
         * <font color=#7F9FBF>@param</font> token - command handle
         * <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
         * <font color=#7F9FBF>@param</font> value - expression evaluation result
         */</font>
        <font color=#7F0055>void</font> doneEvaluate(IToken token, Exception error, Value value);
    }

    <font color=#3F5FBF>/**
     * Assign a value to memory location determined by an expression.
     * <font color=#7F9FBF>@param</font> id - expression ID.
     * <font color=#7F9FBF>@param</font> value - value as an array of bytes.
     * <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
     * <font color=#7F9FBF>@return</font> - pending command handle.
     */</font>
    IToken assign(String id, <font color=#7F0055>byte</font>[] value, DoneAssign done);

    <font color=#3F5FBF>/**
     * Client call back interface for assign().
     */</font>
    <font color=#7F0055>interface</font> DoneAssign {
        <font color=#3F5FBF>/**
         * Called when assign command is done.
         * <font color=#7F9FBF>@param</font> token - command handle
         * <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
         */</font>
        <font color=#7F0055>void</font> doneAssign(IToken token, Exception error);
    }

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

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

    <font color=#3F5FBF>/**
     * Registers event listener is notified when registers context hierarchy
     * changes, and when a register is modified by the service commands.
     */</font>
    <font color=#7F0055>interface</font> ExpressionsListener {

        <font color=#3F5FBF>/**
         * Called when expression value was changed and clients
         * need to update themselves. Clients, at least, should invalidate
         * corresponding cached expression data.
         * Not every change is notified - it is not possible,
         * only those, which are not caused by normal execution of the debuggee.
         * At least, changes caused by "assign" command should be notified.
         * <font color=#7F9FBF>@param</font> id - expression context ID.
         */</font>
        <font color=#7F0055>void</font> valueChanged(String id);
    }
}
</pre>

</body>
</html>

Back to the top