OLD | NEW |
1 /* MI Command Set - varobj commands. | 1 /* MI Command Set - varobj commands. |
2 | |
3 Copyright (C) 2000, 2002, 2004-2005, 2007-2012 Free Software | 2 Copyright (C) 2000, 2002, 2004-2005, 2007-2012 Free Software |
4 Foundation, Inc. | 3 Foundation, Inc. |
5 | 4 |
6 Contributed by Cygnus Solutions (a Red Hat company). | 5 Contributed by Cygnus Solutions (a Red Hat company). |
7 | 6 |
8 This file is part of GDB. | 7 This file is part of GDB. |
9 | 8 |
10 This program is free software; you can redistribute it and/or modify | 9 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 | 10 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 | 11 the Free Software Foundation; either version 3 of the License, or |
(...skipping 18 matching lines...) Expand all Loading... |
31 #include "mi-getopt.h" | 30 #include "mi-getopt.h" |
32 #include "gdbthread.h" | 31 #include "gdbthread.h" |
33 | 32 |
34 const char mi_no_values[] = "--no-values"; | 33 const char mi_no_values[] = "--no-values"; |
35 const char mi_simple_values[] = "--simple-values"; | 34 const char mi_simple_values[] = "--simple-values"; |
36 const char mi_all_values[] = "--all-values"; | 35 const char mi_all_values[] = "--all-values"; |
37 | 36 |
38 extern int varobjdebug; /* defined in varobj.c. */ | 37 extern int varobjdebug; /* defined in varobj.c. */ |
39 | 38 |
40 static void varobj_update_one (struct varobj *var, | 39 static void varobj_update_one (struct varobj *var, |
41 » » » enum print_values print_values, | 40 » » » enum print_values print_values, |
42 » » » int explicit); | 41 » » » int explicit); |
43 | 42 |
44 static int mi_print_value_p (struct varobj *var, | 43 static int mi_print_value_p (struct varobj *var, |
45 enum print_values print_values); | 44 enum print_values print_values); |
46 | 45 |
47 /* Print variable object VAR. The PRINT_VALUES parameter controls | 46 /* Print variable object VAR. The PRINT_VALUES parameter controls |
48 if the value should be printed. The PRINT_EXPRESSION parameter | 47 if the value should be printed. The PRINT_EXPRESSION parameter |
49 controls if the expression should be printed. */ | 48 controls if the expression should be printed. */ |
| 49 |
50 static void | 50 static void |
51 print_varobj (struct varobj *var, enum print_values print_values, | 51 print_varobj (struct varobj *var, enum print_values print_values, |
52 int print_expression) | 52 int print_expression) |
53 { | 53 { |
54 struct ui_out *uiout = current_uiout; | 54 struct ui_out *uiout = current_uiout; |
55 char *type; | 55 char *type; |
56 int thread_id; | 56 int thread_id; |
57 char *display_hint; | 57 char *display_hint; |
58 | 58 |
59 ui_out_field_string (uiout, "name", varobj_get_objname (var)); | 59 ui_out_field_string (uiout, "name", varobj_get_objname (var)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 struct ui_out *uiout = current_uiout; | 102 struct ui_out *uiout = current_uiout; |
103 CORE_ADDR frameaddr = 0; | 103 CORE_ADDR frameaddr = 0; |
104 struct varobj *var; | 104 struct varobj *var; |
105 char *name; | 105 char *name; |
106 char *frame; | 106 char *frame; |
107 char *expr; | 107 char *expr; |
108 struct cleanup *old_cleanups; | 108 struct cleanup *old_cleanups; |
109 enum varobj_type var_type; | 109 enum varobj_type var_type; |
110 | 110 |
111 if (argc != 3) | 111 if (argc != 3) |
112 { | 112 error (_("-var-create: Usage: NAME FRAME EXPRESSION.")); |
113 /* mi_error_message = xstrprintf ("-var-create: Usage: | |
114 ...."); return MI_CMD_ERROR; */ | |
115 error (_("-var-create: Usage: NAME FRAME EXPRESSION.")); | |
116 } | |
117 | 113 |
118 name = xstrdup (argv[0]); | 114 name = xstrdup (argv[0]); |
119 /* Add cleanup for name. Must be free_current_contents as | 115 /* Add cleanup for name. Must be free_current_contents as name can |
120 name can be reallocated */ | 116 be reallocated. */ |
121 old_cleanups = make_cleanup (free_current_contents, &name); | 117 old_cleanups = make_cleanup (free_current_contents, &name); |
122 | 118 |
123 frame = xstrdup (argv[1]); | 119 frame = xstrdup (argv[1]); |
124 make_cleanup (xfree, frame); | 120 make_cleanup (xfree, frame); |
125 | 121 |
126 expr = xstrdup (argv[2]); | 122 expr = xstrdup (argv[2]); |
127 make_cleanup (xfree, expr); | 123 make_cleanup (xfree, expr); |
128 | 124 |
129 if (strcmp (name, "-") == 0) | 125 if (strcmp (name, "-") == 0) |
130 { | 126 { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 struct varobj *var; | 164 struct varobj *var; |
169 int numdel; | 165 int numdel; |
170 int children_only_p = 0; | 166 int children_only_p = 0; |
171 struct cleanup *old_cleanups; | 167 struct cleanup *old_cleanups; |
172 struct ui_out *uiout = current_uiout; | 168 struct ui_out *uiout = current_uiout; |
173 | 169 |
174 if (argc < 1 || argc > 2) | 170 if (argc < 1 || argc > 2) |
175 error (_("-var-delete: Usage: [-c] EXPRESSION.")); | 171 error (_("-var-delete: Usage: [-c] EXPRESSION.")); |
176 | 172 |
177 name = xstrdup (argv[0]); | 173 name = xstrdup (argv[0]); |
178 /* Add cleanup for name. Must be free_current_contents as | 174 /* Add cleanup for name. Must be free_current_contents as name can |
179 name can be reallocated */ | 175 be reallocated. */ |
180 old_cleanups = make_cleanup (free_current_contents, &name); | 176 old_cleanups = make_cleanup (free_current_contents, &name); |
181 | 177 |
182 /* If we have one single argument it cannot be '-c' or any string | 178 /* If we have one single argument it cannot be '-c' or any string |
183 starting with '-'. */ | 179 starting with '-'. */ |
184 if (argc == 1) | 180 if (argc == 1) |
185 { | 181 { |
186 if (strcmp (name, "-c") == 0) | 182 if (strcmp (name, "-c") == 0) |
187 error (_("-var-delete: Missing required " | 183 error (_("-var-delete: Missing required " |
188 "argument after '-c': variable object name")); | 184 "argument after '-c': variable object name")); |
189 if (*name == '-') | 185 if (*name == '-') |
190 error (_("-var-delete: Illegal variable object name")); | 186 error (_("-var-delete: Illegal variable object name")); |
191 } | 187 } |
192 | 188 |
193 /* If we have 2 arguments they must be '-c' followed by a string | 189 /* If we have 2 arguments they must be '-c' followed by a string |
194 which would be the variable name. */ | 190 which would be the variable name. */ |
195 if (argc == 2) | 191 if (argc == 2) |
196 { | 192 { |
197 if (strcmp (name, "-c") != 0) | 193 if (strcmp (name, "-c") != 0) |
198 error (_("-var-delete: Invalid option.")); | 194 error (_("-var-delete: Invalid option.")); |
199 children_only_p = 1; | 195 children_only_p = 1; |
200 do_cleanups (old_cleanups); | 196 do_cleanups (old_cleanups); |
201 name = xstrdup (argv[1]); | 197 name = xstrdup (argv[1]); |
202 old_cleanups = make_cleanup (free_current_contents, &name); | 198 old_cleanups = make_cleanup (free_current_contents, &name); |
203 } | 199 } |
204 | 200 |
205 /* If we didn't error out, now NAME contains the name of the | 201 /* If we didn't error out, now NAME contains the name of the |
206 variable. */ | 202 variable. */ |
207 | 203 |
208 var = varobj_get_handle (name); | 204 var = varobj_get_handle (name); |
209 | 205 |
210 numdel = varobj_delete (var, NULL, children_only_p); | 206 numdel = varobj_delete (var, NULL, children_only_p); |
211 | 207 |
212 ui_out_field_int (uiout, "ndeleted", numdel); | 208 ui_out_field_int (uiout, "ndeleted", numdel); |
213 | 209 |
214 do_cleanups (old_cleanups); | 210 do_cleanups (old_cleanups); |
215 } | 211 } |
216 | 212 |
(...skipping 28 matching lines...) Expand all Loading... |
245 mi_cmd_var_set_format (char *command, char **argv, int argc) | 241 mi_cmd_var_set_format (char *command, char **argv, int argc) |
246 { | 242 { |
247 enum varobj_display_formats format; | 243 enum varobj_display_formats format; |
248 struct varobj *var; | 244 struct varobj *var; |
249 char *val; | 245 char *val; |
250 struct ui_out *uiout = current_uiout; | 246 struct ui_out *uiout = current_uiout; |
251 | 247 |
252 if (argc != 2) | 248 if (argc != 2) |
253 error (_("-var-set-format: Usage: NAME FORMAT.")); | 249 error (_("-var-set-format: Usage: NAME FORMAT.")); |
254 | 250 |
255 /* Get varobj handle, if a valid var obj name was specified */ | 251 /* Get varobj handle, if a valid var obj name was specified. */ |
256 var = varobj_get_handle (argv[0]); | 252 var = varobj_get_handle (argv[0]); |
257 | 253 |
258 format = mi_parse_format (argv[1]); | 254 format = mi_parse_format (argv[1]); |
259 | 255 |
260 /* Set the format of VAR to given format */ | 256 /* Set the format of VAR to the given format. */ |
261 varobj_set_display_format (var, format); | 257 varobj_set_display_format (var, format); |
262 | 258 |
263 /* Report the new current format */ | 259 /* Report the new current format. */ |
264 ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); | 260 ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); |
265 | 261 |
266 /* Report the value in the new format */ | 262 /* Report the value in the new format. */ |
267 val = varobj_get_value (var); | 263 val = varobj_get_value (var); |
268 ui_out_field_string (uiout, "value", val); | 264 ui_out_field_string (uiout, "value", val); |
269 xfree (val); | 265 xfree (val); |
270 } | 266 } |
271 | 267 |
272 void | 268 void |
273 mi_cmd_var_set_visualizer (char *command, char **argv, int argc) | 269 mi_cmd_var_set_visualizer (char *command, char **argv, int argc) |
274 { | 270 { |
275 struct varobj *var; | 271 struct varobj *var; |
276 | 272 |
(...skipping 21 matching lines...) Expand all Loading... |
298 | 294 |
299 if (strcmp (argv[1], "0") == 0) | 295 if (strcmp (argv[1], "0") == 0) |
300 frozen = 0; | 296 frozen = 0; |
301 else if (strcmp (argv[1], "1") == 0) | 297 else if (strcmp (argv[1], "1") == 0) |
302 frozen = 1; | 298 frozen = 1; |
303 else | 299 else |
304 error (_("Invalid flag value")); | 300 error (_("Invalid flag value")); |
305 | 301 |
306 varobj_set_frozen (var, frozen); | 302 varobj_set_frozen (var, frozen); |
307 | 303 |
308 /* We don't automatically return the new value, or what varobjs got new | 304 /* We don't automatically return the new value, or what varobjs got |
309 values during unfreezing. If this information is required, client | 305 new values during unfreezing. If this information is required, |
310 should call -var-update explicitly. */ | 306 client should call -var-update explicitly. */ |
311 } | 307 } |
312 | 308 |
313 | |
314 void | 309 void |
315 mi_cmd_var_show_format (char *command, char **argv, int argc) | 310 mi_cmd_var_show_format (char *command, char **argv, int argc) |
316 { | 311 { |
317 struct ui_out *uiout = current_uiout; | 312 struct ui_out *uiout = current_uiout; |
318 enum varobj_display_formats format; | 313 enum varobj_display_formats format; |
319 struct varobj *var; | 314 struct varobj *var; |
320 | 315 |
321 if (argc != 1) | 316 if (argc != 1) |
322 error (_("-var-show-format: Usage: NAME.")); | 317 error (_("-var-show-format: Usage: NAME.")); |
323 | 318 |
324 /* Get varobj handle, if a valid var obj name was specified */ | 319 /* Get varobj handle, if a valid var obj name was specified. */ |
325 var = varobj_get_handle (argv[0]); | 320 var = varobj_get_handle (argv[0]); |
326 | 321 |
327 format = varobj_get_display_format (var); | 322 format = varobj_get_display_format (var); |
328 | 323 |
329 /* Report the current format */ | 324 /* Report the current format. */ |
330 ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); | 325 ui_out_field_string (uiout, "format", varobj_format_string[(int) format]); |
331 } | 326 } |
332 | 327 |
333 void | 328 void |
334 mi_cmd_var_info_num_children (char *command, char **argv, int argc) | 329 mi_cmd_var_info_num_children (char *command, char **argv, int argc) |
335 { | 330 { |
336 struct ui_out *uiout = current_uiout; | 331 struct ui_out *uiout = current_uiout; |
337 struct varobj *var; | 332 struct varobj *var; |
338 | 333 |
339 if (argc != 1) | 334 if (argc != 1) |
340 error (_("-var-info-num-children: Usage: NAME.")); | 335 error (_("-var-info-num-children: Usage: NAME.")); |
341 | 336 |
342 /* Get varobj handle, if a valid var obj name was specified */ | 337 /* Get varobj handle, if a valid var obj name was specified. */ |
343 var = varobj_get_handle (argv[0]); | 338 var = varobj_get_handle (argv[0]); |
344 | 339 |
345 ui_out_field_int (uiout, "numchild", varobj_get_num_children (var)); | 340 ui_out_field_int (uiout, "numchild", varobj_get_num_children (var)); |
346 } | 341 } |
347 | 342 |
348 /* Parse a string argument into a print_values value. */ | 343 /* Parse a string argument into a print_values value. */ |
349 | 344 |
350 static enum print_values | 345 static enum print_values |
351 mi_parse_values_option (const char *arg) | 346 mi_parse_values_option (const char *arg) |
352 { | 347 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 struct varobj *child; | 401 struct varobj *child; |
407 enum print_values print_values; | 402 enum print_values print_values; |
408 int ix; | 403 int ix; |
409 int from, to; | 404 int from, to; |
410 char *display_hint; | 405 char *display_hint; |
411 | 406 |
412 if (argc < 1 || argc > 4) | 407 if (argc < 1 || argc > 4) |
413 error (_("-var-list-children: Usage: " | 408 error (_("-var-list-children: Usage: " |
414 "[PRINT_VALUES] NAME [FROM TO]")); | 409 "[PRINT_VALUES] NAME [FROM TO]")); |
415 | 410 |
416 /* Get varobj handle, if a valid var obj name was specified */ | 411 /* Get varobj handle, if a valid var obj name was specified. */ |
417 if (argc == 1 || argc == 3) | 412 if (argc == 1 || argc == 3) |
418 var = varobj_get_handle (argv[0]); | 413 var = varobj_get_handle (argv[0]); |
419 else | 414 else |
420 var = varobj_get_handle (argv[1]); | 415 var = varobj_get_handle (argv[1]); |
421 | 416 |
422 if (argc > 2) | 417 if (argc > 2) |
423 { | 418 { |
424 from = atoi (argv[argc - 2]); | 419 from = atoi (argv[argc - 2]); |
425 to = atoi (argv[argc - 1]); | 420 to = atoi (argv[argc - 1]); |
426 } | 421 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 467 |
473 void | 468 void |
474 mi_cmd_var_info_type (char *command, char **argv, int argc) | 469 mi_cmd_var_info_type (char *command, char **argv, int argc) |
475 { | 470 { |
476 struct ui_out *uiout = current_uiout; | 471 struct ui_out *uiout = current_uiout; |
477 struct varobj *var; | 472 struct varobj *var; |
478 | 473 |
479 if (argc != 1) | 474 if (argc != 1) |
480 error (_("-var-info-type: Usage: NAME.")); | 475 error (_("-var-info-type: Usage: NAME.")); |
481 | 476 |
482 /* Get varobj handle, if a valid var obj name was specified */ | 477 /* Get varobj handle, if a valid var obj name was specified. */ |
483 var = varobj_get_handle (argv[0]); | 478 var = varobj_get_handle (argv[0]); |
484 | 479 |
485 ui_out_field_string (uiout, "type", varobj_get_type (var)); | 480 ui_out_field_string (uiout, "type", varobj_get_type (var)); |
486 } | 481 } |
487 | 482 |
488 void | 483 void |
489 mi_cmd_var_info_path_expression (char *command, char **argv, int argc) | 484 mi_cmd_var_info_path_expression (char *command, char **argv, int argc) |
490 { | 485 { |
491 struct ui_out *uiout = current_uiout; | 486 struct ui_out *uiout = current_uiout; |
492 struct varobj *var; | 487 struct varobj *var; |
(...skipping 13 matching lines...) Expand all Loading... |
506 void | 501 void |
507 mi_cmd_var_info_expression (char *command, char **argv, int argc) | 502 mi_cmd_var_info_expression (char *command, char **argv, int argc) |
508 { | 503 { |
509 struct ui_out *uiout = current_uiout; | 504 struct ui_out *uiout = current_uiout; |
510 enum varobj_languages lang; | 505 enum varobj_languages lang; |
511 struct varobj *var; | 506 struct varobj *var; |
512 | 507 |
513 if (argc != 1) | 508 if (argc != 1) |
514 error (_("-var-info-expression: Usage: NAME.")); | 509 error (_("-var-info-expression: Usage: NAME.")); |
515 | 510 |
516 /* Get varobj handle, if a valid var obj name was specified */ | 511 /* Get varobj handle, if a valid var obj name was specified. */ |
517 var = varobj_get_handle (argv[0]); | 512 var = varobj_get_handle (argv[0]); |
518 | 513 |
519 lang = varobj_get_language (var); | 514 lang = varobj_get_language (var); |
520 | 515 |
521 ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]); | 516 ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]); |
522 ui_out_field_string (uiout, "exp", varobj_get_expression (var)); | 517 ui_out_field_string (uiout, "exp", varobj_get_expression (var)); |
523 } | 518 } |
524 | 519 |
525 void | 520 void |
526 mi_cmd_var_show_attributes (char *command, char **argv, int argc) | 521 mi_cmd_var_show_attributes (char *command, char **argv, int argc) |
(...skipping 20 matching lines...) Expand all Loading... |
547 } | 542 } |
548 | 543 |
549 void | 544 void |
550 mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) | 545 mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) |
551 { | 546 { |
552 struct ui_out *uiout = current_uiout; | 547 struct ui_out *uiout = current_uiout; |
553 struct varobj *var; | 548 struct varobj *var; |
554 | 549 |
555 enum varobj_display_formats format; | 550 enum varobj_display_formats format; |
556 int formatFound; | 551 int formatFound; |
557 int optind; | 552 int oind; |
558 char *optarg; | 553 char *oarg; |
559 | 554 |
560 enum opt | 555 enum opt |
| 556 { |
| 557 OP_FORMAT |
| 558 }; |
| 559 static const struct mi_opt opts[] = |
561 { | 560 { |
562 OP_FORMAT | 561 {"f", OP_FORMAT, 1}, |
| 562 { 0, 0, 0 } |
563 }; | 563 }; |
564 static const struct mi_opt opts[] = | |
565 { | |
566 {"f", OP_FORMAT, 1}, | |
567 { 0, 0, 0 } | |
568 }; | |
569 | 564 |
570 /* Parse arguments */ | 565 /* Parse arguments. */ |
571 format = FORMAT_NATURAL; | 566 format = FORMAT_NATURAL; |
572 formatFound = 0; | 567 formatFound = 0; |
573 optind = 0; | 568 oind = 0; |
574 while (1) | 569 while (1) |
575 { | 570 { |
576 int opt = mi_getopt ("-var-evaluate-expression", argc, argv, | 571 int opt = mi_getopt ("-var-evaluate-expression", argc, argv, |
577 » » » opts, &optind, &optarg); | 572 » » » opts, &oind, &oarg); |
578 | 573 |
579 if (opt < 0) | 574 if (opt < 0) |
580 break; | 575 break; |
581 switch ((enum opt) opt) | 576 switch ((enum opt) opt) |
582 { | 577 » { |
583 case OP_FORMAT: | 578 case OP_FORMAT: |
584 if (formatFound) | 579 if (formatFound) |
585 error (_("Cannot specify format more than once")); | 580 error (_("Cannot specify format more than once")); |
586 | 581 |
587 » format = mi_parse_format (optarg); | 582 » format = mi_parse_format (oarg); |
588 formatFound = 1; | 583 formatFound = 1; |
589 break; | 584 break; |
590 } | 585 » } |
591 } | 586 } |
592 | 587 |
593 if (optind >= argc) | 588 if (oind >= argc) |
594 error (_("Usage: [-f FORMAT] NAME")); | 589 error (_("Usage: [-f FORMAT] NAME")); |
595 | 590 |
596 if (optind < argc - 1) | 591 if (oind < argc - 1) |
597 error (_("Garbage at end of command")); | 592 error (_("Garbage at end of command")); |
598 | 593 |
599 /* Get varobj handle, if a valid var obj name was specified */ | 594 /* Get varobj handle, if a valid var obj name was specified. */ |
600 var = varobj_get_handle (argv[optind]); | 595 var = varobj_get_handle (argv[oind]); |
601 | 596 |
602 if (formatFound) | 597 if (formatFound) |
603 { | 598 { |
604 char *val = varobj_get_formatted_value (var, format); | 599 char *val = varobj_get_formatted_value (var, format); |
605 | 600 |
606 ui_out_field_string (uiout, "value", val); | 601 ui_out_field_string (uiout, "value", val); |
607 xfree (val); | 602 xfree (val); |
608 } | 603 } |
609 else | 604 else |
610 { | 605 { |
611 char *val = varobj_get_value (var); | 606 char *val = varobj_get_value (var); |
612 | 607 |
613 ui_out_field_string (uiout, "value", val); | 608 ui_out_field_string (uiout, "value", val); |
614 xfree (val); | 609 xfree (val); |
615 } | 610 } |
616 } | 611 } |
617 | 612 |
618 void | 613 void |
619 mi_cmd_var_assign (char *command, char **argv, int argc) | 614 mi_cmd_var_assign (char *command, char **argv, int argc) |
620 { | 615 { |
621 struct ui_out *uiout = current_uiout; | 616 struct ui_out *uiout = current_uiout; |
622 struct varobj *var; | 617 struct varobj *var; |
623 char *expression, *val; | 618 char *expression, *val; |
624 | 619 |
625 if (argc != 2) | 620 if (argc != 2) |
626 error (_("-var-assign: Usage: NAME EXPRESSION.")); | 621 error (_("-var-assign: Usage: NAME EXPRESSION.")); |
627 | 622 |
628 /* Get varobj handle, if a valid var obj name was specified */ | 623 /* Get varobj handle, if a valid var obj name was specified. */ |
629 var = varobj_get_handle (argv[0]); | 624 var = varobj_get_handle (argv[0]); |
630 | 625 |
631 if (!varobj_editable_p (var)) | 626 if (!varobj_editable_p (var)) |
632 error (_("-var-assign: Variable object is not editable")); | 627 error (_("-var-assign: Variable object is not editable")); |
633 | 628 |
634 expression = xstrdup (argv[1]); | 629 expression = xstrdup (argv[1]); |
635 | 630 |
636 if (!varobj_set_value (var, expression)) | 631 if (!varobj_set_value (var, expression)) |
637 error (_("-var-assign: Could not assign " | 632 error (_("-var-assign: Could not assign " |
638 "expression to variable object")); | 633 "expression to variable object")); |
(...skipping 26 matching lines...) Expand all Loading... |
665 else | 660 else |
666 { | 661 { |
667 struct thread_info *tp = find_thread_id (thread_id); | 662 struct thread_info *tp = find_thread_id (thread_id); |
668 | 663 |
669 if (tp) | 664 if (tp) |
670 thread_stopped = is_stopped (tp->ptid); | 665 thread_stopped = is_stopped (tp->ptid); |
671 else | 666 else |
672 thread_stopped = 1; | 667 thread_stopped = 1; |
673 } | 668 } |
674 | 669 |
675 if (thread_stopped) | 670 if (thread_stopped |
676 if (!data->only_floating || varobj_floating_p (var)) | 671 && (!data->only_floating || varobj_floating_p (var))) |
677 varobj_update_one (var, data->print_values, 0 /* implicit */); | 672 varobj_update_one (var, data->print_values, 0 /* implicit */); |
678 } | 673 } |
679 | 674 |
680 void | 675 void |
681 mi_cmd_var_update (char *command, char **argv, int argc) | 676 mi_cmd_var_update (char *command, char **argv, int argc) |
682 { | 677 { |
683 struct ui_out *uiout = current_uiout; | 678 struct ui_out *uiout = current_uiout; |
684 struct cleanup *cleanup; | 679 struct cleanup *cleanup; |
685 char *name; | 680 char *name; |
686 enum print_values print_values; | 681 enum print_values print_values; |
687 | 682 |
688 if (argc != 1 && argc != 2) | 683 if (argc != 1 && argc != 2) |
689 error (_("-var-update: Usage: [PRINT_VALUES] NAME.")); | 684 error (_("-var-update: Usage: [PRINT_VALUES] NAME.")); |
690 | 685 |
691 if (argc == 1) | 686 if (argc == 1) |
692 name = argv[0]; | 687 name = argv[0]; |
693 else | 688 else |
694 name = (argv[1]); | 689 name = argv[1]; |
695 | 690 |
696 if (argc == 2) | 691 if (argc == 2) |
697 print_values = mi_parse_values_option (argv[0]); | 692 print_values = mi_parse_values_option (argv[0]); |
698 else | 693 else |
699 print_values = PRINT_NO_VALUES; | 694 print_values = PRINT_NO_VALUES; |
700 | 695 |
701 if (mi_version (uiout) <= 1) | 696 if (mi_version (uiout) <= 1) |
702 cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist"); | 697 cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist"); |
703 else | 698 else |
704 cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist"); | 699 cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist"); |
705 | 700 |
706 /* Check if the parameter is a "*" which means that we want | 701 /* Check if the parameter is a "*", which means that we want to |
707 to update all variables */ | 702 update all variables. */ |
708 | 703 |
709 if ((*name == '*' || *name == '@') && (*(name + 1) == '\0')) | 704 if ((*name == '*' || *name == '@') && (*(name + 1) == '\0')) |
710 { | 705 { |
711 struct mi_cmd_var_update data; | 706 struct mi_cmd_var_update data; |
712 | 707 |
713 data.only_floating = *name == '@'; | 708 data.only_floating = (*name == '@'); |
714 data.print_values = print_values; | 709 data.print_values = print_values; |
715 | 710 |
716 /* varobj_update_one automatically updates all the children of VAROBJ. | 711 /* varobj_update_one automatically updates all the children of |
717 » Therefore update each VAROBJ only once by iterating only the root | 712 » VAROBJ. Therefore update each VAROBJ only once by iterating |
718 » VAROBJs. */ | 713 » only the root VAROBJs. */ |
719 | 714 |
720 all_root_varobjs (mi_cmd_var_update_iter, &data); | 715 all_root_varobjs (mi_cmd_var_update_iter, &data); |
721 } | 716 } |
722 else | 717 else |
723 { | 718 { |
724 /* Get varobj handle, if a valid var obj name was specified */ | 719 /* Get varobj handle, if a valid var obj name was specified. */ |
725 struct varobj *var = varobj_get_handle (name); | 720 struct varobj *var = varobj_get_handle (name); |
726 | 721 |
727 varobj_update_one (var, print_values, 1 /* explicit */); | 722 varobj_update_one (var, print_values, 1 /* explicit */); |
728 } | 723 } |
729 | 724 |
730 do_cleanups (cleanup); | 725 do_cleanups (cleanup); |
731 } | 726 } |
732 | 727 |
733 /* Helper for mi_cmd_var_update(). */ | 728 /* Helper for mi_cmd_var_update(). */ |
734 | 729 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 do_cleanups (cleanup); | 823 do_cleanups (cleanup); |
829 } | 824 } |
830 VEC_free (varobj_update_result, changes); | 825 VEC_free (varobj_update_result, changes); |
831 } | 826 } |
832 | 827 |
833 void | 828 void |
834 mi_cmd_enable_pretty_printing (char *command, char **argv, int argc) | 829 mi_cmd_enable_pretty_printing (char *command, char **argv, int argc) |
835 { | 830 { |
836 if (argc != 0) | 831 if (argc != 0) |
837 error (_("-enable-pretty-printing: no arguments allowed")); | 832 error (_("-enable-pretty-printing: no arguments allowed")); |
| 833 |
838 varobj_enable_pretty_printing (); | 834 varobj_enable_pretty_printing (); |
839 } | 835 } |
840 | 836 |
841 void | 837 void |
842 mi_cmd_var_set_update_range (char *command, char **argv, int argc) | 838 mi_cmd_var_set_update_range (char *command, char **argv, int argc) |
843 { | 839 { |
844 struct varobj *var; | 840 struct varobj *var; |
845 int from, to; | 841 int from, to; |
846 | 842 |
847 if (argc != 3) | 843 if (argc != 3) |
848 error (_("-var-set-update-range: Usage: VAROBJ FROM TO")); | 844 error (_("-var-set-update-range: Usage: VAROBJ FROM TO")); |
849 | 845 |
850 var = varobj_get_handle (argv[0]); | 846 var = varobj_get_handle (argv[0]); |
851 from = atoi (argv[1]); | 847 from = atoi (argv[1]); |
852 to = atoi (argv[2]); | 848 to = atoi (argv[2]); |
853 | 849 |
854 varobj_set_child_range (var, from, to); | 850 varobj_set_child_range (var, from, to); |
855 } | 851 } |
OLD | NEW |