| 1 | /* Definitions for dealing with stack frames, for GDB, the GNU debugger. |
| 2 | Copyright (C) 1986, 1989 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GDB. |
| 5 | |
| 6 | GDB is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 1, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | GDB is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GDB; see the file COPYING. If not, write to |
| 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 19 | |
| 20 | #if !defined (FRAME_H) |
| 21 | #define FRAME_H 1 |
| 22 | #include "param.h" |
| 23 | |
| 24 | /* |
| 25 | * FRAME is the type of the identifier of a specific stack frame. It |
| 26 | * is a pointer to the frame cache item corresponding to this frame. |
| 27 | * Please note that frame id's are *not* constant over calls to the |
| 28 | * inferior. Use frame addresses, which are. |
| 29 | * |
| 30 | * FRAME_ADDR is the type of the address of a specific frame. I |
| 31 | * cannot imagine a case in which this would not be CORE_ADDR, so |
| 32 | * maybe it's silly to give it it's own type. Life's rough. |
| 33 | * |
| 34 | * FRAME_FP is a macro which converts from a frame identifier into a |
| 35 | * frame_address. |
| 36 | * |
| 37 | * FRAME_INFO_ID is a macro which "converts" from a frame info pointer |
| 38 | * to a frame id. This is here in case I or someone else decides to |
| 39 | * change the FRAME type again. |
| 40 | * |
| 41 | * This file and blockframe.c are the only places which are allowed to |
| 42 | * use the equivalence between FRAME and struct frame_info *. EXCEPTION: |
| 43 | * value.h uses CORE_ADDR instead of FRAME_ADDR because the compiler |
| 44 | * will accept that in the absense of this file. |
| 45 | */ |
| 46 | typedef struct frame_info *FRAME; |
| 47 | typedef CORE_ADDR FRAME_ADDR; |
| 48 | #define FRAME_FP(fr) ((fr)->frame) |
| 49 | #define FRAME_INFO_ID(f) (f) |
| 50 | |
| 51 | /* |
| 52 | * Caching structure for stack frames. This is also the structure |
| 53 | * used for extended info about stack frames. May add more to this |
| 54 | * structure as it becomes necessary. |
| 55 | * |
| 56 | * Note that the first entry in the cache will always refer to the |
| 57 | * innermost executing frame. This value should be set (is it? |
| 58 | * Check) in something like normal_stop. |
| 59 | */ |
| 60 | struct frame_info |
| 61 | { |
| 62 | /* Nominal address of the frame described. */ |
| 63 | FRAME_ADDR frame; |
| 64 | /* Address at which execution is occurring in this frame. |
| 65 | For the innermost frame, it's the current pc. |
| 66 | For other frames, it is a pc saved in the next frame. */ |
| 67 | CORE_ADDR pc; |
| 68 | /* The frame called by the frame we are describing, or 0. |
| 69 | This may be set even if there isn't a frame called by the one |
| 70 | we are describing (.->next == 0); in that case it is simply the |
| 71 | bottom of this frame */ |
| 72 | FRAME_ADDR next_frame; |
| 73 | /* Anything extra for this structure that may have been defined |
| 74 | in the machine depedent files. */ |
| 75 | #ifdef EXTRA_FRAME_INFO |
| 76 | EXTRA_FRAME_INFO |
| 77 | #endif |
| 78 | /* Pointers to the next and previous frame_info's in this stack. */ |
| 79 | FRAME next, prev; |
| 80 | }; |
| 81 | |
| 82 | /* Describe the saved registers of a frame. */ |
| 83 | |
| 84 | struct frame_saved_regs |
| 85 | { |
| 86 | /* For each register, address of where it was saved on entry to the frame, |
| 87 | or zero if it was not saved on entry to this frame. */ |
| 88 | CORE_ADDR regs[NUM_REGS]; |
| 89 | }; |
| 90 | |
| 91 | /* The stack frame that the user has specified for commands to act on. |
| 92 | Note that one cannot assume this is the address of valid data. */ |
| 93 | |
| 94 | extern FRAME selected_frame; |
| 95 | |
| 96 | extern struct frame_info *get_frame_info (); |
| 97 | extern struct frame_info *get_prev_frame_info (); |
| 98 | |
| 99 | extern FRAME create_new_frame (); |
| 100 | extern void flush_cached_frames (); |
| 101 | |
| 102 | extern void get_frame_saved_regs (); |
| 103 | |
| 104 | extern void set_current_frame (); |
| 105 | extern FRAME get_prev_frame (); |
| 106 | extern FRAME get_current_frame (); |
| 107 | extern FRAME get_next_frame (); |
| 108 | |
| 109 | extern struct block *get_frame_block (); |
| 110 | extern struct block *get_current_block (); |
| 111 | extern struct block *get_selected_block (); |
| 112 | extern struct symbol *get_frame_function (); |
| 113 | extern CORE_ADDR get_frame_pc (); |
| 114 | extern CORE_ADDR get_pc_function_start (); |
| 115 | struct block *block_for_pc (); |
| 116 | |
| 117 | int frameless_look_for_prologue (); |
| 118 | |
| 119 | void print_frame_args (); |
| 120 | |
| 121 | /* In stack.c */ |
| 122 | extern FRAME find_relative_frame (); |
| 123 | extern void print_selected_frame (); |
| 124 | extern void print_sel_frame (); |
| 125 | extern void select_frame (); |
| 126 | extern void record_selected_frame (); |
| 127 | |
| 128 | #endif /* frame.h not already included. */ |