1 /* Traditional frame unwind support, for GDB the GNU Debugger.
3 Copyright 2003, 2004 Free Software Foundation, Inc.
5 This file is part of GDB.
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
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
25 #include "frame.h" /* For "struct frame_id". */
28 struct trad_frame_cache;
30 /* A simple, or traditional frame cache.
32 The entire cache is populated in a single pass and then generic
33 routines are used to extract the various cache values. */
35 struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *next_frame);
37 /* This frame's ID. */
38 void trad_frame_set_id (struct trad_frame_cache *this_trad_cache,
39 struct frame_id this_id);
40 void trad_frame_get_id (struct trad_frame_cache *this_trad_cache,
41 struct frame_id *this_id);
43 void trad_frame_set_reg_unknown (struct trad_frame_cache *this_trad_cache,
44 int regnum, CORE_ADDR addr);
45 void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
46 int regnum, CORE_ADDR addr);
47 void trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
48 struct frame_info *next_frame,
49 int regnum, int *optimizedp,
50 enum lval_type *lvalp, CORE_ADDR *addrp,
51 int *realregp, void *bufferp);
53 /* A traditional saved regs table, indexed by REGNUM, encoding where
54 the value of REGNUM for the previous frame can be found in this
57 The table is initialized with an identity encoding (ADDR == -1,
58 REALREG == REGNUM) indicating that the value of REGNUM in the
59 previous frame can be found in register REGNUM (== REALREG) in this
62 The initial encoding can then be changed:
64 Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
65 of register REGNUM in the previous frame can be found in memory at
66 ADDR in this frame (addr_p, !realreg_p, !value_p).
68 Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
69 value of register REGNUM in the previous frame is found in register
70 REALREG in this frame (!addr_p, realreg_p, !value_p).
72 Call trad_frame_set_value (REALREG == -1) to indicate that the
73 value of register REGNUM in the previous frame is found in ADDR
74 (!addr_p, !realreg_p, value_p).
76 Call trad_frame_set_unknown (REALREG == -2) to indicate that the
77 register's value is not known. */
79 struct trad_frame_saved_reg
81 LONGEST addr; /* A CORE_ADDR fits in a longest. */
85 /* Encode REGNUM value in the trad-frame. */
86 void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
87 int regnum, LONGEST val);
89 /* Mark REGNUM as unknown. */
90 void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
93 /* Convenience functions, return non-zero if the register has been
94 encoded as specified. */
95 int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
97 int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
99 int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
103 /* Return a freshly allocated (and initialized) trad_frame array. */
104 struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame);
106 /* Given the trad_frame info, return the location of the specified
108 void trad_frame_prev_register (struct frame_info *next_frame,
109 struct trad_frame_saved_reg this_saved_regs[],
110 int regnum, int *optimizedp,
111 enum lval_type *lvalp, CORE_ADDR *addrp,
112 int *realregp, void *bufferp);