| OLD | NEW |
| 1 /* MI Command Set - stack commands. | 1 /* MI Command Set - stack commands. |
| 2 Copyright (C) 2000, 2002-2005, 2007-2012 Free Software Foundation, | 2 Copyright (C) 2000, 2002-2005, 2007-2012 Free Software Foundation, |
| 3 Inc. | 3 Inc. |
| 4 Contributed by Cygnus Solutions (a Red Hat company). | 4 Contributed by Cygnus Solutions (a Red Hat company). |
| 5 | 5 |
| 6 This file is part of GDB. | 6 This file is part of GDB. |
| 7 | 7 |
| 8 This program is free software; you can redistribute it and/or modify | 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 | 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 | 10 the Free Software Foundation; either version 3 of the License, or |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "language.h" | 32 #include "language.h" |
| 33 #include "valprint.h" | 33 #include "valprint.h" |
| 34 #include "exceptions.h" | 34 #include "exceptions.h" |
| 35 | 35 |
| 36 enum what_to_list { locals, arguments, all }; | 36 enum what_to_list { locals, arguments, all }; |
| 37 | 37 |
| 38 static void list_args_or_locals (enum what_to_list what, | 38 static void list_args_or_locals (enum what_to_list what, |
| 39 enum print_values values, | 39 enum print_values values, |
| 40 struct frame_info *fi); | 40 struct frame_info *fi); |
| 41 | 41 |
| 42 /* Print a list of the stack frames. Args can be none, in which case | 42 /* Print a list of the stack frames. Args can be none, in which case |
| 43 we want to print the whole backtrace, or a pair of numbers | 43 we want to print the whole backtrace, or a pair of numbers |
| 44 specifying the frame numbers at which to start and stop the | 44 specifying the frame numbers at which to start and stop the |
| 45 display. If the two numbers are equal, a single frame will be | 45 display. If the two numbers are equal, a single frame will be |
| 46 displayed. */ | 46 displayed. */ |
| 47 |
| 47 void | 48 void |
| 48 mi_cmd_stack_list_frames (char *command, char **argv, int argc) | 49 mi_cmd_stack_list_frames (char *command, char **argv, int argc) |
| 49 { | 50 { |
| 50 int frame_low; | 51 int frame_low; |
| 51 int frame_high; | 52 int frame_high; |
| 52 int i; | 53 int i; |
| 53 struct cleanup *cleanup_stack; | 54 struct cleanup *cleanup_stack; |
| 54 struct frame_info *fi; | 55 struct frame_info *fi; |
| 55 | 56 |
| 56 if (argc > 2 || argc == 1) | 57 if (argc > 2 || argc == 1) |
| 57 error (_("-stack-list-frames: Usage: [FRAME_LOW FRAME_HIGH]")); | 58 error (_("-stack-list-frames: Usage: [FRAME_LOW FRAME_HIGH]")); |
| 58 | 59 |
| 59 if (argc == 2) | 60 if (argc == 2) |
| 60 { | 61 { |
| 61 frame_low = atoi (argv[0]); | 62 frame_low = atoi (argv[0]); |
| 62 frame_high = atoi (argv[1]); | 63 frame_high = atoi (argv[1]); |
| 63 } | 64 } |
| 64 else | 65 else |
| 65 { | 66 { |
| 66 /* Called with no arguments, it means we want the whole | 67 /* Called with no arguments, it means we want the whole |
| 67 backtrace. */ | 68 backtrace. */ |
| 68 frame_low = -1; | 69 frame_low = -1; |
| 69 frame_high = -1; | 70 frame_high = -1; |
| 70 } | 71 } |
| 71 | 72 |
| 72 /* Let's position fi on the frame at which to start the | 73 /* Let's position fi on the frame at which to start the |
| 73 display. Could be the innermost frame if the whole stack needs | 74 display. Could be the innermost frame if the whole stack needs |
| 74 displaying, or if frame_low is 0. */ | 75 displaying, or if frame_low is 0. */ |
| 75 for (i = 0, fi = get_current_frame (); | 76 for (i = 0, fi = get_current_frame (); |
| 76 fi && i < frame_low; | 77 fi && i < frame_low; |
| 77 i++, fi = get_prev_frame (fi)); | 78 i++, fi = get_prev_frame (fi)); |
| 78 | 79 |
| 79 if (fi == NULL) | 80 if (fi == NULL) |
| 80 error (_("-stack-list-frames: Not enough frames in stack.")); | 81 error (_("-stack-list-frames: Not enough frames in stack.")); |
| 81 | 82 |
| 82 cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack"); | 83 cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack"); |
| 83 | 84 |
| 84 /* Now let;s print the frames up to frame_high, or until there are | 85 /* Now let's print the frames up to frame_high, or until there are |
| 85 frames in the stack. */ | 86 frames in the stack. */ |
| 86 for (; | 87 for (; |
| 87 fi && (i <= frame_high || frame_high == -1); | 88 fi && (i <= frame_high || frame_high == -1); |
| 88 i++, fi = get_prev_frame (fi)) | 89 i++, fi = get_prev_frame (fi)) |
| 89 { | 90 { |
| 90 QUIT; | 91 QUIT; |
| 91 /* Print the location and the address always, even for level 0. | 92 /* Print the location and the address always, even for level 0. |
| 92 args == 0: don't print the arguments. */ | 93 If args is 0, don't print the arguments. */ |
| 93 print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ ); | 94 print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ ); |
| 94 } | 95 } |
| 95 | 96 |
| 96 do_cleanups (cleanup_stack); | 97 do_cleanups (cleanup_stack); |
| 97 } | 98 } |
| 98 | 99 |
| 99 void | 100 void |
| 100 mi_cmd_stack_info_depth (char *command, char **argv, int argc) | 101 mi_cmd_stack_info_depth (char *command, char **argv, int argc) |
| 101 { | 102 { |
| 102 int frame_high; | 103 int frame_high; |
| 103 int i; | 104 int i; |
| 104 struct frame_info *fi; | 105 struct frame_info *fi; |
| 105 | 106 |
| 106 if (argc > 1) | 107 if (argc > 1) |
| 107 error (_("-stack-info-depth: Usage: [MAX_DEPTH]")); | 108 error (_("-stack-info-depth: Usage: [MAX_DEPTH]")); |
| 108 | 109 |
| 109 if (argc == 1) | 110 if (argc == 1) |
| 110 frame_high = atoi (argv[0]); | 111 frame_high = atoi (argv[0]); |
| 111 else | 112 else |
| 112 /* Called with no arguments, it means we want the real depth of | 113 /* Called with no arguments, it means we want the real depth of |
| 113 the stack. */ | 114 the stack. */ |
| 114 frame_high = -1; | 115 frame_high = -1; |
| 115 | 116 |
| 116 for (i = 0, fi = get_current_frame (); | 117 for (i = 0, fi = get_current_frame (); |
| 117 fi && (i < frame_high || frame_high == -1); | 118 fi && (i < frame_high || frame_high == -1); |
| 118 i++, fi = get_prev_frame (fi)) | 119 i++, fi = get_prev_frame (fi)) |
| 119 QUIT; | 120 QUIT; |
| 120 | 121 |
| 121 ui_out_field_int (current_uiout, "depth", i); | 122 ui_out_field_int (current_uiout, "depth", i); |
| 122 } | 123 } |
| 123 | 124 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 134 || strcmp (name, mi_simple_values) == 0) | 135 || strcmp (name, mi_simple_values) == 0) |
| 135 return PRINT_SIMPLE_VALUES; | 136 return PRINT_SIMPLE_VALUES; |
| 136 else | 137 else |
| 137 error (_("Unknown value for PRINT_VALUES: must be: \ | 138 error (_("Unknown value for PRINT_VALUES: must be: \ |
| 138 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), | 139 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), |
| 139 mi_no_values, mi_all_values, mi_simple_values); | 140 mi_no_values, mi_all_values, mi_simple_values); |
| 140 } | 141 } |
| 141 | 142 |
| 142 /* Print a list of the locals for the current frame. With argument of | 143 /* Print a list of the locals for the current frame. With argument of |
| 143 0, print only the names, with argument of 1 print also the | 144 0, print only the names, with argument of 1 print also the |
| 144 values. */ | 145 values. */ |
| 146 |
| 145 void | 147 void |
| 146 mi_cmd_stack_list_locals (char *command, char **argv, int argc) | 148 mi_cmd_stack_list_locals (char *command, char **argv, int argc) |
| 147 { | 149 { |
| 148 struct frame_info *frame; | 150 struct frame_info *frame; |
| 149 | 151 |
| 150 if (argc != 1) | 152 if (argc != 1) |
| 151 error (_("-stack-list-locals: Usage: PRINT_VALUES")); | 153 error (_("-stack-list-locals: Usage: PRINT_VALUES")); |
| 152 | 154 |
| 153 frame = get_selected_frame (NULL); | 155 frame = get_selected_frame (NULL); |
| 154 | 156 |
| 155 list_args_or_locals (locals, parse_print_values (argv[0]), frame); | 157 list_args_or_locals (locals, parse_print_values (argv[0]), frame); |
| 156 } | 158 } |
| 157 | 159 |
| 158 /* Print a list of the arguments for the current frame. With argument | 160 /* Print a list of the arguments for the current frame. With argument |
| 159 of 0, print only the names, with argument of 1 print also the | 161 of 0, print only the names, with argument of 1 print also the |
| 160 values. */ | 162 values. */ |
| 163 |
| 161 void | 164 void |
| 162 mi_cmd_stack_list_args (char *command, char **argv, int argc) | 165 mi_cmd_stack_list_args (char *command, char **argv, int argc) |
| 163 { | 166 { |
| 164 int frame_low; | 167 int frame_low; |
| 165 int frame_high; | 168 int frame_high; |
| 166 int i; | 169 int i; |
| 167 struct frame_info *fi; | 170 struct frame_info *fi; |
| 168 struct cleanup *cleanup_stack_args; | 171 struct cleanup *cleanup_stack_args; |
| 169 enum print_values print_values; | 172 enum print_values print_values; |
| 170 struct ui_out *uiout = current_uiout; | 173 struct ui_out *uiout = current_uiout; |
| 171 | 174 |
| 172 if (argc < 1 || argc > 3 || argc == 2) | 175 if (argc < 1 || argc > 3 || argc == 2) |
| 173 error (_("-stack-list-arguments: Usage: " | 176 error (_("-stack-list-arguments: Usage: " |
| 174 "PRINT_VALUES [FRAME_LOW FRAME_HIGH]")); | 177 "PRINT_VALUES [FRAME_LOW FRAME_HIGH]")); |
| 175 | 178 |
| 176 if (argc == 3) | 179 if (argc == 3) |
| 177 { | 180 { |
| 178 frame_low = atoi (argv[1]); | 181 frame_low = atoi (argv[1]); |
| 179 frame_high = atoi (argv[2]); | 182 frame_high = atoi (argv[2]); |
| 180 } | 183 } |
| 181 else | 184 else |
| 182 { | 185 { |
| 183 /* Called with no arguments, it means we want args for the whole | 186 /* Called with no arguments, it means we want args for the whole |
| 184 backtrace. */ | 187 backtrace. */ |
| 185 frame_low = -1; | 188 frame_low = -1; |
| 186 frame_high = -1; | 189 frame_high = -1; |
| 187 } | 190 } |
| 188 | 191 |
| 189 print_values = parse_print_values (argv[0]); | 192 print_values = parse_print_values (argv[0]); |
| 190 | 193 |
| 191 /* Let's position fi on the frame at which to start the | 194 /* Let's position fi on the frame at which to start the |
| 192 display. Could be the innermost frame if the whole stack needs | 195 display. Could be the innermost frame if the whole stack needs |
| 193 displaying, or if frame_low is 0. */ | 196 displaying, or if frame_low is 0. */ |
| 194 for (i = 0, fi = get_current_frame (); | 197 for (i = 0, fi = get_current_frame (); |
| 195 fi && i < frame_low; | 198 fi && i < frame_low; |
| 196 i++, fi = get_prev_frame (fi)); | 199 i++, fi = get_prev_frame (fi)); |
| 197 | 200 |
| 198 if (fi == NULL) | 201 if (fi == NULL) |
| 199 error (_("-stack-list-arguments: Not enough frames in stack.")); | 202 error (_("-stack-list-arguments: Not enough frames in stack.")); |
| 200 | 203 |
| 201 cleanup_stack_args | 204 cleanup_stack_args |
| 202 = make_cleanup_ui_out_list_begin_end (uiout, "stack-args"); | 205 = make_cleanup_ui_out_list_begin_end (uiout, "stack-args"); |
| 203 | 206 |
| 204 /* Now let's print the frames up to frame_high, or until there are | 207 /* Now let's print the frames up to frame_high, or until there are |
| 205 frames in the stack. */ | 208 frames in the stack. */ |
| 206 for (; | 209 for (; |
| 207 fi && (i <= frame_high || frame_high == -1); | 210 fi && (i <= frame_high || frame_high == -1); |
| 208 i++, fi = get_prev_frame (fi)) | 211 i++, fi = get_prev_frame (fi)) |
| 209 { | 212 { |
| 210 struct cleanup *cleanup_frame; | 213 struct cleanup *cleanup_frame; |
| 211 | 214 |
| 212 QUIT; | 215 QUIT; |
| 213 cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); | 216 cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); |
| 214 ui_out_field_int (uiout, "level", i); | 217 ui_out_field_int (uiout, "level", i); |
| 215 list_args_or_locals (arguments, print_values, fi); | 218 list_args_or_locals (arguments, print_values, fi); |
| 216 do_cleanups (cleanup_frame); | 219 do_cleanups (cleanup_frame); |
| 217 } | 220 } |
| 218 | 221 |
| 219 do_cleanups (cleanup_stack_args); | 222 do_cleanups (cleanup_stack_args); |
| 220 } | 223 } |
| 221 | 224 |
| 222 /* Print a list of the local variables (including arguments) for the | 225 /* Print a list of the local variables (including arguments) for the |
| 223 current frame. ARGC must be 1 and ARGV[0] specify if only the names, | 226 current frame. ARGC must be 1 and ARGV[0] specify if only the names, |
| 224 or both names and values of the variables must be printed. See | 227 or both names and values of the variables must be printed. See |
| 225 parse_print_value for possible values. */ | 228 parse_print_value for possible values. */ |
| 229 |
| 226 void | 230 void |
| 227 mi_cmd_stack_list_variables (char *command, char **argv, int argc) | 231 mi_cmd_stack_list_variables (char *command, char **argv, int argc) |
| 228 { | 232 { |
| 229 struct frame_info *frame; | 233 struct frame_info *frame; |
| 230 | 234 |
| 231 if (argc != 1) | 235 if (argc != 1) |
| 232 error (_("Usage: PRINT_VALUES")); | 236 error (_("Usage: PRINT_VALUES")); |
| 233 | 237 |
| 234 frame = get_selected_frame (NULL); | 238 frame = get_selected_frame (NULL); |
| 235 | 239 |
| 236 list_args_or_locals (all, parse_print_values (argv[0]), frame); | 240 list_args_or_locals (all, parse_print_values (argv[0]), frame); |
| 237 } | 241 } |
| 238 | 242 |
| 239 /* Print single local or argument. ARG must be already read in. For WHAT and | 243 /* Print single local or argument. ARG must be already read in. For |
| 240 VALUES see list_args_or_locals. | 244 WHAT and VALUES see list_args_or_locals. |
| 241 | 245 |
| 242 Errors are printed as if they would be the parameter value. Use zeroed ARG | 246 Errors are printed as if they would be the parameter value. Use |
| 243 iff it should not be printed accoring to VALUES. */ | 247 zeroed ARG iff it should not be printed according to VALUES. */ |
| 244 | 248 |
| 245 static void | 249 static void |
| 246 list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, | 250 list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, |
| 247 enum print_values values) | 251 enum print_values values) |
| 248 { | 252 { |
| 253 struct cleanup *old_chain; |
| 249 struct cleanup *cleanup_tuple = NULL; | 254 struct cleanup *cleanup_tuple = NULL; |
| 250 struct ui_out *uiout = current_uiout; | 255 struct ui_out *uiout = current_uiout; |
| 251 struct ui_stream *stb = ui_out_stream_new (uiout); | 256 struct ui_file *stb; |
| 257 |
| 258 stb = mem_fileopen (); |
| 259 old_chain = make_cleanup_ui_file_delete (stb); |
| 252 | 260 |
| 253 gdb_assert (!arg->val || !arg->error); | 261 gdb_assert (!arg->val || !arg->error); |
| 254 gdb_assert ((values == PRINT_NO_VALUES && arg->val == NULL | 262 gdb_assert ((values == PRINT_NO_VALUES && arg->val == NULL |
| 255 && arg->error == NULL) | 263 && arg->error == NULL) |
| 256 || values == PRINT_SIMPLE_VALUES | 264 || values == PRINT_SIMPLE_VALUES |
| 257 || (values == PRINT_ALL_VALUES | 265 || (values == PRINT_ALL_VALUES |
| 258 && (arg->val != NULL || arg->error != NULL))); | 266 && (arg->val != NULL || arg->error != NULL))); |
| 259 gdb_assert (arg->entry_kind == print_entry_values_no | 267 gdb_assert (arg->entry_kind == print_entry_values_no |
| 260 || (arg->entry_kind == print_entry_values_only | 268 || (arg->entry_kind == print_entry_values_only |
| 261 && (arg->val || arg->error))); | 269 && (arg->val || arg->error))); |
| 262 | 270 |
| 263 if (values != PRINT_NO_VALUES || what == all) | 271 if (values != PRINT_NO_VALUES || what == all) |
| 264 cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); | 272 cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); |
| 265 | 273 |
| 266 fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb->stream); | 274 fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb); |
| 267 if (arg->entry_kind == print_entry_values_only) | 275 if (arg->entry_kind == print_entry_values_only) |
| 268 fputs_filtered ("@entry", stb->stream); | 276 fputs_filtered ("@entry", stb); |
| 269 ui_out_field_stream (uiout, "name", stb); | 277 ui_out_field_stream (uiout, "name", stb); |
| 270 | 278 |
| 271 if (what == all && SYMBOL_IS_ARGUMENT (arg->sym)) | 279 if (what == all && SYMBOL_IS_ARGUMENT (arg->sym)) |
| 272 ui_out_field_int (uiout, "arg", 1); | 280 ui_out_field_int (uiout, "arg", 1); |
| 273 | 281 |
| 274 if (values == PRINT_SIMPLE_VALUES) | 282 if (values == PRINT_SIMPLE_VALUES) |
| 275 { | 283 { |
| 276 check_typedef (arg->sym->type); | 284 check_typedef (arg->sym->type); |
| 277 type_print (arg->sym->type, "", stb->stream, -1); | 285 type_print (arg->sym->type, "", stb, -1); |
| 278 ui_out_field_stream (uiout, "type", stb); | 286 ui_out_field_stream (uiout, "type", stb); |
| 279 } | 287 } |
| 280 | 288 |
| 281 if (arg->val || arg->error) | 289 if (arg->val || arg->error) |
| 282 { | 290 { |
| 283 volatile struct gdb_exception except; | 291 volatile struct gdb_exception except; |
| 284 | 292 |
| 285 if (arg->error) | 293 if (arg->error) |
| 286 except.message = arg->error; | 294 except.message = arg->error; |
| 287 else | 295 else |
| 288 { | 296 { |
| 289 /* TRY_CATCH has two statements, wrap it in a block. */ | 297 /* TRY_CATCH has two statements, wrap it in a block. */ |
| 290 | 298 |
| 291 TRY_CATCH (except, RETURN_MASK_ERROR) | 299 TRY_CATCH (except, RETURN_MASK_ERROR) |
| 292 { | 300 { |
| 293 struct value_print_options opts; | 301 struct value_print_options opts; |
| 294 | 302 |
| 295 get_raw_print_options (&opts); | 303 get_raw_print_options (&opts); |
| 296 opts.deref_ref = 1; | 304 opts.deref_ref = 1; |
| 297 » common_val_print (arg->val, stb->stream, 0, &opts, | 305 » common_val_print (arg->val, stb, 0, &opts, |
| 298 language_def (SYMBOL_LANGUAGE (arg->sym))); | 306 language_def (SYMBOL_LANGUAGE (arg->sym))); |
| 299 } | 307 } |
| 300 } | 308 } |
| 301 if (except.message) | 309 if (except.message) |
| 302 » fprintf_filtered (stb->stream, _("<error reading variable: %s>"), | 310 » fprintf_filtered (stb, _("<error reading variable: %s>"), |
| 303 except.message); | 311 except.message); |
| 304 ui_out_field_stream (uiout, "value", stb); | 312 ui_out_field_stream (uiout, "value", stb); |
| 305 } | 313 } |
| 306 | 314 |
| 307 ui_out_stream_delete (stb); | |
| 308 if (values != PRINT_NO_VALUES || what == all) | 315 if (values != PRINT_NO_VALUES || what == all) |
| 309 do_cleanups (cleanup_tuple); | 316 do_cleanups (cleanup_tuple); |
| 317 do_cleanups (old_chain); |
| 310 } | 318 } |
| 311 | 319 |
| 312 /* Print a list of the locals or the arguments for the currently | 320 /* Print a list of the locals or the arguments for the currently |
| 313 selected frame. If the argument passed is 0, printonly the names | 321 selected frame. If the argument passed is 0, printonly the names |
| 314 of the variables, if an argument of 1 is passed, print the values | 322 of the variables, if an argument of 1 is passed, print the values |
| 315 as well. */ | 323 as well. */ |
| 324 |
| 316 static void | 325 static void |
| 317 list_args_or_locals (enum what_to_list what, enum print_values values, | 326 list_args_or_locals (enum what_to_list what, enum print_values values, |
| 318 struct frame_info *fi) | 327 struct frame_info *fi) |
| 319 { | 328 { |
| 320 struct block *block; | 329 struct block *block; |
| 321 struct symbol *sym; | 330 struct symbol *sym; |
| 322 struct dict_iterator iter; | 331 struct block_iterator iter; |
| 323 struct cleanup *cleanup_list; | 332 struct cleanup *cleanup_list; |
| 324 struct ui_stream *stb; | |
| 325 struct type *type; | 333 struct type *type; |
| 326 char *name_of_result; | 334 char *name_of_result; |
| 327 struct ui_out *uiout = current_uiout; | 335 struct ui_out *uiout = current_uiout; |
| 328 | 336 |
| 329 stb = ui_out_stream_new (uiout); | |
| 330 | |
| 331 block = get_frame_block (fi, 0); | 337 block = get_frame_block (fi, 0); |
| 332 | 338 |
| 333 switch (what) | 339 switch (what) |
| 334 { | 340 { |
| 335 case locals: | 341 case locals: |
| 336 name_of_result = "locals"; | 342 name_of_result = "locals"; |
| 337 break; | 343 break; |
| 338 case arguments: | 344 case arguments: |
| 339 name_of_result = "args"; | 345 name_of_result = "args"; |
| 340 break; | 346 break; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 else | 388 else |
| 383 print_me = SYMBOL_IS_ARGUMENT (sym); | 389 print_me = SYMBOL_IS_ARGUMENT (sym); |
| 384 break; | 390 break; |
| 385 } | 391 } |
| 386 if (print_me) | 392 if (print_me) |
| 387 { | 393 { |
| 388 struct symbol *sym2; | 394 struct symbol *sym2; |
| 389 struct frame_arg arg, entryarg; | 395 struct frame_arg arg, entryarg; |
| 390 | 396 |
| 391 if (SYMBOL_IS_ARGUMENT (sym)) | 397 if (SYMBOL_IS_ARGUMENT (sym)) |
| 392 » » sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym), | 398 » » sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), |
| 393 block, VAR_DOMAIN, | 399 block, VAR_DOMAIN, |
| 394 (int *) NULL); | 400 (int *) NULL); |
| 395 else | 401 else |
| 396 sym2 = sym; | 402 sym2 = sym; |
| 403 gdb_assert (sym2 != NULL); |
| 397 | 404 |
| 398 memset (&arg, 0, sizeof (arg)); | 405 memset (&arg, 0, sizeof (arg)); |
| 399 arg.sym = sym2; | 406 arg.sym = sym2; |
| 400 arg.entry_kind = print_entry_values_no; | 407 arg.entry_kind = print_entry_values_no; |
| 401 memset (&entryarg, 0, sizeof (entryarg)); | 408 memset (&entryarg, 0, sizeof (entryarg)); |
| 402 entryarg.sym = sym2; | 409 entryarg.sym = sym2; |
| 403 entryarg.entry_kind = print_entry_values_no; | 410 entryarg.entry_kind = print_entry_values_no; |
| 404 | 411 |
| 405 switch (values) | 412 switch (values) |
| 406 { | 413 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 417 } | 424 } |
| 418 | 425 |
| 419 if (arg.entry_kind != print_entry_values_only) | 426 if (arg.entry_kind != print_entry_values_only) |
| 420 list_arg_or_local (&arg, what, values); | 427 list_arg_or_local (&arg, what, values); |
| 421 if (entryarg.entry_kind != print_entry_values_no) | 428 if (entryarg.entry_kind != print_entry_values_no) |
| 422 list_arg_or_local (&entryarg, what, values); | 429 list_arg_or_local (&entryarg, what, values); |
| 423 xfree (arg.error); | 430 xfree (arg.error); |
| 424 xfree (entryarg.error); | 431 xfree (entryarg.error); |
| 425 } | 432 } |
| 426 } | 433 } |
| 434 |
| 427 if (BLOCK_FUNCTION (block)) | 435 if (BLOCK_FUNCTION (block)) |
| 428 break; | 436 break; |
| 429 else | 437 else |
| 430 block = BLOCK_SUPERBLOCK (block); | 438 block = BLOCK_SUPERBLOCK (block); |
| 431 } | 439 } |
| 432 do_cleanups (cleanup_list); | 440 do_cleanups (cleanup_list); |
| 433 ui_out_stream_delete (stb); | |
| 434 } | 441 } |
| 435 | 442 |
| 436 void | 443 void |
| 437 mi_cmd_stack_select_frame (char *command, char **argv, int argc) | 444 mi_cmd_stack_select_frame (char *command, char **argv, int argc) |
| 438 { | 445 { |
| 439 if (argc == 0 || argc > 1) | 446 if (argc == 0 || argc > 1) |
| 440 error (_("-stack-select-frame: Usage: FRAME_SPEC")); | 447 error (_("-stack-select-frame: Usage: FRAME_SPEC")); |
| 441 | 448 |
| 442 select_frame_command (argv[0], 1 /* not used */ ); | 449 select_frame_command (argv[0], 1 /* not used */ ); |
| 443 } | 450 } |
| 444 | 451 |
| 445 void | 452 void |
| 446 mi_cmd_stack_info_frame (char *command, char **argv, int argc) | 453 mi_cmd_stack_info_frame (char *command, char **argv, int argc) |
| 447 { | 454 { |
| 448 if (argc > 0) | 455 if (argc > 0) |
| 449 error (_("-stack-info-frame: No arguments required")); | 456 error (_("-stack-info-frame: No arguments allowed")); |
| 450 | 457 |
| 451 print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0); | 458 print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0); |
| 452 } | 459 } |
| OLD | NEW |