Index: gdb/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.10656 diff -u -p -r1.10656 ChangeLog --- gdb/ChangeLog 30 Jun 2009 09:24:46 -0000 1.10656 +++ gdb/ChangeLog 30 Jun 2009 09:36:17 -0000 @@ -1,5 +1,10 @@ 2009-06-30 Vladimir Prus + * mi/mi-cmd-stack.c (parse_print_values): New. + (mi_cmd_stack_list_locals, mi_cmd_stack_list_args): Use the above. + +2009-06-30 Vladimir Prus + * varobj.c (varobj_get_type): Use type_to_string. 2009-06-29 Pedro Alves Index: gdb/mi/mi-cmd-stack.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v retrieving revision 1.43 diff -u -p -r1.43 mi-cmd-stack.c --- gdb/mi/mi-cmd-stack.c 3 Jan 2009 05:57:57 -0000 1.43 +++ gdb/mi/mi-cmd-stack.c 30 Jun 2009 09:36:17 -0000 @@ -116,6 +116,24 @@ mi_cmd_stack_info_depth (char *command, ui_out_field_int (uiout, "depth", i); } +static enum print_values +parse_print_values (char *name) +{ + if (strcmp (name, "0") == 0 + || strcmp (name, mi_no_values) == 0) + return PRINT_NO_VALUES; + else if (strcmp (name, "1") == 0 + || strcmp (name, mi_all_values) == 0) + return PRINT_ALL_VALUES; + else if (strcmp (name, "2") == 0 + || strcmp (name, mi_simple_values) == 0) + return PRINT_SIMPLE_VALUES; + else + error (_("Unknown value for PRINT_VALUES: must be: \ +0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), + mi_no_values, mi_all_values, mi_simple_values); +} + /* Print a list of the locals for the current frame. With argument of 0, print only the names, with argument of 1 print also the values. */ @@ -130,20 +148,7 @@ mi_cmd_stack_list_locals (char *command, frame = get_selected_frame (NULL); - if (strcmp (argv[0], "0") == 0 - || strcmp (argv[0], mi_no_values) == 0) - print_values = PRINT_NO_VALUES; - else if (strcmp (argv[0], "1") == 0 - || strcmp (argv[0], mi_all_values) == 0) - print_values = PRINT_ALL_VALUES; - else if (strcmp (argv[0], "2") == 0 - || strcmp (argv[0], mi_simple_values) == 0) - print_values = PRINT_SIMPLE_VALUES; - else - error (_("Unknown value for PRINT_VALUES: must be: \ -0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), - mi_no_values, mi_all_values, mi_simple_values); - list_args_or_locals (1, print_values, frame); + list_args_or_locals (1, parse_print_values (argv[0]), frame); } /* Print a list of the arguments for the current frame. With argument @@ -157,6 +162,7 @@ mi_cmd_stack_list_args (char *command, c int i; struct frame_info *fi; struct cleanup *cleanup_stack_args; + enum print_values print_values; if (argc < 1 || argc > 3 || argc == 2) error (_("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]")); @@ -174,6 +180,8 @@ mi_cmd_stack_list_args (char *command, c frame_high = -1; } + print_values = parse_print_values (argv[0]); + /* Let's position fi on the frame at which to start the display. Could be the innermost frame if the whole stack needs displaying, or if frame_low is 0. */ @@ -196,7 +204,7 @@ mi_cmd_stack_list_args (char *command, c QUIT; cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); ui_out_field_int (uiout, "level", i); - list_args_or_locals (0, atoi (argv[0]), fi); + list_args_or_locals (0, print_values, fi); do_cleanups (cleanup_frame); } Index: gdb/testsuite/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v retrieving revision 1.1902 diff -u -p -r1.1902 ChangeLog --- gdb/testsuite/ChangeLog 29 Jun 2009 18:53:55 -0000 1.1902 +++ gdb/testsuite/ChangeLog 30 Jun 2009 09:36:18 -0000 @@ -1,3 +1,8 @@ +2009-06-30 Vladimir Prus + + * gdb.mi/mi-stack.exp: Testing symbolic options + to -stack-list-locals and -stack-list-arguments. + 2009-06-29 Jan Kratochvil * gdb.threads/current-lwp-dead.exp, gdb.threads/current-lwp-dead.c: New. Index: gdb/testsuite/gdb.mi/mi-stack.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v retrieving revision 1.28 diff -u -p -r1.28 mi-stack.exp --- gdb/testsuite/gdb.mi/mi-stack.exp 3 Jan 2009 05:58:06 -0000 1.28 +++ gdb/testsuite/gdb.mi/mi-stack.exp 30 Jun 2009 09:36:18 -0000 @@ -115,7 +115,7 @@ proc test_stack_args_listing {} { "232\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\}\\\]" \ "stack args listing 1 1 1" - mi_gdb_test "233-stack-list-arguments 1 1 3" \ + mi_gdb_test "233-stack-list-arguments --all-values 1 3" \ "233\\^done,stack-args=\\\[frame=\{level=\"1\",args=\\\[\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"2\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\\\]\},frame=\{level=\"3\",args=\\\[\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\\\]\}\\\]" \ "stack args listing 1 1 3" @@ -180,7 +180,7 @@ mi_execute_to "exec-next 4" "end-steppin "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\},\{name=\"D\",value=\"\\{0, 1, 2\\}\"\}\\\]" \ "stack locals listing of names and values" - mi_gdb_test "232-stack-list-locals 2" \ + mi_gdb_test "232-stack-list-locals --simple-values" \ "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\},\{name=\"D\",type=\"int \\\[3\\\]\"\}\\\]" \ "stack locals listing, simple types: names and values, complex type: names and types"