2004-03-23 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / trad-frame.h
CommitLineData
a0f267c7
AC
1/* Traditional frame unwind support, for GDB the GNU Debugger.
2
0db9b4b7 3 Copyright 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
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
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);
42
43void trad_frame_set_reg_unknown (struct trad_frame_cache *this_trad_cache,
44 int regnum, CORE_ADDR addr);
45void trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
46 struct frame_info *next_frame,
47 int regnum, int *optimizedp,
48 enum lval_type *lvalp, CORE_ADDR *addrp,
49 int *realregp, void *bufferp);
2cdf3c63 50
8983bd83
AC
51/* A traditional saved regs table, indexed by REGNUM, encoding where
52 the value of REGNUM for the previous frame can be found in this
53 frame.
54
3b3850e8
AC
55 The table is initialized with an identity encoding (ADDR == -1,
56 REALREG == REGNUM) indicating that the value of REGNUM in the
57 previous frame can be found in register REGNUM (== REALREG) in this
8983bd83
AC
58 frame.
59
60 The initial encoding can then be changed:
61
3b3850e8
AC
62 Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
63 of register REGNUM in the previous frame can be found in memory at
64 ADDR in this frame (addr_p, !realreg_p, !value_p).
8983bd83 65
3b3850e8
AC
66 Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
67 value of register REGNUM in the previous frame is found in register
68 REALREG in this frame (!addr_p, realreg_p, !value_p).
8983bd83 69
3b3850e8
AC
70 Call trad_frame_set_value (REALREG == -1) to indicate that the
71 value of register REGNUM in the previous frame is found in ADDR
72 (!addr_p, !realreg_p, value_p).
73
74 Call trad_frame_set_unknown (REALREG == -2) to indicate that the
75 register's value is not known. */
8983bd83
AC
76
77struct trad_frame_saved_reg
a0f267c7 78{
8983bd83 79 LONGEST addr; /* A CORE_ADDR fits in a longest. */
3b3850e8 80 int realreg;
a0f267c7
AC
81};
82
3b3850e8
AC
83/* Encode REGNUM value in the trad-frame. */
84void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
85 int regnum, LONGEST val);
86
87/* Mark REGNUM as unknown. */
88void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
89 int regnum);
90
91/* Convenience functions, return non-zero if the register has been
92 encoded as specified. */
93int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
94 int regnum);
95int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
96 int regnum);
97int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
98 int regnum);
99
a0f267c7
AC
100
101/* Return a freshly allocated (and initialized) trad_frame array. */
8983bd83 102struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame);
a0f267c7
AC
103
104/* Given the trad_frame info, return the location of the specified
105 register. */
106void trad_frame_prev_register (struct frame_info *next_frame,
8983bd83 107 struct trad_frame_saved_reg this_saved_regs[],
a0f267c7
AC
108 int regnum, int *optimizedp,
109 enum lval_type *lvalp, CORE_ADDR *addrp,
3b3850e8 110 int *realregp, void *bufferp);
a0f267c7
AC
111
112#endif
This page took 0.125086 seconds and 4 git commands to generate.