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