stack.c (19370) | stack.c (46283) |
---|---|
1/* Print and select stack frames for GDB, the GNU debugger. | 1/* Print and select stack frames for GDB, the GNU debugger. |
2 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996 | 2 Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 98, 1999 |
3 Free Software Foundation, Inc. 4 5This file is part of GDB. 6 7This program is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2 of the License, or 10(at your option) any later version. 11 12This program is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with this program; if not, write to the Free Software 19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 20 | 3 Free Software Foundation, Inc. 4 5This file is part of GDB. 6 7This program is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2 of the License, or 10(at your option) any later version. 11 12This program is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with this program; if not, write to the Free Software 19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 20 |
21 | 21#include <ctype.h> |
22#include "defs.h" 23#include "gdb_string.h" 24#include "value.h" 25#include "symtab.h" 26#include "gdbtypes.h" 27#include "expression.h" 28#include "language.h" 29#include "frame.h" 30#include "gdbcmd.h" 31#include "gdbcore.h" 32#include "target.h" 33#include "breakpoint.h" 34#include "demangle.h" 35#include "inferior.h" 36#include "annotate.h" 37#include "symfile.h" 38#include "objfiles.h" 39 | 22#include "defs.h" 23#include "gdb_string.h" 24#include "value.h" 25#include "symtab.h" 26#include "gdbtypes.h" 27#include "expression.h" 28#include "language.h" 29#include "frame.h" 30#include "gdbcmd.h" 31#include "gdbcore.h" 32#include "target.h" 33#include "breakpoint.h" 34#include "demangle.h" 35#include "inferior.h" 36#include "annotate.h" 37#include "symfile.h" 38#include "objfiles.h" 39 |
40/* Prototypes for exported functions. */ 41 42void args_info PARAMS ((char *, int)); 43 44void locals_info PARAMS ((char *, int)); 45 46void (*selected_frame_level_changed_hook) PARAMS ((int)); 47 48void _initialize_stack PARAMS ((void)); 49 50/* Prototypes for local functions. */ 51 |
|
40static void return_command PARAMS ((char *, int)); 41 42static void down_command PARAMS ((char *, int)); 43 | 52static void return_command PARAMS ((char *, int)); 53 54static void down_command PARAMS ((char *, int)); 55 |
56static void down_silently_base PARAMS ((char *)); 57 |
|
44static void down_silently_command PARAMS ((char *, int)); 45 46static void up_command PARAMS ((char *, int)); 47 | 58static void down_silently_command PARAMS ((char *, int)); 59 60static void up_command PARAMS ((char *, int)); 61 |
62static void up_silently_base PARAMS ((char *)); 63 |
|
48static void up_silently_command PARAMS ((char *, int)); 49 | 64static void up_silently_command PARAMS ((char *, int)); 65 |
50static void frame_command PARAMS ((char *, int)); | 66void frame_command PARAMS ((char *, int)); |
51 52static void select_frame_command PARAMS ((char *, int)); 53 | 67 68static void select_frame_command PARAMS ((char *, int)); 69 |
54static void args_info PARAMS ((char *, int)); 55 | |
56static void print_frame_arg_vars PARAMS ((struct frame_info *, GDB_FILE *)); 57 58static void catch_info PARAMS ((char *, int)); 59 | 70static void print_frame_arg_vars PARAMS ((struct frame_info *, GDB_FILE *)); 71 72static void catch_info PARAMS ((char *, int)); 73 |
60static void locals_info PARAMS ((char *, int)); | 74static void args_plus_locals_info PARAMS ((char *, int)); |
61 | 75 |
62static void print_frame_label_vars PARAMS ((struct frame_info *, int, | 76static void print_frame_label_vars PARAMS ((struct frame_info *, 77 int, |
63 GDB_FILE *)); 64 | 78 GDB_FILE *)); 79 |
65static void print_frame_local_vars PARAMS ((struct frame_info *, GDB_FILE *)); | 80static void print_frame_local_vars PARAMS ((struct frame_info *, 81 int, 82 GDB_FILE *)); |
66 67static int print_block_frame_labels PARAMS ((struct block *, int *, 68 GDB_FILE *)); 69 70static int print_block_frame_locals PARAMS ((struct block *, 71 struct frame_info *, | 83 84static int print_block_frame_labels PARAMS ((struct block *, int *, 85 GDB_FILE *)); 86 87static int print_block_frame_locals PARAMS ((struct block *, 88 struct frame_info *, |
89 int, |
|
72 GDB_FILE *)); 73 | 90 GDB_FILE *)); 91 |
92static void print_frame_info_base PARAMS ((struct frame_info *, int, int, int)); 93 94static void print_stack_frame_base PARAMS ((struct frame_info *, int, int)); 95 |
|
74static void backtrace_command PARAMS ((char *, int)); 75 | 96static void backtrace_command PARAMS ((char *, int)); 97 |
76static struct frame_info *parse_frame_specification PARAMS ((char *)); | 98struct frame_info *parse_frame_specification PARAMS ((char *)); |
77 78static void frame_info PARAMS ((char *, int)); 79 80extern int addressprint; /* Print addresses, or stay symbolic only? */ 81extern int info_verbose; /* Verbosity of symbol reading msgs */ 82extern int lines_to_list; /* # of lines "list" command shows by default */ 83 84/* The "selected" stack frame is used by default for local and arg access. --- 18 unchanged lines hidden (view full) --- 103 104struct print_stack_frame_args { 105 struct frame_info *fi; 106 int level; 107 int source; 108 int args; 109}; 110 | 99 100static void frame_info PARAMS ((char *, int)); 101 102extern int addressprint; /* Print addresses, or stay symbolic only? */ 103extern int info_verbose; /* Verbosity of symbol reading msgs */ 104extern int lines_to_list; /* # of lines "list" command shows by default */ 105 106/* The "selected" stack frame is used by default for local and arg access. --- 18 unchanged lines hidden (view full) --- 125 126struct print_stack_frame_args { 127 struct frame_info *fi; 128 int level; 129 int source; 130 int args; 131}; 132 |
111static int print_stack_frame_stub PARAMS ((char *)); | 133static int print_stack_frame_base_stub PARAMS ((char *)); |
112 | 134 |
113/* Pass the args the way catch_errors wants them. */ | 135/* Show and print the frame arguments. 136 Pass the args the way catch_errors wants them. */ |
114static int | 137static int |
115print_stack_frame_stub (args) | 138show_and_print_stack_frame_stub (args) |
116 char *args; 117{ 118 struct print_stack_frame_args *p = (struct print_stack_frame_args *)args; 119 | 139 char *args; 140{ 141 struct print_stack_frame_args *p = (struct print_stack_frame_args *)args; 142 |
143 /* Reversed order of these so tuiDo() doesn't occur 144 * in the middle of "Breakpoint 1 ... [location]" printing = RT 145 */ 146 if (tui_version) 147 print_frame_info_base (p->fi, p->level, p->source, p->args); |
|
120 print_frame_info (p->fi, p->level, p->source, p->args); | 148 print_frame_info (p->fi, p->level, p->source, p->args); |
149 |
|
121 return 0; 122} 123 | 150 return 0; 151} 152 |
153/* Show or print the frame arguments. 154 Pass the args the way catch_errors wants them. */ 155static int 156print_stack_frame_stub (args) 157 char *args; 158{ 159 struct print_stack_frame_args *p = (struct print_stack_frame_args *)args; 160 161 if (tui_version) 162 print_frame_info (p->fi, p->level, p->source, p->args); 163 else 164 print_frame_info_base (p->fi, p->level, p->source, p->args); 165 return 0; 166} 167 |
|
124/* Print a stack frame briefly. FRAME_INFI should be the frame info | 168/* Print a stack frame briefly. FRAME_INFI should be the frame info |
169 and LEVEL should be its level in the stack (or -1 for level not 170 defined). */ 171 172/* Pass the args the way catch_errors wants them. */ 173static int 174print_stack_frame_base_stub (args) 175 char *args; 176{ 177 struct print_stack_frame_args *p = (struct print_stack_frame_args *)args; 178 179 print_frame_info_base (p->fi, p->level, p->source, p->args); 180 return 0; 181} 182 183/* print the frame arguments to the terminal. 184 Pass the args the way catch_errors wants them. */ 185static int 186print_only_stack_frame_stub (args) 187 char *args; 188{ 189 struct print_stack_frame_args *p = (struct print_stack_frame_args *)args; 190 191 print_frame_info_base (p->fi, p->level, p->source, p->args); 192 return 0; 193} 194 195/* Print a stack frame briefly. FRAME_INFI should be the frame info |
|
125 and LEVEL should be its level in the stack (or -1 for level not defined). 126 This prints the level, the function executing, the arguments, 127 and the file name and line number. 128 If the pc is not at the beginning of the source line, 129 the actual pc is printed at the beginning. 130 131 If SOURCE is 1, print the source line as well. 132 If SOURCE is -1, print ONLY the source line. */ 133 | 196 and LEVEL should be its level in the stack (or -1 for level not defined). 197 This prints the level, the function executing, the arguments, 198 and the file name and line number. 199 If the pc is not at the beginning of the source line, 200 the actual pc is printed at the beginning. 201 202 If SOURCE is 1, print the source line as well. 203 If SOURCE is -1, print ONLY the source line. */ 204 |
205static void 206print_stack_frame_base (fi, level, source) 207 struct frame_info *fi; 208 int level; 209 int source; 210{ 211 struct print_stack_frame_args args; 212 213 args.fi = fi; 214 args.level = level; 215 args.source = source; 216 args.args = 1; 217 218 catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL); 219} 220 221/* Show and print a stack frame briefly. FRAME_INFI should be the frame info 222 and LEVEL should be its level in the stack (or -1 for level not defined). 223 This prints the level, the function executing, the arguments, 224 and the file name and line number. 225 If the pc is not at the beginning of the source line, 226 the actual pc is printed at the beginning. 227 228 If SOURCE is 1, print the source line as well. 229 If SOURCE is -1, print ONLY the source line. */ 230 |
|
134void | 231void |
232show_and_print_stack_frame (fi, level, source) 233 struct frame_info *fi; 234 int level; 235 int source; 236{ 237 struct print_stack_frame_args args; 238 239 args.fi = fi; 240 args.level = level; 241 args.source = source; 242 args.args = 1; 243 244 catch_errors (show_and_print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL); 245} 246 247 248/* Show or print a stack frame briefly. FRAME_INFI should be the frame info 249 and LEVEL should be its level in the stack (or -1 for level not defined). 250 This prints the level, the function executing, the arguments, 251 and the file name and line number. 252 If the pc is not at the beginning of the source line, 253 the actual pc is printed at the beginning. 254 255 If SOURCE is 1, print the source line as well. 256 If SOURCE is -1, print ONLY the source line. */ 257 258void |
|
135print_stack_frame (fi, level, source) 136 struct frame_info *fi; 137 int level; 138 int source; 139{ 140 struct print_stack_frame_args args; 141 142 args.fi = fi; 143 args.level = level; 144 args.source = source; 145 args.args = 1; 146 147 catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL); 148} 149 | 259print_stack_frame (fi, level, source) 260 struct frame_info *fi; 261 int level; 262 int source; 263{ 264 struct print_stack_frame_args args; 265 266 args.fi = fi; 267 args.level = level; 268 args.source = source; 269 args.args = 1; 270 271 catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL); 272} 273 |
274/* Print a stack frame briefly. FRAME_INFI should be the frame info 275 and LEVEL should be its level in the stack (or -1 for level not defined). 276 This prints the level, the function executing, the arguments, 277 and the file name and line number. 278 If the pc is not at the beginning of the source line, 279 the actual pc is printed at the beginning. 280 281 If SOURCE is 1, print the source line as well. 282 If SOURCE is -1, print ONLY the source line. */ 283 284void 285print_only_stack_frame (fi, level, source) 286 struct frame_info *fi; 287 int level; 288 int source; 289{ 290 struct print_stack_frame_args args; 291 292 args.fi = fi; 293 args.level = level; 294 args.source = source; 295 args.args = 1; 296 297 catch_errors (print_only_stack_frame_stub, 298 (char *)&args, "", RETURN_MASK_ALL); 299} 300 |
|
150struct print_args_args { 151 struct symbol *func; 152 struct frame_info *fi; 153}; 154 | 301struct print_args_args { 302 struct symbol *func; 303 struct frame_info *fi; 304}; 305 |
155static int print_args_stub PARAMS ((char *)); | 306static int print_args_stub PARAMS ((PTR)); |
156 157/* Pass the args the way catch_errors wants them. */ 158 159static int 160print_args_stub (args) | 307 308/* Pass the args the way catch_errors wants them. */ 309 310static int 311print_args_stub (args) |
161 char *args; | 312 PTR args; |
162{ 163 int numargs; 164 struct print_args_args *p = (struct print_args_args *)args; 165 166 FRAME_NUM_ARGS (numargs, (p->fi)); 167 print_frame_args (p->func, p->fi, numargs, gdb_stdout); 168 return 0; 169} 170 | 313{ 314 int numargs; 315 struct print_args_args *p = (struct print_args_args *)args; 316 317 FRAME_NUM_ARGS (numargs, (p->fi)); 318 print_frame_args (p->func, p->fi, numargs, gdb_stdout); 319 return 0; 320} 321 |
171/* LEVEL is the level of the frame, or -1 if it is the innermost frame 172 but we don't want to print the level. */ | 322/* Print information about a frame for frame "fi" at level "level". 323 * Used in "where" output, also used to emit breakpoint or step messages. 324 * LEVEL is the level of the frame, or -1 if it is the innermost frame 325 * but we don't want to print the level. 326 * The meaning of the SOURCE argument is: 327 * -1: Print only source line 328 * 0: Print only location 329 * 1: Print location and source line 330 */ |
173 | 331 |
174void 175print_frame_info (fi, level, source, args) | 332static void 333print_frame_info_base (fi, level, source, args) |
176 struct frame_info *fi; | 334 struct frame_info *fi; |
177 register int level; | 335 int level; |
178 int source; 179 int args; 180{ 181 struct symtab_and_line sal; 182 struct symbol *func; 183 register char *funname = 0; 184 enum language funlang = language_unknown; 185 --- 89 unchanged lines hidden (view full) --- 275 /* We also don't know anything about the function besides 276 its address and name. */ 277 func = 0; 278 funname = SYMBOL_NAME (msymbol); 279 funlang = SYMBOL_LANGUAGE (msymbol); 280 } 281 else 282 { | 336 int source; 337 int args; 338{ 339 struct symtab_and_line sal; 340 struct symbol *func; 341 register char *funname = 0; 342 enum language funlang = language_unknown; 343 --- 89 unchanged lines hidden (view full) --- 433 /* We also don't know anything about the function besides 434 its address and name. */ 435 func = 0; 436 funname = SYMBOL_NAME (msymbol); 437 funlang = SYMBOL_LANGUAGE (msymbol); 438 } 439 else 440 { |
441 /* I'd like to use SYMBOL_SOURCE_NAME() here, to display 442 * the demangled name that we already have stored in 443 * the symbol table, but we stored a version with 444 * DMGL_PARAMS turned on, and here we don't want 445 * to display parameters. So call the demangler again, 446 * with DMGL_ANSI only. RT 447 * (Yes, I know that printf_symbol_filtered() will 448 * again try to demangle the name on the fly, but 449 * the issue is that if cplus_demangle() fails here, 450 * it'll fail there too. So we want to catch the failure 451 * ("demangled==NULL" case below) here, while we still 452 * have our hands on the function symbol.) 453 */ 454 char * demangled; |
|
283 funname = SYMBOL_NAME (func); 284 funlang = SYMBOL_LANGUAGE (func); | 455 funname = SYMBOL_NAME (func); 456 funlang = SYMBOL_LANGUAGE (func); |
457 if (funlang == language_cplus) { 458 demangled = cplus_demangle (funname, DMGL_ANSI); 459 if (demangled == NULL) 460 /* If the demangler fails, try the demangled name 461 * from the symbol table. This'll have parameters, 462 * but that's preferable to diplaying a mangled name. 463 */ 464 funname = SYMBOL_SOURCE_NAME (func); 465 } |
|
285 } 286 } 287 else 288 { | 466 } 467 } 468 else 469 { |
289 if (find_pc_section (fi->pc)) | 470 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); 471 if (msymbol != NULL) |
290 { | 472 { |
291 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); 292 if (msymbol != NULL) 293 { 294 funname = SYMBOL_NAME (msymbol); 295 funlang = SYMBOL_LANGUAGE (msymbol); 296 } | 473 funname = SYMBOL_NAME (msymbol); 474 funlang = SYMBOL_LANGUAGE (msymbol); |
297 } 298 } 299 300 if (source >= 0 || !sal.symtab) 301 { 302 annotate_frame_begin (level == -1 ? 0 : level, fi->pc); 303 304 if (level >= 0) --- 12 unchanged lines hidden (view full) --- 317 wrap_here (" "); 318 annotate_frame_args (); 319 fputs_filtered (" (", gdb_stdout); 320 if (args) 321 { 322 struct print_args_args args; 323 args.fi = fi; 324 args.func = func; | 475 } 476 } 477 478 if (source >= 0 || !sal.symtab) 479 { 480 annotate_frame_begin (level == -1 ? 0 : level, fi->pc); 481 482 if (level >= 0) --- 12 unchanged lines hidden (view full) --- 495 wrap_here (" "); 496 annotate_frame_args (); 497 fputs_filtered (" (", gdb_stdout); 498 if (args) 499 { 500 struct print_args_args args; 501 args.fi = fi; 502 args.func = func; |
325 catch_errors (print_args_stub, (char *)&args, "", RETURN_MASK_ALL); | 503 catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL); |
326 QUIT; 327 } 328 printf_filtered (")"); 329 if (sal.symtab && sal.symtab->filename) 330 { 331 annotate_frame_source_begin (); 332 wrap_here (" "); 333 printf_filtered (" at "); --- 13 unchanged lines hidden (view full) --- 347 if (!funname) 348 { 349 annotate_frame_where (); 350 wrap_here (" "); 351 printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc)); 352 } 353#endif 354#ifdef PC_SOLIB | 504 QUIT; 505 } 506 printf_filtered (")"); 507 if (sal.symtab && sal.symtab->filename) 508 { 509 annotate_frame_source_begin (); 510 wrap_here (" "); 511 printf_filtered (" at "); --- 13 unchanged lines hidden (view full) --- 525 if (!funname) 526 { 527 annotate_frame_where (); 528 wrap_here (" "); 529 printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc)); 530 } 531#endif 532#ifdef PC_SOLIB |
355 if (!funname) | 533 if (!funname || (!sal.symtab || !sal.symtab->filename)) |
356 { 357 char *lib = PC_SOLIB (fi->pc); 358 if (lib) 359 { 360 annotate_frame_where (); 361 wrap_here (" "); 362 printf_filtered (" from %s", lib); 363 } --- 6 unchanged lines hidden (view full) --- 370 { 371 int done = 0; 372 int mid_statement = source < 0 && fi->pc != sal.pc; 373 if (annotation_level) 374 done = identify_source_line (sal.symtab, sal.line, mid_statement, 375 fi->pc); 376 if (!done) 377 { | 534 { 535 char *lib = PC_SOLIB (fi->pc); 536 if (lib) 537 { 538 annotate_frame_where (); 539 wrap_here (" "); 540 printf_filtered (" from %s", lib); 541 } --- 6 unchanged lines hidden (view full) --- 548 { 549 int done = 0; 550 int mid_statement = source < 0 && fi->pc != sal.pc; 551 if (annotation_level) 552 done = identify_source_line (sal.symtab, sal.line, mid_statement, 553 fi->pc); 554 if (!done) 555 { |
378 if (addressprint && mid_statement) | 556 if (addressprint && mid_statement && !tui_version) |
379 { 380 print_address_numeric (fi->pc, 1, gdb_stdout); 381 printf_filtered ("\t"); 382 } 383 if (print_frame_info_listing_hook) 384 print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0); | 557 { 558 print_address_numeric (fi->pc, 1, gdb_stdout); 559 printf_filtered ("\t"); 560 } 561 if (print_frame_info_listing_hook) 562 print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0); |
385 else | 563 else if (!tui_version) |
386 print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); 387 } 388 current_source_line = max (sal.line - lines_to_list/2, 1); 389 } 390 if (source != 0) 391 set_default_breakpoint (1, fi->pc, sal.symtab, sal.line); 392 393 annotate_frame_end (); 394 395 gdb_flush (gdb_stdout); 396} | 564 print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); 565 } 566 current_source_line = max (sal.line - lines_to_list/2, 1); 567 } 568 if (source != 0) 569 set_default_breakpoint (1, fi->pc, sal.symtab, sal.line); 570 571 annotate_frame_end (); 572 573 gdb_flush (gdb_stdout); 574} |
575 |
|
397 | 576 |
577void 578stack_publish_stopped_with_no_frame() 579{ 580 TUIDO(((TuiOpaqueFuncPtr)tuiUpdateOnEnd)); 581 582 return; 583} 584 585/* Show or print the frame info. If this is the tui, it will be shown in 586 the source display */ 587void 588print_frame_info(fi, level, source, args) 589 struct frame_info *fi; 590 register int level; 591 int source; 592 int args; 593{ 594 if (!tui_version) 595 print_frame_info_base(fi, level, source, args); 596 else 597 { 598 if (fi && (frame_in_dummy(fi) || fi->signal_handler_caller)) 599 print_frame_info_base(fi, level, source, args); 600 else 601 { 602 TUIDO(((TuiOpaqueFuncPtr)tui_vShowFrameInfo, fi)); 603 } 604 } 605} 606 607/* Show the frame info. If this is the tui, it will be shown in 608 the source display otherwise, nothing is done */ 609void 610show_stack_frame(fi) 611 struct frame_info *fi; 612{ 613 TUIDO(((TuiOpaqueFuncPtr)tui_vShowFrameInfo, fi)); 614} 615 616 |
|
398/* Read a frame specification in whatever the appropriate format is. 399 Call error() if the specification is in any way invalid (i.e. 400 this function never returns NULL). */ 401 | 617/* Read a frame specification in whatever the appropriate format is. 618 Call error() if the specification is in any way invalid (i.e. 619 this function never returns NULL). */ 620 |
402static struct frame_info * | 621struct frame_info * |
403parse_frame_specification (frame_exp) 404 char *frame_exp; 405{ 406 int numargs = 0; 407#define MAXARGS 4 408 CORE_ADDR args[MAXARGS]; 409 410 if (frame_exp) --- 104 unchanged lines hidden (view full) --- 515 This means absolutely all information in the frame is printed. */ 516 517static void 518frame_info (addr_exp, from_tty) 519 char *addr_exp; 520 int from_tty; 521{ 522 struct frame_info *fi; | 622parse_frame_specification (frame_exp) 623 char *frame_exp; 624{ 625 int numargs = 0; 626#define MAXARGS 4 627 CORE_ADDR args[MAXARGS]; 628 629 if (frame_exp) --- 104 unchanged lines hidden (view full) --- 734 This means absolutely all information in the frame is printed. */ 735 736static void 737frame_info (addr_exp, from_tty) 738 char *addr_exp; 739 int from_tty; 740{ 741 struct frame_info *fi; |
523 struct frame_saved_regs fsr; | |
524 struct symtab_and_line sal; 525 struct symbol *func; 526 struct symtab *s; 527 struct frame_info *calling_frame_info; 528 int i, count, numregs; 529 char *funname = 0; 530 enum language funlang = language_unknown; 531 --- 7 unchanged lines hidden (view full) --- 539 sal = find_pc_line (fi->pc, 540 fi->next != NULL 541 && !fi->next->signal_handler_caller 542 && !frame_in_dummy (fi->next)); 543 func = get_frame_function (fi); 544 s = find_pc_symtab(fi->pc); 545 if (func) 546 { | 742 struct symtab_and_line sal; 743 struct symbol *func; 744 struct symtab *s; 745 struct frame_info *calling_frame_info; 746 int i, count, numregs; 747 char *funname = 0; 748 enum language funlang = language_unknown; 749 --- 7 unchanged lines hidden (view full) --- 757 sal = find_pc_line (fi->pc, 758 fi->next != NULL 759 && !fi->next->signal_handler_caller 760 && !frame_in_dummy (fi->next)); 761 func = get_frame_function (fi); 762 s = find_pc_symtab(fi->pc); 763 if (func) 764 { |
547 funname = SYMBOL_NAME (func); 548 funlang = SYMBOL_LANGUAGE (func); | 765 /* I'd like to use SYMBOL_SOURCE_NAME() here, to display 766 * the demangled name that we already have stored in 767 * the symbol table, but we stored a version with 768 * DMGL_PARAMS turned on, and here we don't want 769 * to display parameters. So call the demangler again, 770 * with DMGL_ANSI only. RT 771 * (Yes, I know that printf_symbol_filtered() will 772 * again try to demangle the name on the fly, but 773 * the issue is that if cplus_demangle() fails here, 774 * it'll fail there too. So we want to catch the failure 775 * ("demangled==NULL" case below) here, while we still 776 * have our hands on the function symbol.) 777 */ 778 char * demangled; 779 funname = SYMBOL_NAME (func); 780 funlang = SYMBOL_LANGUAGE (func); 781 if (funlang == language_cplus) 782 { 783 demangled = cplus_demangle (funname, DMGL_ANSI); 784 /* If the demangler fails, try the demangled name 785 * from the symbol table. This'll have parameters, 786 * but that's preferable to diplaying a mangled name. 787 */ 788 if (demangled == NULL) 789 funname = SYMBOL_SOURCE_NAME (func); 790 } |
549 } 550 else 551 { 552 register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); 553 if (msymbol != NULL) 554 { 555 funname = SYMBOL_NAME (msymbol); 556 funlang = SYMBOL_LANGUAGE (msymbol); --- 8 unchanged lines hidden (view full) --- 565 printf_filtered (":\n"); 566 } 567 else 568 { 569 printf_filtered ("Stack frame at "); 570 print_address_numeric (fi->frame, 1, gdb_stdout); 571 printf_filtered (":\n"); 572 } | 791 } 792 else 793 { 794 register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); 795 if (msymbol != NULL) 796 { 797 funname = SYMBOL_NAME (msymbol); 798 funlang = SYMBOL_LANGUAGE (msymbol); --- 8 unchanged lines hidden (view full) --- 807 printf_filtered (":\n"); 808 } 809 else 810 { 811 printf_filtered ("Stack frame at "); 812 print_address_numeric (fi->frame, 1, gdb_stdout); 813 printf_filtered (":\n"); 814 } |
573 printf_filtered (" %s = ", reg_names[PC_REGNUM]); | 815 printf_filtered (" %s = ", REGISTER_NAME (PC_REGNUM)); |
574 print_address_numeric (fi->pc, 1, gdb_stdout); 575 576 wrap_here (" "); 577 if (funname) 578 { 579 printf_filtered (" in "); 580 fprintf_symbol_filtered (gdb_stdout, funname, funlang, 581 DMGL_ANSI | DMGL_PARAMS); 582 } 583 wrap_here (" "); 584 if (sal.symtab) 585 printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line); 586 puts_filtered ("; "); 587 wrap_here (" "); | 816 print_address_numeric (fi->pc, 1, gdb_stdout); 817 818 wrap_here (" "); 819 if (funname) 820 { 821 printf_filtered (" in "); 822 fprintf_symbol_filtered (gdb_stdout, funname, funlang, 823 DMGL_ANSI | DMGL_PARAMS); 824 } 825 wrap_here (" "); 826 if (sal.symtab) 827 printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line); 828 puts_filtered ("; "); 829 wrap_here (" "); |
588 printf_filtered ("saved %s ", reg_names[PC_REGNUM]); | 830 printf_filtered ("saved %s ", REGISTER_NAME (PC_REGNUM)); |
589 print_address_numeric (FRAME_SAVED_PC (fi), 1, gdb_stdout); 590 printf_filtered ("\n"); 591 592 { 593 int frameless = 0; 594#ifdef FRAMELESS_FUNCTION_INVOCATION 595 FRAMELESS_FUNCTION_INVOCATION (fi, frameless); 596#endif --- 59 unchanged lines hidden (view full) --- 656 else 657 { 658 printf_filtered (" Locals at "); 659 print_address_numeric (arg_list, 1, gdb_stdout); 660 printf_filtered (","); 661 } 662 } 663 | 831 print_address_numeric (FRAME_SAVED_PC (fi), 1, gdb_stdout); 832 printf_filtered ("\n"); 833 834 { 835 int frameless = 0; 836#ifdef FRAMELESS_FUNCTION_INVOCATION 837 FRAMELESS_FUNCTION_INVOCATION (fi, frameless); 838#endif --- 59 unchanged lines hidden (view full) --- 898 else 899 { 900 printf_filtered (" Locals at "); 901 print_address_numeric (arg_list, 1, gdb_stdout); 902 printf_filtered (","); 903 } 904 } 905 |
664#if defined (FRAME_FIND_SAVED_REGS) 665 get_frame_saved_regs (fi, &fsr); 666 /* The sp is special; what's returned isn't the save address, but 667 actually the value of the previous frame's sp. */ 668 printf_filtered (" Previous frame's sp is "); 669 print_address_numeric (fsr.regs[SP_REGNUM], 1, gdb_stdout); 670 printf_filtered ("\n"); 671 count = 0; 672 numregs = ARCH_NUM_REGS; 673 for (i = 0; i < numregs; i++) 674 if (fsr.regs[i] && i != SP_REGNUM) 675 { 676 if (count == 0) 677 puts_filtered (" Saved registers:\n "); 678 else 679 puts_filtered (","); 680 wrap_here (" "); 681 printf_filtered (" %s at ", reg_names[i]); 682 print_address_numeric (fsr.regs[i], 1, gdb_stdout); 683 count++; 684 } 685 if (count) 686 puts_filtered ("\n"); 687#else /* Have FRAME_FIND_SAVED_REGS. */ 688 /* We could get some information about saved registers by calling 689 get_saved_register on each register. Which info goes with which frame 690 is necessarily lost, however, and I suspect that the users don't care 691 whether they get the info. */ 692 puts_filtered ("\n"); 693#endif /* Have FRAME_FIND_SAVED_REGS. */ | 906 FRAME_INIT_SAVED_REGS (fi); 907 if (fi->saved_regs != NULL) 908 { 909 /* The sp is special; what's returned isn't the save address, but 910 actually the value of the previous frame's sp. */ 911 printf_filtered (" Previous frame's sp is "); 912 print_address_numeric (fi->saved_regs[SP_REGNUM], 1, gdb_stdout); 913 printf_filtered ("\n"); 914 count = 0; 915 numregs = ARCH_NUM_REGS; 916 for (i = 0; i < numregs; i++) 917 if (fi->saved_regs[i] && i != SP_REGNUM) 918 { 919 if (count == 0) 920 puts_filtered (" Saved registers:\n "); 921 else 922 puts_filtered (","); 923 wrap_here (" "); 924 printf_filtered (" %s at ", REGISTER_NAME (i)); 925 print_address_numeric (fi->saved_regs[i], 1, gdb_stdout); 926 count++; 927 } 928 if (count) 929 puts_filtered ("\n"); 930 } 931 else 932 { 933 /* We could get some information about saved registers by 934 calling get_saved_register on each register. Which info goes 935 with which frame is necessarily lost, however, and I suspect 936 that the users don't care whether they get the info. */ 937 puts_filtered ("\n"); 938 } |
694} 695 696#if 0 697/* Set a limit on the number of frames printed by default in a 698 backtrace. */ 699 700static int backtrace_limit; 701 --- 20 unchanged lines hidden (view full) --- 722 723 printf_unfiltered ("Backtrace limit: %d.\n", backtrace_limit); 724} 725#endif 726 727/* Print briefly all stack frames or just the innermost COUNT frames. */ 728 729static void | 939} 940 941#if 0 942/* Set a limit on the number of frames printed by default in a 943 backtrace. */ 944 945static int backtrace_limit; 946 --- 20 unchanged lines hidden (view full) --- 967 968 printf_unfiltered ("Backtrace limit: %d.\n", backtrace_limit); 969} 970#endif 971 972/* Print briefly all stack frames or just the innermost COUNT frames. */ 973 974static void |
730backtrace_command (count_exp, from_tty) | 975backtrace_command_1 (count_exp, show_locals, from_tty) |
731 char *count_exp; | 976 char *count_exp; |
977 int show_locals; |
|
732 int from_tty; 733{ 734 struct frame_info *fi; 735 register int count; 736 register int i; 737 register struct frame_info *trailing; 738 register int trailing_level; 739 --- 64 unchanged lines hidden (view full) --- 804 i++, fi = get_prev_frame (fi)) 805 { 806 QUIT; 807 808 /* Don't use print_stack_frame; if an error() occurs it probably 809 means further attempts to backtrace would fail (on the other 810 hand, perhaps the code does or could be fixed to make sure 811 the frame->prev field gets set to NULL in that case). */ | 978 int from_tty; 979{ 980 struct frame_info *fi; 981 register int count; 982 register int i; 983 register struct frame_info *trailing; 984 register int trailing_level; 985 --- 64 unchanged lines hidden (view full) --- 1050 i++, fi = get_prev_frame (fi)) 1051 { 1052 QUIT; 1053 1054 /* Don't use print_stack_frame; if an error() occurs it probably 1055 means further attempts to backtrace would fail (on the other 1056 hand, perhaps the code does or could be fixed to make sure 1057 the frame->prev field gets set to NULL in that case). */ |
812 print_frame_info (fi, trailing_level + i, 0, 1); | 1058 print_frame_info_base (fi, trailing_level + i, 0, 1); 1059 if (show_locals) 1060 print_frame_local_vars(fi, 1, gdb_stdout); |
813 } 814 815 /* If we've stopped before the end, mention that. */ 816 if (fi && from_tty) 817 printf_filtered ("(More stack frames follow...)\n"); 818} | 1061 } 1062 1063 /* If we've stopped before the end, mention that. */ 1064 if (fi && from_tty) 1065 printf_filtered ("(More stack frames follow...)\n"); 1066} |
1067 1068static void 1069backtrace_command (arg, from_tty) 1070 char *arg; 1071 int from_tty; 1072{ 1073 struct cleanup *old_chain = (struct cleanup *)NULL; 1074 char **argv = (char **)NULL; 1075 int argIndicatingFullTrace = (-1), totArgLen = 0, argc = 0; 1076 char *argPtr = arg; 1077 1078 if (arg != (char *)NULL) 1079 { 1080 int i; 1081 1082 argv = buildargv(arg); 1083 old_chain = make_cleanup ((make_cleanup_func) freeargv, (char *)argv); 1084 argc = 0; 1085 for (i = 0; (argv[i] != (char *)NULL); i++) 1086 { 1087 int j; 1088 1089 for (j = 0; (j < strlen(argv[i])); j++) 1090 argv[i][j] = tolower(argv[i][j]); 1091 1092 if (argIndicatingFullTrace < 0 && subsetCompare(argv[i], "full")) 1093 argIndicatingFullTrace = argc; 1094 else 1095 { 1096 argc++; 1097 totArgLen += strlen(argv[i]); 1098 } 1099 } 1100 totArgLen += argc; 1101 if (argIndicatingFullTrace >= 0) 1102 { 1103 if (totArgLen > 0) 1104 { 1105 argPtr = (char *)xmalloc(totArgLen + 1); 1106 if (!argPtr) 1107 nomem(0); 1108 else 1109 { 1110 memset(argPtr, 0, totArgLen + 1); 1111 for (i = 0; (i < (argc + 1)); i++) 1112 { 1113 if (i != argIndicatingFullTrace) 1114 { 1115 strcat(argPtr, argv[i]); 1116 strcat(argPtr, " "); 1117 } 1118 } 1119 } 1120 } 1121 else 1122 argPtr = (char *)NULL; 1123 } 1124 } 1125 1126 backtrace_command_1 (argPtr, (argIndicatingFullTrace >= 0), from_tty); 1127 1128 if (argIndicatingFullTrace >= 0 && totArgLen > 0) 1129 free(argPtr); 1130 1131 if (old_chain) 1132 do_cleanups(old_chain); 1133} 1134 1135static void 1136backtrace_full_command (arg, from_tty) 1137 char *arg; 1138 int from_tty; 1139{ 1140 backtrace_command_1 (arg, 1, from_tty); 1141} 1142 |
|
819 820/* Print the local variables of a block B active in FRAME. 821 Return 1 if any variables were printed; 0 otherwise. */ 822 823static int | 1143 1144/* Print the local variables of a block B active in FRAME. 1145 Return 1 if any variables were printed; 0 otherwise. */ 1146 1147static int |
824print_block_frame_locals (b, fi, stream) | 1148print_block_frame_locals (b, fi, num_tabs, stream) |
825 struct block *b; 826 register struct frame_info *fi; | 1149 struct block *b; 1150 register struct frame_info *fi; |
1151 int num_tabs; |
|
827 register GDB_FILE *stream; 828{ 829 int nsyms; | 1152 register GDB_FILE *stream; 1153{ 1154 int nsyms; |
830 register int i; | 1155 register int i, j; |
831 register struct symbol *sym; 832 register int values_printed = 0; 833 834 nsyms = BLOCK_NSYMS (b); 835 836 for (i = 0; i < nsyms; i++) 837 { 838 sym = BLOCK_SYM (b, i); 839 switch (SYMBOL_CLASS (sym)) 840 { 841 case LOC_LOCAL: 842 case LOC_REGISTER: 843 case LOC_STATIC: 844 case LOC_BASEREG: 845 values_printed = 1; | 1156 register struct symbol *sym; 1157 register int values_printed = 0; 1158 1159 nsyms = BLOCK_NSYMS (b); 1160 1161 for (i = 0; i < nsyms; i++) 1162 { 1163 sym = BLOCK_SYM (b, i); 1164 switch (SYMBOL_CLASS (sym)) 1165 { 1166 case LOC_LOCAL: 1167 case LOC_REGISTER: 1168 case LOC_STATIC: 1169 case LOC_BASEREG: 1170 values_printed = 1; |
1171 for (j = 0; j < num_tabs; j++) 1172 fputs_filtered("\t", stream); |
|
846 fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream); 847 fputs_filtered (" = ", stream); 848 print_variable_value (sym, fi, stream); 849 fprintf_filtered (stream, "\n"); 850 break; 851 852 default: 853 /* Ignore symbols which are not locals. */ --- 49 unchanged lines hidden (view full) --- 903 including all the blocks active in that frame 904 at its current pc. 905 906 Returns 1 if the job was done, 907 or 0 if nothing was printed because we have no info 908 on the function running in FRAME. */ 909 910static void | 1173 fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream); 1174 fputs_filtered (" = ", stream); 1175 print_variable_value (sym, fi, stream); 1176 fprintf_filtered (stream, "\n"); 1177 break; 1178 1179 default: 1180 /* Ignore symbols which are not locals. */ --- 49 unchanged lines hidden (view full) --- 1230 including all the blocks active in that frame 1231 at its current pc. 1232 1233 Returns 1 if the job was done, 1234 or 0 if nothing was printed because we have no info 1235 on the function running in FRAME. */ 1236 1237static void |
911print_frame_local_vars (fi, stream) | 1238print_frame_local_vars (fi, num_tabs, stream) |
912 register struct frame_info *fi; | 1239 register struct frame_info *fi; |
1240 register int num_tabs; |
|
913 register GDB_FILE *stream; 914{ 915 register struct block *block = get_frame_block (fi); 916 register int values_printed = 0; 917 918 if (block == 0) 919 { 920 fprintf_filtered (stream, "No symbol table info available.\n"); 921 return; 922 } 923 924 while (block != 0) 925 { | 1241 register GDB_FILE *stream; 1242{ 1243 register struct block *block = get_frame_block (fi); 1244 register int values_printed = 0; 1245 1246 if (block == 0) 1247 { 1248 fprintf_filtered (stream, "No symbol table info available.\n"); 1249 return; 1250 } 1251 1252 while (block != 0) 1253 { |
926 if (print_block_frame_locals (block, fi, stream)) | 1254 if (print_block_frame_locals (block, fi, num_tabs, stream)) |
927 values_printed = 1; 928 /* After handling the function's top-level block, stop. 929 Don't continue to its superblock, the block of 930 per-file symbols. */ 931 if (BLOCK_FUNCTION (block)) 932 break; 933 block = BLOCK_SUPERBLOCK (block); 934 } --- 72 unchanged lines hidden (view full) --- 1007 1008 if (!values_printed && !this_level_only) 1009 { 1010 fprintf_filtered (stream, "No catches.\n"); 1011 } 1012} 1013 1014/* ARGSUSED */ | 1255 values_printed = 1; 1256 /* After handling the function's top-level block, stop. 1257 Don't continue to its superblock, the block of 1258 per-file symbols. */ 1259 if (BLOCK_FUNCTION (block)) 1260 break; 1261 block = BLOCK_SUPERBLOCK (block); 1262 } --- 72 unchanged lines hidden (view full) --- 1335 1336 if (!values_printed && !this_level_only) 1337 { 1338 fprintf_filtered (stream, "No catches.\n"); 1339 } 1340} 1341 1342/* ARGSUSED */ |
1015static void | 1343void |
1016locals_info (args, from_tty) 1017 char *args; 1018 int from_tty; 1019{ 1020 if (!selected_frame) 1021 error ("No frame selected."); | 1344locals_info (args, from_tty) 1345 char *args; 1346 int from_tty; 1347{ 1348 if (!selected_frame) 1349 error ("No frame selected."); |
1022 print_frame_local_vars (selected_frame, gdb_stdout); | 1350 print_frame_local_vars (selected_frame, 0, gdb_stdout); |
1023} 1024 1025static void 1026catch_info (ignore, from_tty) 1027 char *ignore; 1028 int from_tty; 1029{ | 1351} 1352 1353static void 1354catch_info (ignore, from_tty) 1355 char *ignore; 1356 int from_tty; 1357{ |
1358 struct symtab_and_line * sal; 1359 1360 /* Check for target support for exception handling */ 1361 sal = target_enable_exception_callback (EX_EVENT_CATCH, 1); 1362 if (sal) 1363 { 1364 /* Currently not handling this */ 1365 /* Ideally, here we should interact with the C++ runtime 1366 system to find the list of active handlers, etc. */ 1367 fprintf_filtered (gdb_stdout, "Info catch not supported with this target/compiler combination.\n"); 1368#if 0 |
|
1030 if (!selected_frame) 1031 error ("No frame selected."); | 1369 if (!selected_frame) 1370 error ("No frame selected."); |
1032 print_frame_label_vars (selected_frame, 0, gdb_stdout); | 1371#endif 1372 } 1373 else 1374 { 1375 /* Assume g++ compiled code -- old v 4.16 behaviour */ 1376 if (!selected_frame) 1377 error ("No frame selected."); 1378 1379 print_frame_label_vars (selected_frame, 0, gdb_stdout); 1380 } |
1033} 1034 1035static void 1036print_frame_arg_vars (fi, stream) 1037 register struct frame_info *fi; 1038 register GDB_FILE *stream; 1039{ 1040 struct symbol *func = get_frame_function (fi); --- 51 unchanged lines hidden (view full) --- 1092 } 1093 1094 if (!values_printed) 1095 { 1096 fprintf_filtered (stream, "No arguments.\n"); 1097 } 1098} 1099 | 1381} 1382 1383static void 1384print_frame_arg_vars (fi, stream) 1385 register struct frame_info *fi; 1386 register GDB_FILE *stream; 1387{ 1388 struct symbol *func = get_frame_function (fi); --- 51 unchanged lines hidden (view full) --- 1440 } 1441 1442 if (!values_printed) 1443 { 1444 fprintf_filtered (stream, "No arguments.\n"); 1445 } 1446} 1447 |
1100static void | 1448void |
1101args_info (ignore, from_tty) 1102 char *ignore; 1103 int from_tty; 1104{ 1105 if (!selected_frame) 1106 error ("No frame selected."); 1107 print_frame_arg_vars (selected_frame, gdb_stdout); 1108} | 1449args_info (ignore, from_tty) 1450 char *ignore; 1451 int from_tty; 1452{ 1453 if (!selected_frame) 1454 error ("No frame selected."); 1455 print_frame_arg_vars (selected_frame, gdb_stdout); 1456} |
1457 1458 1459static void 1460args_plus_locals_info (ignore, from_tty) 1461 char *ignore; 1462 int from_tty; 1463{ 1464 args_info(ignore, from_tty); 1465 locals_info(ignore, from_tty); 1466} 1467 |
|
1109 1110/* Select frame FI, and note that its stack level is LEVEL. 1111 LEVEL may be -1 if an actual level number is not known. */ 1112 1113void 1114select_frame (fi, level) 1115 struct frame_info *fi; 1116 int level; 1117{ 1118 register struct symtab *s; 1119 1120 selected_frame = fi; 1121 selected_frame_level = level; | 1468 1469/* Select frame FI, and note that its stack level is LEVEL. 1470 LEVEL may be -1 if an actual level number is not known. */ 1471 1472void 1473select_frame (fi, level) 1474 struct frame_info *fi; 1475 int level; 1476{ 1477 register struct symtab *s; 1478 1479 selected_frame = fi; 1480 selected_frame_level = level; |
1481 if (selected_frame_level_changed_hook) 1482 selected_frame_level_changed_hook (level); |
|
1122 1123 /* Ensure that symbols for this frame are read in. Also, determine the 1124 source language of this frame, and switch to it if desired. */ 1125 if (fi) 1126 { 1127 s = find_pc_symtab (fi->pc); 1128 if (s 1129 && s->language != current_language->la_language 1130 && s->language != language_unknown 1131 && language_mode == language_mode_auto) { 1132 set_language(s->language); 1133 } | 1483 1484 /* Ensure that symbols for this frame are read in. Also, determine the 1485 source language of this frame, and switch to it if desired. */ 1486 if (fi) 1487 { 1488 s = find_pc_symtab (fi->pc); 1489 if (s 1490 && s->language != current_language->la_language 1491 && s->language != language_unknown 1492 && language_mode == language_mode_auto) { 1493 set_language(s->language); 1494 } |
1495 /* elz: this if here fixes the problem with the pc not being displayed 1496 in the tui asm layout, with no debug symbols. The value of s 1497 would be 0 here, and select_source_symtab would abort the 1498 command by calling the 'error' function*/ 1499 if (s) 1500 { 1501 TUIDO(((TuiOpaqueFuncPtr)tui_vSelectSourceSymtab, s)); 1502 } |
|
1134 } 1135} 1136 | 1503 } 1504} 1505 |
1506 1507/* Select frame FI, noting that its stack level is LEVEL. Also print 1508 the stack frame and show the source if this is the tui version. */ 1509void 1510select_and_print_frame(fi, level) 1511 struct frame_info *fi; 1512 int level; 1513{ 1514 select_frame(fi, level); 1515 if (fi) 1516 { 1517 print_stack_frame(fi, level, 1); 1518 TUIDO(((TuiOpaqueFuncPtr)tui_vCheckDataValues, fi)); 1519 } 1520} 1521 1522 1523/* Select frame FI, noting that its stack level is LEVEL. Be silent if 1524 not the TUI */ 1525void 1526select_and_maybe_print_frame (fi, level) 1527 struct frame_info *fi; 1528 int level; 1529{ 1530 if (!tui_version) 1531 select_frame(fi, level); 1532 else 1533 select_and_print_frame(fi, level); 1534} 1535 1536 |
|
1137/* Store the selected frame and its level into *FRAMEP and *LEVELP. 1138 If there is no selected frame, *FRAMEP is set to NULL. */ 1139 1140void 1141record_selected_frame (frameaddrp, levelp) 1142 CORE_ADDR *frameaddrp; 1143 int *levelp; 1144{ --- 91 unchanged lines hidden (view full) --- 1236 1237 select_frame (frame, level); 1238} 1239 1240/* The "frame" command. With no arg, print selected frame briefly. 1241 With arg, behaves like select_frame and then prints the selected 1242 frame. */ 1243 | 1537/* Store the selected frame and its level into *FRAMEP and *LEVELP. 1538 If there is no selected frame, *FRAMEP is set to NULL. */ 1539 1540void 1541record_selected_frame (frameaddrp, levelp) 1542 CORE_ADDR *frameaddrp; 1543 int *levelp; 1544{ --- 91 unchanged lines hidden (view full) --- 1636 1637 select_frame (frame, level); 1638} 1639 1640/* The "frame" command. With no arg, print selected frame briefly. 1641 With arg, behaves like select_frame and then prints the selected 1642 frame. */ 1643 |
1244static void | 1644void |
1245frame_command (level_exp, from_tty) 1246 char *level_exp; 1247 int from_tty; 1248{ 1249 select_frame_command (level_exp, from_tty); | 1645frame_command (level_exp, from_tty) 1646 char *level_exp; 1647 int from_tty; 1648{ 1649 select_frame_command (level_exp, from_tty); |
1250 print_stack_frame (selected_frame, selected_frame_level, 1); | 1650 show_and_print_stack_frame (selected_frame, selected_frame_level, 1); |
1251} 1252 | 1651} 1652 |
1653/* The XDB Compatibility command to print the current frame. */ 1654 1655void 1656current_frame_command (level_exp, from_tty) 1657 char *level_exp; 1658 int from_tty; 1659{ 1660 if (target_has_stack == 0 || selected_frame == 0) 1661 error ("No stack."); 1662 print_only_stack_frame (selected_frame, selected_frame_level, 1); 1663 } 1664 |
|
1253/* Select the frame up one or COUNT stack levels 1254 from the previously selected frame, and print it briefly. */ 1255 1256/* ARGSUSED */ 1257static void | 1665/* Select the frame up one or COUNT stack levels 1666 from the previously selected frame, and print it briefly. */ 1667 1668/* ARGSUSED */ 1669static void |
1258up_silently_command (count_exp, from_tty) | 1670up_silently_base (count_exp) |
1259 char *count_exp; | 1671 char *count_exp; |
1260 int from_tty; | |
1261{ 1262 register struct frame_info *fi; 1263 int count = 1, count1; 1264 if (count_exp) 1265 count = parse_and_eval_address (count_exp); 1266 count1 = count; 1267 1268 if (target_has_stack == 0 || selected_frame == 0) 1269 error ("No stack."); 1270 1271 fi = find_relative_frame (selected_frame, &count1); 1272 if (count1 != 0 && count_exp == 0) 1273 error ("Initial frame selected; you cannot go up."); 1274 select_frame (fi, selected_frame_level + count - count1); 1275} 1276 1277static void | 1672{ 1673 register struct frame_info *fi; 1674 int count = 1, count1; 1675 if (count_exp) 1676 count = parse_and_eval_address (count_exp); 1677 count1 = count; 1678 1679 if (target_has_stack == 0 || selected_frame == 0) 1680 error ("No stack."); 1681 1682 fi = find_relative_frame (selected_frame, &count1); 1683 if (count1 != 0 && count_exp == 0) 1684 error ("Initial frame selected; you cannot go up."); 1685 select_frame (fi, selected_frame_level + count - count1); 1686} 1687 1688static void |
1689up_silently_command (count_exp, from_tty) 1690 char *count_exp; 1691 int from_tty; 1692{ 1693 up_silently_base(count_exp); 1694 if (tui_version) 1695 print_stack_frame (selected_frame, selected_frame_level, 1); 1696} 1697 1698static void |
|
1278up_command (count_exp, from_tty) 1279 char *count_exp; 1280 int from_tty; 1281{ | 1699up_command (count_exp, from_tty) 1700 char *count_exp; 1701 int from_tty; 1702{ |
1282 up_silently_command (count_exp, from_tty); 1283 print_stack_frame (selected_frame, selected_frame_level, 1); | 1703 up_silently_base (count_exp); 1704 show_and_print_stack_frame (selected_frame, selected_frame_level, 1); |
1284} 1285 1286/* Select the frame down one or COUNT stack levels 1287 from the previously selected frame, and print it briefly. */ 1288 1289/* ARGSUSED */ 1290static void | 1705} 1706 1707/* Select the frame down one or COUNT stack levels 1708 from the previously selected frame, and print it briefly. */ 1709 1710/* ARGSUSED */ 1711static void |
1291down_silently_command (count_exp, from_tty) | 1712down_silently_base (count_exp) |
1292 char *count_exp; | 1713 char *count_exp; |
1293 int from_tty; | |
1294{ 1295 register struct frame_info *frame; 1296 int count = -1, count1; 1297 if (count_exp) 1298 count = - parse_and_eval_address (count_exp); 1299 count1 = count; 1300 1301 if (target_has_stack == 0 || selected_frame == 0) --- 9 unchanged lines hidden (view full) --- 1311 down without getting an error. */ 1312 1313 error ("Bottom (i.e., innermost) frame selected; you cannot go down."); 1314 } 1315 1316 select_frame (frame, selected_frame_level + count - count1); 1317} 1318 | 1714{ 1715 register struct frame_info *frame; 1716 int count = -1, count1; 1717 if (count_exp) 1718 count = - parse_and_eval_address (count_exp); 1719 count1 = count; 1720 1721 if (target_has_stack == 0 || selected_frame == 0) --- 9 unchanged lines hidden (view full) --- 1731 down without getting an error. */ 1732 1733 error ("Bottom (i.e., innermost) frame selected; you cannot go down."); 1734 } 1735 1736 select_frame (frame, selected_frame_level + count - count1); 1737} 1738 |
1739/* ARGSUSED */ 1740static void 1741down_silently_command (count_exp, from_tty) 1742 char *count_exp; 1743 int from_tty; 1744{ 1745 down_silently_base (count_exp); 1746 if (tui_version) 1747 print_stack_frame (selected_frame, selected_frame_level, 1); 1748} |
|
1319 1320static void 1321down_command (count_exp, from_tty) 1322 char *count_exp; 1323 int from_tty; 1324{ | 1749 1750static void 1751down_command (count_exp, from_tty) 1752 char *count_exp; 1753 int from_tty; 1754{ |
1325 down_silently_command (count_exp, from_tty); 1326 print_stack_frame (selected_frame, selected_frame_level, 1); | 1755 down_silently_base (count_exp); 1756 show_and_print_stack_frame (selected_frame, selected_frame_level, 1); |
1327} 1328 1329static void 1330return_command (retval_exp, from_tty) 1331 char *retval_exp; 1332 int from_tty; 1333{ 1334 struct symbol *thisfun; --- 68 unchanged lines hidden (view full) --- 1403 /* If interactive, print the frame that is now current. */ 1404 1405 if (from_tty) 1406 frame_command ("0", 1); 1407 else 1408 select_frame_command ("0", 0); 1409} 1410 | 1757} 1758 1759static void 1760return_command (retval_exp, from_tty) 1761 char *retval_exp; 1762 int from_tty; 1763{ 1764 struct symbol *thisfun; --- 68 unchanged lines hidden (view full) --- 1833 /* If interactive, print the frame that is now current. */ 1834 1835 if (from_tty) 1836 frame_command ("0", 1); 1837 else 1838 select_frame_command ("0", 0); 1839} 1840 |
1841/* Sets the scope to input function name, provided that the 1842 function is within the current stack frame */ 1843 1844struct function_bounds 1845{ 1846 CORE_ADDR low, high; 1847}; 1848 1849static void 1850func_command (arg, from_tty) 1851 char *arg; 1852 int from_tty; 1853{ 1854 struct frame_info *fp; 1855 int found = 0; 1856 struct symtabs_and_lines sals; 1857 int i; 1858 int level = 1; 1859 struct function_bounds *func_bounds = (struct function_bounds *) NULL; 1860 1861 if (arg != (char *) NULL) 1862 return; 1863 1864 fp = parse_frame_specification ("0"); 1865 sals = decode_line_spec (arg, 1); 1866 func_bounds = (struct function_bounds *) xmalloc ( 1867 sizeof (struct function_bounds) * sals.nelts); 1868 for (i = 0; (i < sals.nelts && !found); i++) 1869 { 1870 if (sals.sals[i].pc == (CORE_ADDR) 0 || 1871 find_pc_partial_function (sals.sals[i].pc, 1872 (char **) NULL, 1873 &func_bounds[i].low, 1874 &func_bounds[i].high) == 0) 1875 { 1876 func_bounds[i].low = 1877 func_bounds[i].high = (CORE_ADDR) NULL; 1878 } 1879 } 1880 1881 do 1882 { 1883 for (i = 0; (i < sals.nelts && !found); i++) 1884 found = (fp->pc >= func_bounds[i].low && 1885 fp->pc < func_bounds[i].high); 1886 if (!found) 1887 { 1888 level = 1; 1889 fp = find_relative_frame (fp, &level); 1890 } 1891 } 1892 while (!found && level == 0); 1893 1894 if (func_bounds) 1895 free (func_bounds); 1896 1897 if (!found) 1898 printf_filtered ("'%s' not within current stack frame.\n", arg); 1899 else if (fp != selected_frame) 1900 select_and_print_frame (fp, level); 1901} 1902 |
|
1411/* Gets the language of the current frame. */ 1412 1413enum language | 1903/* Gets the language of the current frame. */ 1904 1905enum language |
1414get_frame_language() | 1906get_frame_language () |
1415{ 1416 register struct symtab *s; 1417 enum language flang; /* The language of the current frame */ 1418 1419 if (selected_frame) 1420 { 1421 s = find_pc_symtab(selected_frame->pc); 1422 if (s) --- 41 unchanged lines hidden (view full) --- 1464With no argument, print the selected stack frame. (See also \"info frame\").\n\ 1465An argument specifies the frame to select.\n\ 1466It can be a stack frame number or the address of the frame.\n\ 1467With argument, nothing is printed if input is coming from\n\ 1468a command file or a user-defined command."); 1469 1470 add_com_alias ("f", "frame", class_stack, 1); 1471 | 1907{ 1908 register struct symtab *s; 1909 enum language flang; /* The language of the current frame */ 1910 1911 if (selected_frame) 1912 { 1913 s = find_pc_symtab(selected_frame->pc); 1914 if (s) --- 41 unchanged lines hidden (view full) --- 1956With no argument, print the selected stack frame. (See also \"info frame\").\n\ 1957An argument specifies the frame to select.\n\ 1958It can be a stack frame number or the address of the frame.\n\ 1959With argument, nothing is printed if input is coming from\n\ 1960a command file or a user-defined command."); 1961 1962 add_com_alias ("f", "frame", class_stack, 1); 1963 |
1964 if (xdb_commands) 1965 { 1966 add_com("L", class_stack, current_frame_command, 1967 "Print the current stack frame.\n"); 1968 add_com_alias ("V", "frame", class_stack, 1); 1969 } |
|
1472 add_com ("select-frame", class_stack, select_frame_command, 1473 "Select a stack frame without printing anything.\n\ 1474An argument specifies the frame to select.\n\ 1475It can be a stack frame number or the address of the frame.\n"); 1476 1477 add_com ("backtrace", class_stack, backtrace_command, 1478 "Print backtrace of all stack frames, or innermost COUNT frames.\n\ | 1970 add_com ("select-frame", class_stack, select_frame_command, 1971 "Select a stack frame without printing anything.\n\ 1972An argument specifies the frame to select.\n\ 1973It can be a stack frame number or the address of the frame.\n"); 1974 1975 add_com ("backtrace", class_stack, backtrace_command, 1976 "Print backtrace of all stack frames, or innermost COUNT frames.\n\ |
1479With a negative argument, print outermost -COUNT frames."); | 1977With a negative argument, print outermost -COUNT frames.\n\ 1978Use of the 'full' qualifier also prints the values of the local variables.\n"); |
1480 add_com_alias ("bt", "backtrace", class_stack, 0); | 1979 add_com_alias ("bt", "backtrace", class_stack, 0); |
1980 if (xdb_commands) 1981 { 1982 add_com_alias ("t", "backtrace", class_stack, 0); 1983 add_com ("T", class_stack, backtrace_full_command, 1984 "Print backtrace of all stack frames, or innermost COUNT frames \n\ 1985and the values of the local variables.\n\ 1986With a negative argument, print outermost -COUNT frames.\n\ 1987Usage: T <count>\n"); 1988 } 1989 |
|
1481 add_com_alias ("where", "backtrace", class_alias, 0); 1482 add_info ("stack", backtrace_command, 1483 "Backtrace of the stack, or innermost COUNT frames."); 1484 add_info_alias ("s", "stack", 1); 1485 add_info ("frame", frame_info, 1486 "All about selected stack frame, or frame at ADDR."); 1487 add_info_alias ("f", "frame", 1); 1488 add_info ("locals", locals_info, 1489 "Local variables of current stack frame."); 1490 add_info ("args", args_info, 1491 "Argument variables of current stack frame."); | 1990 add_com_alias ("where", "backtrace", class_alias, 0); 1991 add_info ("stack", backtrace_command, 1992 "Backtrace of the stack, or innermost COUNT frames."); 1993 add_info_alias ("s", "stack", 1); 1994 add_info ("frame", frame_info, 1995 "All about selected stack frame, or frame at ADDR."); 1996 add_info_alias ("f", "frame", 1); 1997 add_info ("locals", locals_info, 1998 "Local variables of current stack frame."); 1999 add_info ("args", args_info, 2000 "Argument variables of current stack frame."); |
2001 if (xdb_commands) 2002 add_com("l", class_info, args_plus_locals_info, 2003 "Argument and local variables of current stack frame."); 2004 2005 if (dbx_commands) 2006 add_com("func", class_stack, func_command, 2007 "Select the stack frame that contains <func>.\nUsage: func <name>\n"); 2008 |
|
1492 add_info ("catch", catch_info, 1493 "Exceptions that can be caught in the current stack frame."); 1494 1495#if 0 1496 add_cmd ("backtrace-limit", class_stack, set_backtrace_limit_command, 1497 "Specify maximum number of frames for \"backtrace\" to print by default.", 1498 &setlist); 1499 add_info ("backtrace-limit", backtrace_limit_info, 1500 "The maximum number of frames for \"backtrace\" to print by default."); 1501#endif 1502} | 2009 add_info ("catch", catch_info, 2010 "Exceptions that can be caught in the current stack frame."); 2011 2012#if 0 2013 add_cmd ("backtrace-limit", class_stack, set_backtrace_limit_command, 2014 "Specify maximum number of frames for \"backtrace\" to print by default.", 2015 &setlist); 2016 add_info ("backtrace-limit", backtrace_limit_info, 2017 "The maximum number of frames for \"backtrace\" to print by default."); 2018#endif 2019} |