Implement -var-info-path-expression.
[deliverable/binutils-gdb.git] / gdb / mi / mi-cmd-var.c
CommitLineData
fb40c209 1/* MI Command Set - varobj commands.
349c5d5f 2
6aba47ca 3 Copyright (C) 2000, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
349c5d5f 4
ab91fdd5 5 Contributed by Cygnus Solutions (a Red Hat company).
fb40c209
AC
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
fb40c209
AC
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
fb40c209
AC
21
22#include "defs.h"
23#include "mi-cmds.h"
24#include "ui-out.h"
25#include "mi-out.h"
26#include "varobj.h"
27#include "value.h"
28#include <ctype.h>
5f8a3188 29#include "gdb_string.h"
fb40c209 30
1ecb4ee0
DJ
31const char mi_no_values[] = "--no-values";
32const char mi_simple_values[] = "--simple-values";
33const char mi_all_values[] = "--all-values";
34
8756216b 35extern int varobjdebug; /* defined in varobj.c. */
fb40c209 36
8756216b 37static void varobj_update_one (struct varobj *var,
25d5ea92
VP
38 enum print_values print_values,
39 int explicit);
fb40c209 40
a217f3f5
VP
41static int mi_print_value_p (struct type *type, enum print_values print_values);
42
43/* Print variable object VAR. The PRINT_VALUES parameter controls
44 if the value should be printed. The PRINT_EXPRESSION parameter
45 controls if the expression should be printed. */
46static void
47print_varobj (struct varobj *var, enum print_values print_values,
48 int print_expression)
49{
bccc275a 50 struct type *gdb_type;
a217f3f5
VP
51 char *type;
52
53 ui_out_field_string (uiout, "name", varobj_get_objname (var));
54 if (print_expression)
55 ui_out_field_string (uiout, "exp", varobj_get_expression (var));
56 ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
57
bccc275a
VP
58 gdb_type = varobj_get_gdb_type (var);
59 if (gdb_type && mi_print_value_p (gdb_type, print_values))
a217f3f5
VP
60 ui_out_field_string (uiout, "value", varobj_get_value (var));
61
62 type = varobj_get_type (var);
63 if (type != NULL)
64 {
65 ui_out_field_string (uiout, "type", type);
66 xfree (type);
67 }
25d5ea92
VP
68
69 if (varobj_get_frozen (var))
70 ui_out_field_int (uiout, "frozen", 1);
a217f3f5
VP
71}
72
fb40c209
AC
73/* VAROBJ operations */
74
75enum mi_cmd_result
76mi_cmd_var_create (char *command, char **argv, int argc)
77{
73a93a32 78 CORE_ADDR frameaddr = 0;
fb40c209
AC
79 struct varobj *var;
80 char *name;
81 char *frame;
82 char *expr;
fb40c209 83 struct cleanup *old_cleanups;
73a93a32 84 enum varobj_type var_type;
fb40c209
AC
85
86 if (argc != 3)
87 {
c6902d46
AC
88 /* mi_error_message = xstrprintf ("mi_cmd_var_create: Usage:
89 ...."); return MI_CMD_ERROR; */
8a3fe4f8 90 error (_("mi_cmd_var_create: Usage: NAME FRAME EXPRESSION."));
fb40c209
AC
91 }
92
93 name = xstrdup (argv[0]);
94 /* Add cleanup for name. Must be free_current_contents as
95 name can be reallocated */
47cf603e 96 old_cleanups = make_cleanup (free_current_contents, &name);
fb40c209
AC
97
98 frame = xstrdup (argv[1]);
51b57b6b 99 make_cleanup (xfree, frame);
fb40c209
AC
100
101 expr = xstrdup (argv[2]);
51b57b6b 102 make_cleanup (xfree, expr);
fb40c209
AC
103
104 if (strcmp (name, "-") == 0)
105 {
b8c9b27d 106 xfree (name);
fb40c209
AC
107 name = varobj_gen_name ();
108 }
109 else if (!isalpha (*name))
8a3fe4f8 110 error (_("mi_cmd_var_create: name of object must begin with a letter"));
fb40c209
AC
111
112 if (strcmp (frame, "*") == 0)
73a93a32
JI
113 var_type = USE_CURRENT_FRAME;
114 else if (strcmp (frame, "@") == 0)
115 var_type = USE_SELECTED_FRAME;
fb40c209 116 else
73a93a32
JI
117 {
118 var_type = USE_SPECIFIED_FRAME;
1bd34ded 119 frameaddr = string_to_core_addr (frame);
73a93a32 120 }
fb40c209
AC
121
122 if (varobjdebug)
123 fprintf_unfiltered (gdb_stdlog,
124 "Name=\"%s\", Frame=\"%s\" (0x%s), Expression=\"%s\"\n",
125 name, frame, paddr (frameaddr), expr);
126
73a93a32 127 var = varobj_create (name, expr, frameaddr, var_type);
fb40c209
AC
128
129 if (var == NULL)
8a3fe4f8 130 error (_("mi_cmd_var_create: unable to create variable object"));
fb40c209 131
224e4ca7 132 print_varobj (var, PRINT_ALL_VALUES, 0 /* don't print expression */);
fb40c209
AC
133
134 do_cleanups (old_cleanups);
135 return MI_CMD_DONE;
136}
137
138enum mi_cmd_result
139mi_cmd_var_delete (char *command, char **argv, int argc)
140{
141 char *name;
fb40c209
AC
142 struct varobj *var;
143 int numdel;
144 int children_only_p = 0;
145 struct cleanup *old_cleanups;
146
147 if (argc < 1 || argc > 2)
8a3fe4f8 148 error (_("mi_cmd_var_delete: Usage: [-c] EXPRESSION."));
fb40c209
AC
149
150 name = xstrdup (argv[0]);
151 /* Add cleanup for name. Must be free_current_contents as
152 name can be reallocated */
47cf603e 153 old_cleanups = make_cleanup (free_current_contents, &name);
fb40c209
AC
154
155 /* If we have one single argument it cannot be '-c' or any string
156 starting with '-'. */
157 if (argc == 1)
158 {
159 if (strcmp (name, "-c") == 0)
8a3fe4f8 160 error (_("mi_cmd_var_delete: Missing required argument after '-c': variable object name"));
fb40c209 161 if (*name == '-')
8a3fe4f8 162 error (_("mi_cmd_var_delete: Illegal variable object name"));
fb40c209
AC
163 }
164
165 /* If we have 2 arguments they must be '-c' followed by a string
166 which would be the variable name. */
167 if (argc == 2)
168 {
fb40c209 169 if (strcmp (name, "-c") != 0)
8a3fe4f8 170 error (_("mi_cmd_var_delete: Invalid option."));
fb40c209 171 children_only_p = 1;
474d0d0c
MS
172 do_cleanups (old_cleanups);
173 name = xstrdup (argv[1]);
174 make_cleanup (free_current_contents, &name);
fb40c209
AC
175 }
176
177 /* If we didn't error out, now NAME contains the name of the
178 variable. */
179
180 var = varobj_get_handle (name);
181
182 if (var == NULL)
8a3fe4f8 183 error (_("mi_cmd_var_delete: Variable object not found."));
fb40c209
AC
184
185 numdel = varobj_delete (var, NULL, children_only_p);
186
187 ui_out_field_int (uiout, "ndeleted", numdel);
188
189 do_cleanups (old_cleanups);
190 return MI_CMD_DONE;
191}
192
193enum mi_cmd_result
194mi_cmd_var_set_format (char *command, char **argv, int argc)
195{
196 enum varobj_display_formats format;
197 int len;
198 struct varobj *var;
199 char *formspec;
200
201 if (argc != 2)
8a3fe4f8 202 error (_("mi_cmd_var_set_format: Usage: NAME FORMAT."));
fb40c209
AC
203
204 /* Get varobj handle, if a valid var obj name was specified */
205 var = varobj_get_handle (argv[0]);
206
207 if (var == NULL)
8a3fe4f8 208 error (_("mi_cmd_var_set_format: Variable object not found"));
fb40c209 209
b538c234 210 formspec = argv[1];
fb40c209 211 if (formspec == NULL)
8a3fe4f8 212 error (_("mi_cmd_var_set_format: Must specify the format as: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\""));
fb40c209
AC
213
214 len = strlen (formspec);
215
bf896cb0 216 if (strncmp (formspec, "natural", len) == 0)
fb40c209 217 format = FORMAT_NATURAL;
bf896cb0 218 else if (strncmp (formspec, "binary", len) == 0)
fb40c209 219 format = FORMAT_BINARY;
bf896cb0 220 else if (strncmp (formspec, "decimal", len) == 0)
fb40c209 221 format = FORMAT_DECIMAL;
bf896cb0 222 else if (strncmp (formspec, "hexadecimal", len) == 0)
fb40c209 223 format = FORMAT_HEXADECIMAL;
bf896cb0 224 else if (strncmp (formspec, "octal", len) == 0)
fb40c209
AC
225 format = FORMAT_OCTAL;
226 else
8a3fe4f8 227 error (_("mi_cmd_var_set_format: Unknown display format: must be: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\""));
fb40c209
AC
228
229 /* Set the format of VAR to given format */
230 varobj_set_display_format (var, format);
231
232 /* Report the new current format */
233 ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
234 return MI_CMD_DONE;
235}
236
25d5ea92
VP
237enum mi_cmd_result
238mi_cmd_var_set_frozen (char *command, char **argv, int argc)
239{
240 struct varobj *var;
241 int frozen;
242
243 if (argc != 2)
244 error (_("-var-set-format: Usage: NAME FROZEN_FLAG."));
245
246 var = varobj_get_handle (argv[0]);
247 if (var == NULL)
248 error (_("Variable object not found"));
249
250 if (strcmp (argv[1], "0") == 0)
251 frozen = 0;
252 else if (strcmp (argv[1], "1") == 0)
253 frozen = 1;
254 else
255 error (_("Invalid flag value"));
256
257 varobj_set_frozen (var, frozen);
258
259 /* We don't automatically return the new value, or what varobjs got new
260 values during unfreezing. If this information is required, client
261 should call -var-update explicitly. */
262 return MI_CMD_DONE;
263}
264
265
fb40c209
AC
266enum mi_cmd_result
267mi_cmd_var_show_format (char *command, char **argv, int argc)
268{
269 enum varobj_display_formats format;
270 struct varobj *var;
271
272 if (argc != 1)
8a3fe4f8 273 error (_("mi_cmd_var_show_format: Usage: NAME."));
fb40c209
AC
274
275 /* Get varobj handle, if a valid var obj name was specified */
276 var = varobj_get_handle (argv[0]);
277 if (var == NULL)
8a3fe4f8 278 error (_("mi_cmd_var_show_format: Variable object not found"));
fb40c209
AC
279
280 format = varobj_get_display_format (var);
281
282 /* Report the current format */
283 ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
284 return MI_CMD_DONE;
285}
286
287enum mi_cmd_result
288mi_cmd_var_info_num_children (char *command, char **argv, int argc)
289{
290 struct varobj *var;
291
292 if (argc != 1)
8a3fe4f8 293 error (_("mi_cmd_var_info_num_children: Usage: NAME."));
fb40c209
AC
294
295 /* Get varobj handle, if a valid var obj name was specified */
296 var = varobj_get_handle (argv[0]);
297 if (var == NULL)
8a3fe4f8 298 error (_("mi_cmd_var_info_num_children: Variable object not found"));
fb40c209
AC
299
300 ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
301 return MI_CMD_DONE;
302}
303
1ecb4ee0
DJ
304/* Parse a string argument into a print_values value. */
305
306static enum print_values
307mi_parse_values_option (const char *arg)
308{
309 if (strcmp (arg, "0") == 0
310 || strcmp (arg, mi_no_values) == 0)
311 return PRINT_NO_VALUES;
312 else if (strcmp (arg, "1") == 0
313 || strcmp (arg, mi_all_values) == 0)
314 return PRINT_ALL_VALUES;
315 else if (strcmp (arg, "2") == 0
316 || strcmp (arg, mi_simple_values) == 0)
317 return PRINT_SIMPLE_VALUES;
318 else
319 error (_("Unknown value for PRINT_VALUES\n\
320Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
321 mi_no_values, mi_simple_values, mi_all_values);
322}
323
324/* Return 1 if given the argument PRINT_VALUES we should display
325 a value of type TYPE. */
326
327static int
328mi_print_value_p (struct type *type, enum print_values print_values)
329{
57cdecd2 330 type = check_typedef (type);
1ecb4ee0
DJ
331
332 if (print_values == PRINT_NO_VALUES)
333 return 0;
334
335 if (print_values == PRINT_ALL_VALUES)
336 return 1;
337
338 /* For PRINT_SIMPLE_VALUES, only print the value if it has a type
339 and that type is not a compound type. */
340
341 return (TYPE_CODE (type) != TYPE_CODE_ARRAY
342 && TYPE_CODE (type) != TYPE_CODE_STRUCT
343 && TYPE_CODE (type) != TYPE_CODE_UNION);
344}
345
fb40c209
AC
346enum mi_cmd_result
347mi_cmd_var_list_children (char *command, char **argv, int argc)
348{
349 struct varobj *var;
350 struct varobj **childlist;
351 struct varobj **cc;
6ad4a2cf 352 struct cleanup *cleanup_children;
fb40c209 353 int numchild;
c9e1f0fc 354 enum print_values print_values;
fb40c209 355
c9e1f0fc 356 if (argc != 1 && argc != 2)
8a3fe4f8 357 error (_("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME"));
fb40c209
AC
358
359 /* Get varobj handle, if a valid var obj name was specified */
1ecb4ee0
DJ
360 if (argc == 1)
361 var = varobj_get_handle (argv[0]);
362 else
363 var = varobj_get_handle (argv[1]);
fb40c209 364 if (var == NULL)
8a3fe4f8 365 error (_("Variable object not found"));
fb40c209
AC
366
367 numchild = varobj_list_children (var, &childlist);
368 ui_out_field_int (uiout, "numchild", numchild);
c9e1f0fc 369 if (argc == 2)
1ecb4ee0
DJ
370 print_values = mi_parse_values_option (argv[0]);
371 else
372 print_values = PRINT_NO_VALUES;
fb40c209
AC
373
374 if (numchild <= 0)
76bd6e0b
MS
375 {
376 xfree (childlist);
377 return MI_CMD_DONE;
378 }
fb40c209 379
e7494ffb
AC
380 if (mi_version (uiout) == 1)
381 cleanup_children = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
382 else
383 cleanup_children = make_cleanup_ui_out_list_begin_end (uiout, "children");
fb40c209
AC
384 cc = childlist;
385 while (*cc != NULL)
386 {
6ad4a2cf
JJ
387 struct cleanup *cleanup_child;
388 cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
a217f3f5 389 print_varobj (*cc, print_values, 1 /* print expression */);
fb40c209 390 cc++;
a217f3f5 391 do_cleanups (cleanup_child);
fb40c209 392 }
6ad4a2cf 393 do_cleanups (cleanup_children);
b8c9b27d 394 xfree (childlist);
fb40c209
AC
395 return MI_CMD_DONE;
396}
397
398enum mi_cmd_result
399mi_cmd_var_info_type (char *command, char **argv, int argc)
400{
401 struct varobj *var;
402
403 if (argc != 1)
8a3fe4f8 404 error (_("mi_cmd_var_info_type: Usage: NAME."));
fb40c209
AC
405
406 /* Get varobj handle, if a valid var obj name was specified */
407 var = varobj_get_handle (argv[0]);
408 if (var == NULL)
8a3fe4f8 409 error (_("mi_cmd_var_info_type: Variable object not found"));
fb40c209
AC
410
411 ui_out_field_string (uiout, "type", varobj_get_type (var));
412 return MI_CMD_DONE;
413}
414
02142340
VP
415enum mi_cmd_result
416mi_cmd_var_info_path_expression (char *command, char **argv, int argc)
417{
418 struct varobj *var;
419 char *path_expr;
420
421 if (argc != 1)
422 error (_("Usage: NAME."));
423
424 /* Get varobj handle, if a valid var obj name was specified. */
425 var = varobj_get_handle (argv[0]);
426 if (var == NULL)
427 error (_("Variable object not found"));
428
429 path_expr = varobj_get_path_expr (var);
430
431 ui_out_field_string (uiout, "path_expr", path_expr);
432
433 return MI_CMD_DONE;
434}
435
fb40c209
AC
436enum mi_cmd_result
437mi_cmd_var_info_expression (char *command, char **argv, int argc)
438{
439 enum varobj_languages lang;
440 struct varobj *var;
441
442 if (argc != 1)
8a3fe4f8 443 error (_("mi_cmd_var_info_expression: Usage: NAME."));
fb40c209
AC
444
445 /* Get varobj handle, if a valid var obj name was specified */
446 var = varobj_get_handle (argv[0]);
447 if (var == NULL)
8a3fe4f8 448 error (_("mi_cmd_var_info_expression: Variable object not found"));
fb40c209
AC
449
450 lang = varobj_get_language (var);
451
452 ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]);
453 ui_out_field_string (uiout, "exp", varobj_get_expression (var));
454 return MI_CMD_DONE;
455}
456
457enum mi_cmd_result
458mi_cmd_var_show_attributes (char *command, char **argv, int argc)
459{
460 int attr;
461 char *attstr;
462 struct varobj *var;
463
464 if (argc != 1)
8a3fe4f8 465 error (_("mi_cmd_var_show_attributes: Usage: NAME."));
fb40c209
AC
466
467 /* Get varobj handle, if a valid var obj name was specified */
468 var = varobj_get_handle (argv[0]);
469 if (var == NULL)
8a3fe4f8 470 error (_("mi_cmd_var_show_attributes: Variable object not found"));
fb40c209
AC
471
472 attr = varobj_get_attributes (var);
473 /* FIXME: define masks for attributes */
474 if (attr & 0x00000001)
475 attstr = "editable";
476 else
477 attstr = "noneditable";
478
479 ui_out_field_string (uiout, "attr", attstr);
480 return MI_CMD_DONE;
481}
482
483enum mi_cmd_result
484mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
485{
486 struct varobj *var;
487
488 if (argc != 1)
8a3fe4f8 489 error (_("mi_cmd_var_evaluate_expression: Usage: NAME."));
fb40c209
AC
490
491 /* Get varobj handle, if a valid var obj name was specified */
492 var = varobj_get_handle (argv[0]);
493 if (var == NULL)
8a3fe4f8 494 error (_("mi_cmd_var_evaluate_expression: Variable object not found"));
fb40c209
AC
495
496 ui_out_field_string (uiout, "value", varobj_get_value (var));
497 return MI_CMD_DONE;
498}
499
500enum mi_cmd_result
501mi_cmd_var_assign (char *command, char **argv, int argc)
502{
503 struct varobj *var;
504 char *expression;
505
506 if (argc != 2)
8a3fe4f8 507 error (_("mi_cmd_var_assign: Usage: NAME EXPRESSION."));
fb40c209
AC
508
509 /* Get varobj handle, if a valid var obj name was specified */
510 var = varobj_get_handle (argv[0]);
511 if (var == NULL)
8a3fe4f8 512 error (_("mi_cmd_var_assign: Variable object not found"));
fb40c209
AC
513
514 /* FIXME: define masks for attributes */
515 if (!(varobj_get_attributes (var) & 0x00000001))
8a3fe4f8 516 error (_("mi_cmd_var_assign: Variable object is not editable"));
fb40c209
AC
517
518 expression = xstrdup (argv[1]);
519
520 if (!varobj_set_value (var, expression))
98a29c7e 521 error (_("mi_cmd_var_assign: Could not assign expression to variable object"));
fb40c209
AC
522
523 ui_out_field_string (uiout, "value", varobj_get_value (var));
524 return MI_CMD_DONE;
525}
526
527enum mi_cmd_result
528mi_cmd_var_update (char *command, char **argv, int argc)
529{
530 struct varobj *var;
531 struct varobj **rootlist;
532 struct varobj **cr;
3a387118 533 struct cleanup *cleanup;
fb40c209
AC
534 char *name;
535 int nv;
1ecb4ee0 536 enum print_values print_values;
fb40c209 537
1ecb4ee0
DJ
538 if (argc != 1 && argc != 2)
539 error (_("mi_cmd_var_update: Usage: [PRINT_VALUES] NAME."));
540
541 if (argc == 1)
542 name = argv[0];
543 else
544 name = (argv[1]);
fb40c209 545
1ecb4ee0
DJ
546 if (argc == 2)
547 print_values = mi_parse_values_option (argv[0]);
548 else
549 print_values = PRINT_NO_VALUES;
fb40c209
AC
550
551 /* Check if the parameter is a "*" which means that we want
552 to update all variables */
553
554 if ((*name == '*') && (*(name + 1) == '\0'))
555 {
556 nv = varobj_list (&rootlist);
db9a518b 557 cleanup = make_cleanup (xfree, rootlist);
3a387118 558 if (mi_version (uiout) <= 1)
db9a518b 559 make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
3a387118 560 else
db9a518b 561 make_cleanup_ui_out_list_begin_end (uiout, "changelist");
fb40c209
AC
562 if (nv <= 0)
563 {
3a387118 564 do_cleanups (cleanup);
fb40c209
AC
565 return MI_CMD_DONE;
566 }
567 cr = rootlist;
568 while (*cr != NULL)
569 {
25d5ea92 570 varobj_update_one (*cr, print_values, 0 /* implicit */);
fb40c209
AC
571 cr++;
572 }
3a387118 573 do_cleanups (cleanup);
fb40c209
AC
574 }
575 else
576 {
577 /* Get varobj handle, if a valid var obj name was specified */
578 var = varobj_get_handle (name);
579 if (var == NULL)
8a3fe4f8 580 error (_("mi_cmd_var_update: Variable object not found"));
fb40c209 581
3a387118
JJ
582 if (mi_version (uiout) <= 1)
583 cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
584 else
585 cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
25d5ea92 586 varobj_update_one (var, print_values, 1 /* explicit */);
3a387118 587 do_cleanups (cleanup);
fb40c209 588 }
73a93a32 589 return MI_CMD_DONE;
fb40c209
AC
590}
591
8756216b 592/* Helper for mi_cmd_var_update(). */
fb40c209 593
8756216b 594static void
25d5ea92
VP
595varobj_update_one (struct varobj *var, enum print_values print_values,
596 int explicit)
fb40c209
AC
597{
598 struct varobj **changelist;
599 struct varobj **cc;
3a387118 600 struct cleanup *cleanup = NULL;
fb40c209
AC
601 int nc;
602
25d5ea92 603 nc = varobj_update (&var, &changelist, explicit);
fb40c209 604
8756216b
DP
605 /* nc >= 0 represents the number of changes reported into changelist.
606 nc < 0 means that an error occured or the the variable has
607 changed type (TYPE_CHANGED). */
73a93a32
JI
608
609 if (nc == 0)
8756216b
DP
610 return;
611 else if (nc < 0)
fb40c209 612 {
3a387118
JJ
613 if (mi_version (uiout) > 1)
614 cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
73a93a32 615 ui_out_field_string (uiout, "name", varobj_get_objname(var));
8756216b
DP
616
617 switch (nc)
618 {
619 case NOT_IN_SCOPE:
8756216b
DP
620 ui_out_field_string (uiout, "in_scope", "false");
621 break;
622 case INVALID:
623 ui_out_field_string (uiout, "in_scope", "invalid");
624 break;
625 case TYPE_CHANGED:
626 ui_out_field_string (uiout, "in_scope", "true");
627 ui_out_field_string (uiout, "new_type", varobj_get_type(var));
628 ui_out_field_int (uiout, "new_num_children",
629 varobj_get_num_children(var));
630 break;
631 }
3a387118
JJ
632 if (mi_version (uiout) > 1)
633 do_cleanups (cleanup);
73a93a32
JI
634 }
635 else
636 {
73a93a32
JI
637 cc = changelist;
638 while (*cc != NULL)
639 {
3a387118
JJ
640 if (mi_version (uiout) > 1)
641 cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
73a93a32 642 ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
1ecb4ee0
DJ
643 if (mi_print_value_p (varobj_get_gdb_type (*cc), print_values))
644 ui_out_field_string (uiout, "value", varobj_get_value (*cc));
73a93a32
JI
645 ui_out_field_string (uiout, "in_scope", "true");
646 ui_out_field_string (uiout, "type_changed", "false");
3a387118
JJ
647 if (mi_version (uiout) > 1)
648 do_cleanups (cleanup);
73a93a32
JI
649 cc++;
650 }
b8c9b27d 651 xfree (changelist);
fb40c209 652 }
fb40c209 653}
This page took 0.590762 seconds and 4 git commands to generate.