Commit | Line | Data |
---|---|---|
04497f0b NW |
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 | /* Note that frame.h requires param.h! */ | |
21 | ||
22 | /* | |
23 | * FRAME is the type of the identifier of a specific stack frame. It | |
24 | * is a pointer to the frame cache item corresponding to this frame. | |
25 | * Please note that frame id's are *not* constant over calls to the | |
26 | * inferior. Use frame addresses, which are. | |
27 | * | |
28 | * FRAME_ADDR is the type of the address of a specific frame. I | |
29 | * cannot imagine a case in which this would not be CORE_ADDR, so | |
30 | * maybe it's silly to give it it's own type. Life's rough. | |
31 | * | |
32 | * FRAME_FP is a macro which converts from a frame identifier into a | |
33 | * frame_address. | |
34 | * | |
35 | * FRAME_INFO_ID is a macro which "converts" from a frame info pointer | |
36 | * to a frame id. This is here in case I or someone else decides to | |
37 | * change the FRAME type again. | |
38 | * | |
39 | * This file and blockframe.c are the only places which are allowed to | |
40 | * use the equivalence between FRAME and struct frame_info *. EXCEPTION: | |
41 | * value.h uses CORE_ADDR instead of FRAME_ADDR because the compiler | |
42 | * will accept that in the absense of this file. | |
43 | */ | |
44 | typedef struct frame_info *FRAME; | |
45 | typedef CORE_ADDR FRAME_ADDR; | |
46 | #define FRAME_FP(fr) ((fr)->frame) | |
47 | #define FRAME_INFO_ID(f) (f) | |
48 | ||
49 | /* | |
50 | * Caching structure for stack frames. This is also the structure | |
51 | * used for extended info about stack frames. May add more to this | |
52 | * structure as it becomes necessary. | |
53 | * | |
54 | * Note that the first entry in the cache will always refer to the | |
55 | * innermost executing frame. This value should be set (is it? | |
56 | * Check) in something like normal_stop. | |
57 | */ | |
58 | struct frame_info | |
59 | { | |
60 | /* Nominal address of the frame described. */ | |
61 | FRAME_ADDR frame; | |
62 | /* Address at which execution is occurring in this frame. | |
63 | For the innermost frame, it's the current pc. | |
64 | For other frames, it is a pc saved in the next frame. */ | |
65 | CORE_ADDR pc; | |
66 | /* The frame called by the frame we are describing, or 0. | |
67 | This may be set even if there isn't a frame called by the one | |
68 | we are describing (.->next == 0); in that case it is simply the | |
69 | bottom of this frame */ | |
70 | FRAME_ADDR next_frame; | |
71 | /* Anything extra for this structure that may have been defined | |
72 | in the machine depedent files. */ | |
73 | #ifdef EXTRA_FRAME_INFO | |
74 | EXTRA_FRAME_INFO | |
75 | #endif | |
76 | /* Pointers to the next and previous frame_info's in this stack. */ | |
77 | FRAME next, prev; | |
78 | }; | |
79 | ||
80 | /* Describe the saved registers of a frame. */ | |
81 | ||
82 | struct frame_saved_regs | |
83 | { | |
84 | /* For each register, address of where it was saved on entry to the frame, | |
85 | or zero if it was not saved on entry to this frame. */ | |
86 | CORE_ADDR regs[NUM_REGS]; | |
87 | }; | |
88 | ||
89 | /* The stack frame that the user has specified for commands to act on. | |
90 | Note that one cannot assume this is the address of valid data. */ | |
91 | ||
92 | extern FRAME selected_frame; | |
93 | ||
94 | extern struct frame_info *get_frame_info (); | |
95 | extern struct frame_info *get_prev_frame_info (); | |
96 | ||
97 | extern FRAME create_new_frame (); | |
98 | ||
99 | extern void get_frame_saved_regs (); | |
100 | ||
101 | extern FRAME get_prev_frame (); | |
102 | extern FRAME get_current_frame (); | |
103 | extern FRAME get_next_frame (); | |
104 | ||
105 | extern struct block *get_frame_block (); | |
106 | extern struct block *get_current_block (); | |
107 | extern struct block *get_selected_block (); | |
108 | extern struct symbol *get_frame_function (); | |
109 | extern struct symbol *get_pc_function (); | |
110 | ||
111 | /* In stack.c */ | |
112 | extern FRAME find_relative_frame (); | |
113 | ||
114 | /* Generic pointer value indicating "I don't know." */ | |
115 | #define Frame_unknown (CORE_ADDR)-1 |