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