OLD | NEW |
1 /* Cache and manage frames for GDB, the GNU debugger. | 1 /* Cache and manage frames for GDB, the GNU debugger. |
2 | 2 |
3 Copyright (C) 1986-1987, 1989, 1991, 1994-1996, 1998, 2000-2004, | 3 Copyright (C) 1986-1987, 1989, 1991, 1994-1996, 1998, 2000-2004, |
4 2007-2012 Free Software Foundation, Inc. | 4 2007-2012 Free Software Foundation, Inc. |
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 fprintf_unfiltered (file, "<unknown>"); | 302 fprintf_unfiltered (file, "<unknown>"); |
303 fprintf_unfiltered (file, "}"); | 303 fprintf_unfiltered (file, "}"); |
304 } | 304 } |
305 | 305 |
306 /* Given FRAME, return the enclosing normal frame for inlined | 306 /* Given FRAME, return the enclosing normal frame for inlined |
307 function frames. Otherwise return the original frame. */ | 307 function frames. Otherwise return the original frame. */ |
308 | 308 |
309 static struct frame_info * | 309 static struct frame_info * |
310 skip_inlined_frames (struct frame_info *frame) | 310 skip_inlined_frames (struct frame_info *frame) |
311 { | 311 { |
312 while (get_frame_type (frame) == INLINE_FRAME) | 312 while (get_frame_type (frame) == INLINE_FRAME |
| 313 » || get_frame_type (frame) == TAILCALL_FRAME) |
313 frame = get_prev_frame (frame); | 314 frame = get_prev_frame (frame); |
314 | 315 |
315 return frame; | 316 return frame; |
316 } | 317 } |
317 | 318 |
318 /* Return a frame uniq ID that can be used to, later, re-find the | 319 /* Return a frame uniq ID that can be used to, later, re-find the |
319 frame. */ | 320 frame. */ |
320 | 321 |
321 struct frame_id | 322 struct frame_id |
322 get_frame_id (struct frame_info *fi) | 323 get_frame_id (struct frame_info *fi) |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 dummy_frame_pop (get_frame_id (this_frame)); | 808 dummy_frame_pop (get_frame_id (this_frame)); |
808 return; | 809 return; |
809 } | 810 } |
810 | 811 |
811 /* Ensure that we have a frame to pop to. */ | 812 /* Ensure that we have a frame to pop to. */ |
812 prev_frame = get_prev_frame_1 (this_frame); | 813 prev_frame = get_prev_frame_1 (this_frame); |
813 | 814 |
814 if (!prev_frame) | 815 if (!prev_frame) |
815 error (_("Cannot pop the initial frame.")); | 816 error (_("Cannot pop the initial frame.")); |
816 | 817 |
| 818 /* Ignore TAILCALL_FRAME type frames, they were executed already before |
| 819 entering THISFRAME. */ |
| 820 while (get_frame_type (prev_frame) == TAILCALL_FRAME) |
| 821 prev_frame = get_prev_frame (prev_frame); |
| 822 |
817 /* Make a copy of all the register values unwound from this frame. | 823 /* Make a copy of all the register values unwound from this frame. |
818 Save them in a scratch buffer so that there isn't a race between | 824 Save them in a scratch buffer so that there isn't a race between |
819 trying to extract the old values from the current regcache while | 825 trying to extract the old values from the current regcache while |
820 at the same time writing new values into that same cache. */ | 826 at the same time writing new values into that same cache. */ |
821 scratch = frame_save_as_regcache (prev_frame); | 827 scratch = frame_save_as_regcache (prev_frame); |
822 cleanups = make_cleanup_regcache_xfree (scratch); | 828 cleanups = make_cleanup_regcache_xfree (scratch); |
823 | 829 |
824 /* FIXME: cagney/2003-03-16: It should be possible to tell the | 830 /* FIXME: cagney/2003-03-16: It should be possible to tell the |
825 target's register cache that it is about to be hit with a burst | 831 target's register cache that it is about to be hit with a burst |
826 register transfer and that the sequence of register writes should | 832 register transfer and that the sequence of register writes should |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 frame_unwind_register (frame, regnum, buf); | 1030 frame_unwind_register (frame, regnum, buf); |
1025 return extract_unsigned_integer (buf, size, byte_order); | 1031 return extract_unsigned_integer (buf, size, byte_order); |
1026 } | 1032 } |
1027 | 1033 |
1028 ULONGEST | 1034 ULONGEST |
1029 get_frame_register_unsigned (struct frame_info *frame, int regnum) | 1035 get_frame_register_unsigned (struct frame_info *frame, int regnum) |
1030 { | 1036 { |
1031 return frame_unwind_register_unsigned (frame->next, regnum); | 1037 return frame_unwind_register_unsigned (frame->next, regnum); |
1032 } | 1038 } |
1033 | 1039 |
| 1040 int |
| 1041 read_frame_register_unsigned (struct frame_info *frame, int regnum, |
| 1042 ULONGEST *val) |
| 1043 { |
| 1044 struct value *regval = get_frame_register_value (frame, regnum); |
| 1045 |
| 1046 if (!value_optimized_out (regval) |
| 1047 && value_entirely_available (regval)) |
| 1048 { |
| 1049 struct gdbarch *gdbarch = get_frame_arch (frame); |
| 1050 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
| 1051 int size = register_size (gdbarch, VALUE_REGNUM (regval)); |
| 1052 |
| 1053 *val = extract_unsigned_integer (value_contents (regval), size, byte_order
); |
| 1054 return 1; |
| 1055 } |
| 1056 |
| 1057 return 0; |
| 1058 } |
| 1059 |
1034 void | 1060 void |
1035 put_frame_register (struct frame_info *frame, int regnum, | 1061 put_frame_register (struct frame_info *frame, int regnum, |
1036 const gdb_byte *buf) | 1062 const gdb_byte *buf) |
1037 { | 1063 { |
1038 struct gdbarch *gdbarch = get_frame_arch (frame); | 1064 struct gdbarch *gdbarch = get_frame_arch (frame); |
1039 int realnum; | 1065 int realnum; |
1040 int optim; | 1066 int optim; |
1041 int unavail; | 1067 int unavail; |
1042 enum lval_type lval; | 1068 enum lval_type lval; |
1043 CORE_ADDR addr; | 1069 CORE_ADDR addr; |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 { | 2115 { |
2090 sal->symtab = SYMBOL_SYMTAB (sym); | 2116 sal->symtab = SYMBOL_SYMTAB (sym); |
2091 sal->line = SYMBOL_LINE (sym); | 2117 sal->line = SYMBOL_LINE (sym); |
2092 } | 2118 } |
2093 else | 2119 else |
2094 /* If the symbol does not have a location, we don't know where | 2120 /* If the symbol does not have a location, we don't know where |
2095 the call site is. Do not pretend to. This is jarring, but | 2121 the call site is. Do not pretend to. This is jarring, but |
2096 we can't do much better. */ | 2122 we can't do much better. */ |
2097 sal->pc = get_frame_pc (frame); | 2123 sal->pc = get_frame_pc (frame); |
2098 | 2124 |
| 2125 sal->pspace = get_frame_program_space (frame); |
| 2126 |
2099 return; | 2127 return; |
2100 } | 2128 } |
2101 | 2129 |
2102 /* If FRAME is not the innermost frame, that normally means that | 2130 /* If FRAME is not the innermost frame, that normally means that |
2103 FRAME->pc points at the return instruction (which is *after* the | 2131 FRAME->pc points at the return instruction (which is *after* the |
2104 call instruction), and we want to get the line containing the | 2132 call instruction), and we want to get the line containing the |
2105 call (because the call is where the user thinks the program is). | 2133 call (because the call is where the user thinks the program is). |
2106 However, if the next frame is either a SIGTRAMP_FRAME or a | 2134 However, if the next frame is either a SIGTRAMP_FRAME or a |
2107 DUMMY_FRAME, then the next frame will contain a saved interrupt | 2135 DUMMY_FRAME, then the next frame will contain a saved interrupt |
2108 PC and such a PC indicates the current (rather than next) | 2136 PC and such a PC indicates the current (rather than next) |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2479 | 2507 |
2480 /* Debug this files internals. */ | 2508 /* Debug this files internals. */ |
2481 add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug, _("\ | 2509 add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug, _("\ |
2482 Set frame debugging."), _("\ | 2510 Set frame debugging."), _("\ |
2483 Show frame debugging."), _("\ | 2511 Show frame debugging."), _("\ |
2484 When non-zero, frame specific internal debugging is enabled."), | 2512 When non-zero, frame specific internal debugging is enabled."), |
2485 NULL, | 2513 NULL, |
2486 show_frame_debug, | 2514 show_frame_debug, |
2487 &setdebuglist, &showdebuglist); | 2515 &setdebuglist, &showdebuglist); |
2488 } | 2516 } |
OLD | NEW |