]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/mi/mi-cmd-var.c
-Wwrite-strings: The Rest
[thirdparty/binutils-gdb.git] / gdb / mi / mi-cmd-var.c
1 /* MI Command Set - varobj commands.
2 Copyright (C) 2000-2017 Free Software Foundation, Inc.
3
4 Contributed by Cygnus Solutions (a Red Hat company).
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 #include "defs.h"
22 #include "mi-cmds.h"
23 #include "mi-main.h"
24 #include "ui-out.h"
25 #include "mi-out.h"
26 #include "varobj.h"
27 #include "language.h"
28 #include "value.h"
29 #include <ctype.h>
30 #include "mi-getopt.h"
31 #include "gdbthread.h"
32 #include "mi-parse.h"
33
34 extern unsigned int varobjdebug; /* defined in varobj.c. */
35
36 static void varobj_update_one (struct varobj *var,
37 enum print_values print_values,
38 int is_explicit);
39
40 static int mi_print_value_p (struct varobj *var,
41 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. */
46
47 static void
48 print_varobj (struct varobj *var, enum print_values print_values,
49 int print_expression)
50 {
51 struct ui_out *uiout = current_uiout;
52 int thread_id;
53
54 uiout->field_string ("name", varobj_get_objname (var));
55 if (print_expression)
56 {
57 std::string exp = varobj_get_expression (var);
58
59 uiout->field_string ("exp", exp.c_str ());
60 }
61 uiout->field_int ("numchild", varobj_get_num_children (var));
62
63 if (mi_print_value_p (var, print_values))
64 {
65 std::string val = varobj_get_value (var);
66
67 uiout->field_string ("value", val.c_str ());
68 }
69
70 std::string type = varobj_get_type (var);
71 if (!type.empty ())
72 uiout->field_string ("type", type.c_str ());
73
74 thread_id = varobj_get_thread_id (var);
75 if (thread_id > 0)
76 uiout->field_int ("thread-id", thread_id);
77
78 if (varobj_get_frozen (var))
79 uiout->field_int ("frozen", 1);
80
81 gdb::unique_xmalloc_ptr<char> display_hint = varobj_get_display_hint (var);
82 if (display_hint)
83 uiout->field_string ("displayhint", display_hint.get ());
84
85 if (varobj_is_dynamic_p (var))
86 uiout->field_int ("dynamic", 1);
87 }
88
89 /* VAROBJ operations */
90
91 void
92 mi_cmd_var_create (const char *command, char **argv, int argc)
93 {
94 struct ui_out *uiout = current_uiout;
95 CORE_ADDR frameaddr = 0;
96 struct varobj *var;
97 char *name;
98 char *frame;
99 char *expr;
100 struct cleanup *old_cleanups;
101 enum varobj_type var_type;
102
103 if (argc != 3)
104 error (_("-var-create: Usage: NAME FRAME EXPRESSION."));
105
106 name = xstrdup (argv[0]);
107 /* Add cleanup for name. Must be free_current_contents as name can
108 be reallocated. */
109 old_cleanups = make_cleanup (free_current_contents, &name);
110
111 frame = xstrdup (argv[1]);
112 make_cleanup (xfree, frame);
113
114 expr = xstrdup (argv[2]);
115 make_cleanup (xfree, expr);
116
117 if (strcmp (name, "-") == 0)
118 {
119 xfree (name);
120 name = varobj_gen_name ();
121 }
122 else if (!isalpha (*name))
123 error (_("-var-create: name of object must begin with a letter"));
124
125 if (strcmp (frame, "*") == 0)
126 var_type = USE_CURRENT_FRAME;
127 else if (strcmp (frame, "@") == 0)
128 var_type = USE_SELECTED_FRAME;
129 else
130 {
131 var_type = USE_SPECIFIED_FRAME;
132 frameaddr = string_to_core_addr (frame);
133 }
134
135 if (varobjdebug)
136 fprintf_unfiltered (gdb_stdlog,
137 "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n",
138 name, frame, hex_string (frameaddr), expr);
139
140 var = varobj_create (name, expr, frameaddr, var_type);
141
142 if (var == NULL)
143 error (_("-var-create: unable to create variable object"));
144
145 print_varobj (var, PRINT_ALL_VALUES, 0 /* don't print expression */);
146
147 uiout->field_int ("has_more", varobj_has_more (var, 0));
148
149 do_cleanups (old_cleanups);
150 }
151
152 void
153 mi_cmd_var_delete (const char *command, char **argv, int argc)
154 {
155 char *name;
156 struct varobj *var;
157 int numdel;
158 int children_only_p = 0;
159 struct cleanup *old_cleanups;
160 struct ui_out *uiout = current_uiout;
161
162 if (argc < 1 || argc > 2)
163 error (_("-var-delete: Usage: [-c] EXPRESSION."));
164
165 name = xstrdup (argv[0]);
166 /* Add cleanup for name. Must be free_current_contents as name can
167 be reallocated. */
168 old_cleanups = make_cleanup (free_current_contents, &name);
169
170 /* If we have one single argument it cannot be '-c' or any string
171 starting with '-'. */
172 if (argc == 1)
173 {
174 if (strcmp (name, "-c") == 0)
175 error (_("-var-delete: Missing required "
176 "argument after '-c': variable object name"));
177 if (*name == '-')
178 error (_("-var-delete: Illegal variable object name"));
179 }
180
181 /* If we have 2 arguments they must be '-c' followed by a string
182 which would be the variable name. */
183 if (argc == 2)
184 {
185 if (strcmp (name, "-c") != 0)
186 error (_("-var-delete: Invalid option."));
187 children_only_p = 1;
188 do_cleanups (old_cleanups);
189 name = xstrdup (argv[1]);
190 old_cleanups = make_cleanup (free_current_contents, &name);
191 }
192
193 /* If we didn't error out, now NAME contains the name of the
194 variable. */
195
196 var = varobj_get_handle (name);
197
198 numdel = varobj_delete (var, children_only_p);
199
200 uiout->field_int ("ndeleted", numdel);
201
202 do_cleanups (old_cleanups);
203 }
204
205 /* Parse a string argument into a format value. */
206
207 static enum varobj_display_formats
208 mi_parse_format (const char *arg)
209 {
210 if (arg != NULL)
211 {
212 int len;
213
214 len = strlen (arg);
215
216 if (strncmp (arg, "natural", len) == 0)
217 return FORMAT_NATURAL;
218 else if (strncmp (arg, "binary", len) == 0)
219 return FORMAT_BINARY;
220 else if (strncmp (arg, "decimal", len) == 0)
221 return FORMAT_DECIMAL;
222 else if (strncmp (arg, "hexadecimal", len) == 0)
223 return FORMAT_HEXADECIMAL;
224 else if (strncmp (arg, "octal", len) == 0)
225 return FORMAT_OCTAL;
226 else if (strncmp (arg, "zero-hexadecimal", len) == 0)
227 return FORMAT_ZHEXADECIMAL;
228 }
229
230 error (_("Must specify the format as: \"natural\", "
231 "\"binary\", \"decimal\", \"hexadecimal\", \"octal\" or \"zero-hexadecimal\""));
232 }
233
234 void
235 mi_cmd_var_set_format (const char *command, char **argv, int argc)
236 {
237 enum varobj_display_formats format;
238 struct varobj *var;
239 struct ui_out *uiout = current_uiout;
240
241 if (argc != 2)
242 error (_("-var-set-format: Usage: NAME FORMAT."));
243
244 /* Get varobj handle, if a valid var obj name was specified. */
245 var = varobj_get_handle (argv[0]);
246
247 format = mi_parse_format (argv[1]);
248
249 /* Set the format of VAR to the given format. */
250 varobj_set_display_format (var, format);
251
252 /* Report the new current format. */
253 uiout->field_string ("format", varobj_format_string[(int) format]);
254
255 /* Report the value in the new format. */
256 std::string val = varobj_get_value (var);
257 uiout->field_string ("value", val.c_str ());
258 }
259
260 void
261 mi_cmd_var_set_visualizer (const char *command, char **argv, int argc)
262 {
263 struct varobj *var;
264
265 if (argc != 2)
266 error (_("Usage: NAME VISUALIZER_FUNCTION."));
267
268 var = varobj_get_handle (argv[0]);
269
270 if (var == NULL)
271 error (_("Variable object not found"));
272
273 varobj_set_visualizer (var, argv[1]);
274 }
275
276 void
277 mi_cmd_var_set_frozen (const char *command, char **argv, int argc)
278 {
279 struct varobj *var;
280 int frozen;
281
282 if (argc != 2)
283 error (_("-var-set-format: Usage: NAME FROZEN_FLAG."));
284
285 var = varobj_get_handle (argv[0]);
286
287 if (strcmp (argv[1], "0") == 0)
288 frozen = 0;
289 else if (strcmp (argv[1], "1") == 0)
290 frozen = 1;
291 else
292 error (_("Invalid flag value"));
293
294 varobj_set_frozen (var, frozen);
295
296 /* We don't automatically return the new value, or what varobjs got
297 new values during unfreezing. If this information is required,
298 client should call -var-update explicitly. */
299 }
300
301 void
302 mi_cmd_var_show_format (const char *command, char **argv, int argc)
303 {
304 struct ui_out *uiout = current_uiout;
305 enum varobj_display_formats format;
306 struct varobj *var;
307
308 if (argc != 1)
309 error (_("-var-show-format: Usage: NAME."));
310
311 /* Get varobj handle, if a valid var obj name was specified. */
312 var = varobj_get_handle (argv[0]);
313
314 format = varobj_get_display_format (var);
315
316 /* Report the current format. */
317 uiout->field_string ("format", varobj_format_string[(int) format]);
318 }
319
320 void
321 mi_cmd_var_info_num_children (const char *command, char **argv, int argc)
322 {
323 struct ui_out *uiout = current_uiout;
324 struct varobj *var;
325
326 if (argc != 1)
327 error (_("-var-info-num-children: Usage: NAME."));
328
329 /* Get varobj handle, if a valid var obj name was specified. */
330 var = varobj_get_handle (argv[0]);
331
332 uiout->field_int ("numchild", varobj_get_num_children (var));
333 }
334
335 /* Return 1 if given the argument PRINT_VALUES we should display
336 the varobj VAR. */
337
338 static int
339 mi_print_value_p (struct varobj *var, enum print_values print_values)
340 {
341 struct type *type;
342
343 if (print_values == PRINT_NO_VALUES)
344 return 0;
345
346 if (print_values == PRINT_ALL_VALUES)
347 return 1;
348
349 if (varobj_is_dynamic_p (var))
350 return 1;
351
352 type = varobj_get_gdb_type (var);
353 if (type == NULL)
354 return 1;
355 else
356 {
357 type = check_typedef (type);
358
359 /* For PRINT_SIMPLE_VALUES, only print the value if it has a type
360 and that type is not a compound type. */
361 return (TYPE_CODE (type) != TYPE_CODE_ARRAY
362 && TYPE_CODE (type) != TYPE_CODE_STRUCT
363 && TYPE_CODE (type) != TYPE_CODE_UNION);
364 }
365 }
366
367 void
368 mi_cmd_var_list_children (const char *command, char **argv, int argc)
369 {
370 struct ui_out *uiout = current_uiout;
371 struct varobj *var;
372 VEC(varobj_p) *children;
373 struct varobj *child;
374 enum print_values print_values;
375 int ix;
376 int from, to;
377
378 if (argc < 1 || argc > 4)
379 error (_("-var-list-children: Usage: "
380 "[PRINT_VALUES] NAME [FROM TO]"));
381
382 /* Get varobj handle, if a valid var obj name was specified. */
383 if (argc == 1 || argc == 3)
384 var = varobj_get_handle (argv[0]);
385 else
386 var = varobj_get_handle (argv[1]);
387
388 if (argc > 2)
389 {
390 from = atoi (argv[argc - 2]);
391 to = atoi (argv[argc - 1]);
392 }
393 else
394 {
395 from = -1;
396 to = -1;
397 }
398
399 children = varobj_list_children (var, &from, &to);
400 uiout->field_int ("numchild", to - from);
401 if (argc == 2 || argc == 4)
402 print_values = mi_parse_print_values (argv[0]);
403 else
404 print_values = PRINT_NO_VALUES;
405
406 gdb::unique_xmalloc_ptr<char> display_hint = varobj_get_display_hint (var);
407 if (display_hint)
408 uiout->field_string ("displayhint", display_hint.get ());
409
410 if (from < to)
411 {
412 struct cleanup *cleanup_children;
413
414 if (mi_version (uiout) == 1)
415 cleanup_children
416 = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
417 else
418 cleanup_children
419 = make_cleanup_ui_out_list_begin_end (uiout, "children");
420 for (ix = from;
421 ix < to && VEC_iterate (varobj_p, children, ix, child);
422 ++ix)
423 {
424 struct cleanup *cleanup_child;
425
426 cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
427 print_varobj (child, print_values, 1 /* print expression */);
428 do_cleanups (cleanup_child);
429 }
430 do_cleanups (cleanup_children);
431 }
432
433 uiout->field_int ("has_more", varobj_has_more (var, to));
434 }
435
436 void
437 mi_cmd_var_info_type (const char *command, char **argv, int argc)
438 {
439 struct ui_out *uiout = current_uiout;
440 struct varobj *var;
441
442 if (argc != 1)
443 error (_("-var-info-type: Usage: NAME."));
444
445 /* Get varobj handle, if a valid var obj name was specified. */
446 var = varobj_get_handle (argv[0]);
447
448 std::string type_name = varobj_get_type (var);
449 uiout->field_string ("type", type_name.c_str ());
450 }
451
452 void
453 mi_cmd_var_info_path_expression (const char *command, char **argv, int argc)
454 {
455 struct ui_out *uiout = current_uiout;
456 struct varobj *var;
457
458 if (argc != 1)
459 error (_("Usage: NAME."));
460
461 /* Get varobj handle, if a valid var obj name was specified. */
462 var = varobj_get_handle (argv[0]);
463
464 const char *path_expr = varobj_get_path_expr (var);
465
466 uiout->field_string ("path_expr", path_expr);
467 }
468
469 void
470 mi_cmd_var_info_expression (const char *command, char **argv, int argc)
471 {
472 struct ui_out *uiout = current_uiout;
473 const struct language_defn *lang;
474 struct varobj *var;
475
476 if (argc != 1)
477 error (_("-var-info-expression: Usage: NAME."));
478
479 /* Get varobj handle, if a valid var obj name was specified. */
480 var = varobj_get_handle (argv[0]);
481
482 lang = varobj_get_language (var);
483
484 uiout->field_string ("lang", lang->la_natural_name);
485
486 std::string exp = varobj_get_expression (var);
487 uiout->field_string ("exp", exp.c_str ());
488 }
489
490 void
491 mi_cmd_var_show_attributes (const char *command, char **argv, int argc)
492 {
493 struct ui_out *uiout = current_uiout;
494 int attr;
495 const char *attstr;
496 struct varobj *var;
497
498 if (argc != 1)
499 error (_("-var-show-attributes: Usage: NAME."));
500
501 /* Get varobj handle, if a valid var obj name was specified */
502 var = varobj_get_handle (argv[0]);
503
504 attr = varobj_get_attributes (var);
505 /* FIXME: define masks for attributes */
506 if (attr & 0x00000001)
507 attstr = "editable";
508 else
509 attstr = "noneditable";
510
511 uiout->field_string ("attr", attstr);
512 }
513
514 void
515 mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
516 {
517 struct ui_out *uiout = current_uiout;
518 struct varobj *var;
519
520 enum varobj_display_formats format;
521 int formatFound;
522 int oind;
523 char *oarg;
524
525 enum opt
526 {
527 OP_FORMAT
528 };
529 static const struct mi_opt opts[] =
530 {
531 {"f", OP_FORMAT, 1},
532 { 0, 0, 0 }
533 };
534
535 /* Parse arguments. */
536 format = FORMAT_NATURAL;
537 formatFound = 0;
538 oind = 0;
539 while (1)
540 {
541 int opt = mi_getopt ("-var-evaluate-expression", argc, argv,
542 opts, &oind, &oarg);
543
544 if (opt < 0)
545 break;
546 switch ((enum opt) opt)
547 {
548 case OP_FORMAT:
549 if (formatFound)
550 error (_("Cannot specify format more than once"));
551
552 format = mi_parse_format (oarg);
553 formatFound = 1;
554 break;
555 }
556 }
557
558 if (oind >= argc)
559 error (_("Usage: [-f FORMAT] NAME"));
560
561 if (oind < argc - 1)
562 error (_("Garbage at end of command"));
563
564 /* Get varobj handle, if a valid var obj name was specified. */
565 var = varobj_get_handle (argv[oind]);
566
567 if (formatFound)
568 {
569 std::string val = varobj_get_formatted_value (var, format);
570
571 uiout->field_string ("value", val.c_str ());
572 }
573 else
574 {
575 std::string val = varobj_get_value (var);
576
577 uiout->field_string ("value", val.c_str ());
578 }
579 }
580
581 void
582 mi_cmd_var_assign (const char *command, char **argv, int argc)
583 {
584 struct ui_out *uiout = current_uiout;
585 struct varobj *var;
586
587 if (argc != 2)
588 error (_("-var-assign: Usage: NAME EXPRESSION."));
589
590 /* Get varobj handle, if a valid var obj name was specified. */
591 var = varobj_get_handle (argv[0]);
592
593 if (!varobj_editable_p (var))
594 error (_("-var-assign: Variable object is not editable"));
595
596 const char *expression = argv[1];
597
598 /* MI command '-var-assign' may write memory, so suppress memory
599 changed notification if it does. */
600 scoped_restore save_suppress
601 = make_scoped_restore (&mi_suppress_notification.memory, 1);
602
603 if (!varobj_set_value (var, expression))
604 error (_("-var-assign: Could not assign "
605 "expression to variable object"));
606
607 std::string val = varobj_get_value (var);
608 uiout->field_string ("value", val.c_str ());
609 }
610
611 /* Type used for parameters passing to mi_cmd_var_update_iter. */
612
613 struct mi_cmd_var_update
614 {
615 int only_floating;
616 enum print_values print_values;
617 };
618
619 /* Helper for mi_cmd_var_update - update each VAR. */
620
621 static void
622 mi_cmd_var_update_iter (struct varobj *var, void *data_pointer)
623 {
624 struct mi_cmd_var_update *data = (struct mi_cmd_var_update *) data_pointer;
625 int thread_id, thread_stopped;
626
627 thread_id = varobj_get_thread_id (var);
628
629 if (thread_id == -1
630 && (ptid_equal (inferior_ptid, null_ptid)
631 || is_stopped (inferior_ptid)))
632 thread_stopped = 1;
633 else
634 {
635 struct thread_info *tp = find_thread_global_id (thread_id);
636
637 if (tp)
638 thread_stopped = is_stopped (tp->ptid);
639 else
640 thread_stopped = 1;
641 }
642
643 if (thread_stopped
644 && (!data->only_floating || varobj_floating_p (var)))
645 varobj_update_one (var, data->print_values, 0 /* implicit */);
646 }
647
648 void
649 mi_cmd_var_update (const char *command, char **argv, int argc)
650 {
651 struct ui_out *uiout = current_uiout;
652 struct cleanup *cleanup;
653 char *name;
654 enum print_values print_values;
655
656 if (argc != 1 && argc != 2)
657 error (_("-var-update: Usage: [PRINT_VALUES] NAME."));
658
659 if (argc == 1)
660 name = argv[0];
661 else
662 name = argv[1];
663
664 if (argc == 2)
665 print_values = mi_parse_print_values (argv[0]);
666 else
667 print_values = PRINT_NO_VALUES;
668
669 if (mi_version (uiout) <= 1)
670 cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
671 else
672 cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
673
674 /* Check if the parameter is a "*", which means that we want to
675 update all variables. */
676
677 if ((*name == '*' || *name == '@') && (*(name + 1) == '\0'))
678 {
679 struct mi_cmd_var_update data;
680
681 data.only_floating = (*name == '@');
682 data.print_values = print_values;
683
684 /* varobj_update_one automatically updates all the children of
685 VAROBJ. Therefore update each VAROBJ only once by iterating
686 only the root VAROBJs. */
687
688 all_root_varobjs (mi_cmd_var_update_iter, &data);
689 }
690 else
691 {
692 /* Get varobj handle, if a valid var obj name was specified. */
693 struct varobj *var = varobj_get_handle (name);
694
695 varobj_update_one (var, print_values, 1 /* explicit */);
696 }
697
698 do_cleanups (cleanup);
699 }
700
701 /* Helper for mi_cmd_var_update(). */
702
703 static void
704 varobj_update_one (struct varobj *var, enum print_values print_values,
705 int is_explicit)
706 {
707 struct ui_out *uiout = current_uiout;
708 VEC (varobj_update_result) *changes;
709 varobj_update_result *r;
710 int i;
711
712 changes = varobj_update (&var, is_explicit);
713
714 for (i = 0; VEC_iterate (varobj_update_result, changes, i, r); ++i)
715 {
716 int from, to;
717 struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
718
719 if (mi_version (uiout) > 1)
720 make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
721 uiout->field_string ("name", varobj_get_objname (r->varobj));
722
723 switch (r->status)
724 {
725 case VAROBJ_IN_SCOPE:
726 if (mi_print_value_p (r->varobj, print_values))
727 {
728 std::string val = varobj_get_value (r->varobj);
729
730 uiout->field_string ("value", val.c_str ());
731 }
732 uiout->field_string ("in_scope", "true");
733 break;
734 case VAROBJ_NOT_IN_SCOPE:
735 uiout->field_string ("in_scope", "false");
736 break;
737 case VAROBJ_INVALID:
738 uiout->field_string ("in_scope", "invalid");
739 break;
740 }
741
742 if (r->status != VAROBJ_INVALID)
743 {
744 if (r->type_changed)
745 uiout->field_string ("type_changed", "true");
746 else
747 uiout->field_string ("type_changed", "false");
748 }
749
750 if (r->type_changed)
751 {
752 std::string type_name = varobj_get_type (r->varobj);
753
754 uiout->field_string ("new_type", type_name.c_str ());
755 }
756
757 if (r->type_changed || r->children_changed)
758 uiout->field_int ("new_num_children",
759 varobj_get_num_children (r->varobj));
760
761 gdb::unique_xmalloc_ptr<char> display_hint
762 = varobj_get_display_hint (r->varobj);
763 if (display_hint)
764 uiout->field_string ("displayhint", display_hint.get ());
765
766 if (varobj_is_dynamic_p (r->varobj))
767 uiout->field_int ("dynamic", 1);
768
769 varobj_get_child_range (r->varobj, &from, &to);
770 uiout->field_int ("has_more", varobj_has_more (r->varobj, to));
771
772 if (r->newobj)
773 {
774 int j;
775 varobj_p child;
776 struct cleanup *cleanup;
777
778 cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children");
779 for (j = 0; VEC_iterate (varobj_p, r->newobj, j, child); ++j)
780 {
781 struct cleanup *cleanup_child;
782
783 cleanup_child
784 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
785 print_varobj (child, print_values, 1 /* print_expression */);
786 do_cleanups (cleanup_child);
787 }
788
789 do_cleanups (cleanup);
790 VEC_free (varobj_p, r->newobj);
791 r->newobj = NULL; /* Paranoia. */
792 }
793
794 do_cleanups (cleanup);
795 }
796 VEC_free (varobj_update_result, changes);
797 }
798
799 void
800 mi_cmd_enable_pretty_printing (const char *command, char **argv, int argc)
801 {
802 if (argc != 0)
803 error (_("-enable-pretty-printing: no arguments allowed"));
804
805 varobj_enable_pretty_printing ();
806 }
807
808 void
809 mi_cmd_var_set_update_range (const char *command, char **argv, int argc)
810 {
811 struct varobj *var;
812 int from, to;
813
814 if (argc != 3)
815 error (_("-var-set-update-range: Usage: VAROBJ FROM TO"));
816
817 var = varobj_get_handle (argv[0]);
818 from = atoi (argv[1]);
819 to = atoi (argv[2]);
820
821 varobj_set_child_range (var, from, to);
822 }