Commit | Line | Data |
---|---|---|
a0f267c7 AC |
1 | /* Traditional frame unwind support, for GDB the GNU Debugger. |
2 | ||
42a4f53d | 3 | Copyright (C) 2003-2019 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; |
498f7407 | 26 | struct regcache_map_entry; |
0db9b4b7 AC |
27 | struct trad_frame_cache; |
28 | ||
29 | /* A simple, or traditional frame cache. | |
30 | ||
31 | The entire cache is populated in a single pass and then generic | |
32 | routines are used to extract the various cache values. */ | |
33 | ||
c378eb4e | 34 | struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *); |
0db9b4b7 AC |
35 | |
36 | /* This frame's ID. */ | |
37 | void trad_frame_set_id (struct trad_frame_cache *this_trad_cache, | |
38 | struct frame_id this_id); | |
39 | void trad_frame_get_id (struct trad_frame_cache *this_trad_cache, | |
40 | struct frame_id *this_id); | |
e66299b3 AC |
41 | void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache, |
42 | CORE_ADDR this_base); | |
43 | CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache); | |
0db9b4b7 | 44 | |
e66299b3 AC |
45 | void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache, |
46 | int regnum, int realreg); | |
4be282b4 AC |
47 | void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, |
48 | int regnum, CORE_ADDR addr); | |
498f7407 JB |
49 | void trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache, |
50 | const struct regcache_map_entry *regmap, | |
51 | CORE_ADDR addr, size_t size); | |
61e784e7 MS |
52 | void trad_frame_set_reg_value (struct trad_frame_cache *this_cache, |
53 | int regnum, LONGEST val); | |
54 | ||
25492ce3 DJ |
55 | struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache, |
56 | struct frame_info *this_frame, | |
57 | int regnum); | |
2cdf3c63 | 58 | |
8983bd83 AC |
59 | /* A traditional saved regs table, indexed by REGNUM, encoding where |
60 | the value of REGNUM for the previous frame can be found in this | |
61 | frame. | |
62 | ||
3b3850e8 AC |
63 | The table is initialized with an identity encoding (ADDR == -1, |
64 | REALREG == REGNUM) indicating that the value of REGNUM in the | |
65 | previous frame can be found in register REGNUM (== REALREG) in this | |
8983bd83 AC |
66 | frame. |
67 | ||
68 | The initial encoding can then be changed: | |
69 | ||
3b3850e8 AC |
70 | Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value |
71 | of register REGNUM in the previous frame can be found in memory at | |
72 | ADDR in this frame (addr_p, !realreg_p, !value_p). | |
8983bd83 | 73 | |
3b3850e8 AC |
74 | Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the |
75 | value of register REGNUM in the previous frame is found in register | |
76 | REALREG in this frame (!addr_p, realreg_p, !value_p). | |
8983bd83 | 77 | |
3b3850e8 AC |
78 | Call trad_frame_set_value (REALREG == -1) to indicate that the |
79 | value of register REGNUM in the previous frame is found in ADDR | |
80 | (!addr_p, !realreg_p, value_p). | |
81 | ||
82 | Call trad_frame_set_unknown (REALREG == -2) to indicate that the | |
83 | register's value is not known. */ | |
8983bd83 AC |
84 | |
85 | struct trad_frame_saved_reg | |
a0f267c7 | 86 | { |
8983bd83 | 87 | LONGEST addr; /* A CORE_ADDR fits in a longest. */ |
3b3850e8 | 88 | int realreg; |
a0f267c7 AC |
89 | }; |
90 | ||
3b3850e8 AC |
91 | /* Encode REGNUM value in the trad-frame. */ |
92 | void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[], | |
93 | int regnum, LONGEST val); | |
94 | ||
23e60e7a AB |
95 | /* Encode REGNUM is in REALREG in the trad-frame. */ |
96 | void trad_frame_set_realreg (struct trad_frame_saved_reg this_saved_regs[], | |
97 | int regnum, int realreg); | |
98 | ||
99 | /* Encode REGNUM is at address ADDR in the trad-frame. */ | |
100 | void trad_frame_set_addr (struct trad_frame_saved_reg this_trad_cache[], | |
101 | int regnum, CORE_ADDR addr); | |
102 | ||
3b3850e8 AC |
103 | /* Mark REGNUM as unknown. */ |
104 | void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[], | |
105 | int regnum); | |
106 | ||
107 | /* Convenience functions, return non-zero if the register has been | |
108 | encoded as specified. */ | |
109 | int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[], | |
110 | int regnum); | |
111 | int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[], | |
112 | int regnum); | |
113 | int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[], | |
114 | int regnum); | |
115 | ||
68811f8f AH |
116 | /* Reset the save regs cache, setting register values to -1. */ |
117 | void trad_frame_reset_saved_regs (struct gdbarch *gdbarch, | |
118 | struct trad_frame_saved_reg *regs); | |
a0f267c7 AC |
119 | |
120 | /* Return a freshly allocated (and initialized) trad_frame array. */ | |
c378eb4e | 121 | struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *); |
4d9a9006 | 122 | struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct gdbarch *); |
a0f267c7 AC |
123 | |
124 | /* Given the trad_frame info, return the location of the specified | |
125 | register. */ | |
25492ce3 DJ |
126 | struct value *trad_frame_get_prev_register (struct frame_info *this_frame, |
127 | struct trad_frame_saved_reg this_saved_regs[], | |
128 | int regnum); | |
a0f267c7 AC |
129 | |
130 | #endif |