gdb/
[deliverable/binutils-gdb.git] / gdb / trad-frame.h
CommitLineData
a0f267c7
AC
1/* Traditional frame unwind support, for GDB the GNU Debugger.
2
197e01b6 3 Copyright (C) 2003, 2004 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
9 the Free Software Foundation; either version 2 of the License, or
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
18 along with this program; if not, write to the Free Software
197e01b6
EZ
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
a0f267c7
AC
21
22#ifndef TRAD_FRAME_H
23#define TRAD_FRAME_H
24
0db9b4b7
AC
25#include "frame.h" /* For "struct frame_id". */
26
2cdf3c63 27struct frame_info;
0db9b4b7
AC
28struct trad_frame_cache;
29
30/* A simple, or traditional frame cache.
31
32 The entire cache is populated in a single pass and then generic
33 routines are used to extract the various cache values. */
34
35struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *next_frame);
36
37/* This frame's ID. */
38void trad_frame_set_id (struct trad_frame_cache *this_trad_cache,
39 struct frame_id this_id);
40void trad_frame_get_id (struct trad_frame_cache *this_trad_cache,
41 struct frame_id *this_id);
e66299b3
AC
42void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache,
43 CORE_ADDR this_base);
44CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache);
0db9b4b7 45
e66299b3
AC
46void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
47 int regnum, int realreg);
0db9b4b7
AC
48void trad_frame_set_reg_unknown (struct trad_frame_cache *this_trad_cache,
49 int regnum, CORE_ADDR addr);
4be282b4
AC
50void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
51 int regnum, CORE_ADDR addr);
61e784e7
MS
52void trad_frame_set_reg_value (struct trad_frame_cache *this_cache,
53 int regnum, LONGEST val);
54
0db9b4b7
AC
55void trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
56 struct frame_info *next_frame,
57 int regnum, int *optimizedp,
58 enum lval_type *lvalp, CORE_ADDR *addrp,
10c42a71 59 int *realregp, gdb_byte *bufferp);
2cdf3c63 60
8983bd83
AC
61/* A traditional saved regs table, indexed by REGNUM, encoding where
62 the value of REGNUM for the previous frame can be found in this
63 frame.
64
3b3850e8
AC
65 The table is initialized with an identity encoding (ADDR == -1,
66 REALREG == REGNUM) indicating that the value of REGNUM in the
67 previous frame can be found in register REGNUM (== REALREG) in this
8983bd83
AC
68 frame.
69
70 The initial encoding can then be changed:
71
3b3850e8
AC
72 Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
73 of register REGNUM in the previous frame can be found in memory at
74 ADDR in this frame (addr_p, !realreg_p, !value_p).
8983bd83 75
3b3850e8
AC
76 Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
77 value of register REGNUM in the previous frame is found in register
78 REALREG in this frame (!addr_p, realreg_p, !value_p).
8983bd83 79
3b3850e8
AC
80 Call trad_frame_set_value (REALREG == -1) to indicate that the
81 value of register REGNUM in the previous frame is found in ADDR
82 (!addr_p, !realreg_p, value_p).
83
84 Call trad_frame_set_unknown (REALREG == -2) to indicate that the
85 register's value is not known. */
8983bd83
AC
86
87struct trad_frame_saved_reg
a0f267c7 88{
8983bd83 89 LONGEST addr; /* A CORE_ADDR fits in a longest. */
3b3850e8 90 int realreg;
a0f267c7
AC
91};
92
3b3850e8
AC
93/* Encode REGNUM value in the trad-frame. */
94void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
95 int regnum, LONGEST val);
96
97/* Mark REGNUM as unknown. */
98void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
99 int regnum);
100
101/* Convenience functions, return non-zero if the register has been
102 encoded as specified. */
103int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
104 int regnum);
105int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
106 int regnum);
107int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
108 int regnum);
109
a0f267c7
AC
110
111/* Return a freshly allocated (and initialized) trad_frame array. */
8983bd83 112struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame);
a0f267c7
AC
113
114/* Given the trad_frame info, return the location of the specified
115 register. */
1f67027d
AC
116void trad_frame_get_prev_register (struct frame_info *next_frame,
117 struct trad_frame_saved_reg this_saved_regs[],
118 int regnum, int *optimizedp,
119 enum lval_type *lvalp, CORE_ADDR *addrp,
10c42a71 120 int *realregp, gdb_byte *bufferp);
a0f267c7
AC
121
122#endif
This page took 0.35084 seconds and 4 git commands to generate.