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