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