Commit | Line | Data |
---|---|---|
a0f267c7 AC |
1 | /* Traditional frame unwind support, for GDB the GNU Debugger. |
2 | ||
ecd75fc8 | 3 | Copyright (C) 2003-2014 Free Software Foundation, Inc. |
a0f267c7 AC |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
a0f267c7 AC |
10 | (at your option) any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
a0f267c7 AC |
19 | |
20 | #ifndef TRAD_FRAME_H | |
21 | #define TRAD_FRAME_H | |
22 | ||
0db9b4b7 AC |
23 | #include "frame.h" /* For "struct frame_id". */ |
24 | ||
2cdf3c63 | 25 | struct frame_info; |
0db9b4b7 AC |
26 | struct trad_frame_cache; |
27 | ||
28 | /* A simple, or traditional frame cache. | |
29 | ||
30 | The entire cache is populated in a single pass and then generic | |
31 | routines are used to extract the various cache values. */ | |
32 | ||
c378eb4e | 33 | struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *); |
0db9b4b7 AC |
34 | |
35 | /* This frame's ID. */ | |
36 | void trad_frame_set_id (struct trad_frame_cache *this_trad_cache, | |
37 | struct frame_id this_id); | |
38 | void trad_frame_get_id (struct trad_frame_cache *this_trad_cache, | |
39 | struct frame_id *this_id); | |
e66299b3 AC |
40 | void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache, |
41 | CORE_ADDR this_base); | |
42 | CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache); | |
0db9b4b7 | 43 | |
e66299b3 AC |
44 | void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache, |
45 | int regnum, int realreg); | |
0db9b4b7 AC |
46 | void trad_frame_set_reg_unknown (struct trad_frame_cache *this_trad_cache, |
47 | int regnum, CORE_ADDR addr); | |
4be282b4 AC |
48 | void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, |
49 | int regnum, CORE_ADDR addr); | |
61e784e7 MS |
50 | void trad_frame_set_reg_value (struct trad_frame_cache *this_cache, |
51 | int regnum, LONGEST val); | |
52 | ||
25492ce3 DJ |
53 | struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache, |
54 | struct frame_info *this_frame, | |
55 | int regnum); | |
2cdf3c63 | 56 | |
8983bd83 AC |
57 | /* A traditional saved regs table, indexed by REGNUM, encoding where |
58 | the value of REGNUM for the previous frame can be found in this | |
59 | frame. | |
60 | ||
3b3850e8 AC |
61 | The table is initialized with an identity encoding (ADDR == -1, |
62 | REALREG == REGNUM) indicating that the value of REGNUM in the | |
63 | previous frame can be found in register REGNUM (== REALREG) in this | |
8983bd83 AC |
64 | frame. |
65 | ||
66 | The initial encoding can then be changed: | |
67 | ||
3b3850e8 AC |
68 | Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value |
69 | of register REGNUM in the previous frame can be found in memory at | |
70 | ADDR in this frame (addr_p, !realreg_p, !value_p). | |
8983bd83 | 71 | |
3b3850e8 AC |
72 | Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the |
73 | value of register REGNUM in the previous frame is found in register | |
74 | REALREG in this frame (!addr_p, realreg_p, !value_p). | |
8983bd83 | 75 | |
3b3850e8 AC |
76 | Call trad_frame_set_value (REALREG == -1) to indicate that the |
77 | value of register REGNUM in the previous frame is found in ADDR | |
78 | (!addr_p, !realreg_p, value_p). | |
79 | ||
80 | Call trad_frame_set_unknown (REALREG == -2) to indicate that the | |
81 | register's value is not known. */ | |
8983bd83 AC |
82 | |
83 | struct trad_frame_saved_reg | |
a0f267c7 | 84 | { |
8983bd83 | 85 | LONGEST addr; /* A CORE_ADDR fits in a longest. */ |
3b3850e8 | 86 | int realreg; |
a0f267c7 AC |
87 | }; |
88 | ||
3b3850e8 AC |
89 | /* Encode REGNUM value in the trad-frame. */ |
90 | void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[], | |
91 | int regnum, LONGEST val); | |
92 | ||
93 | /* Mark REGNUM as unknown. */ | |
94 | void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[], | |
95 | int regnum); | |
96 | ||
97 | /* Convenience functions, return non-zero if the register has been | |
98 | encoded as specified. */ | |
99 | int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[], | |
100 | int regnum); | |
101 | int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[], | |
102 | int regnum); | |
103 | int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[], | |
104 | int regnum); | |
105 | ||
a0f267c7 AC |
106 | |
107 | /* Return a freshly allocated (and initialized) trad_frame array. */ | |
c378eb4e | 108 | struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *); |
a0f267c7 AC |
109 | |
110 | /* Given the trad_frame info, return the location of the specified | |
111 | register. */ | |
25492ce3 DJ |
112 | struct value *trad_frame_get_prev_register (struct frame_info *this_frame, |
113 | struct trad_frame_saved_reg this_saved_regs[], | |
114 | int regnum); | |
a0f267c7 AC |
115 | |
116 | #endif |