2003-06-17 Andrew Cagney <cagney@redhat.com>
[external/binutils.git] / gdb / trad-frame.h
1 /* Traditional frame unwind support, for GDB the GNU Debugger.
2
3    Copyright 2003 Free Software Foundation, Inc.
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
25 struct frame_info;
26
27 /* A traditional saved regs table, indexed by REGNUM, encoding where
28    the value of REGNUM for the previous frame can be found in this
29    frame.
30
31    The table is initialized with an identity encoding (ADDR == 0,
32    REALNUM == REGNUM) indicating that the value of REGNUM in the
33    previous frame can be found in register REGNUM (== REALNUM) in this
34    frame.
35
36    The initial encoding can then be changed:
37
38    Modify ADDR (REALNUM >= 0, ADDR != 0) to indicate that the value of
39    register REGNUM in the previous frame can be found in memory at
40    ADDR in this frame.
41
42    Modify REALNUM (REALNUM >= 0, ADDR == 0) to indicate that the value
43    of register REGNUM in the previous frame is found in register
44    REALNUM in this frame.
45
46    Call trad_frame_register_value (REALNUM < 0) to indicate that the
47    value of register REGNUM in the previous frame is found in ADDR.  */
48
49 struct trad_frame_saved_reg
50 {
51   LONGEST addr; /* A CORE_ADDR fits in a longest.  */
52   int realnum;
53 };
54
55 /* Convenience function, encode REGNUM's location in the trad-frame.  */
56 void trad_frame_register_value (struct trad_frame_saved_reg this_saved_regs[],
57                                 int regnum, LONGEST val);
58
59 /* Return a freshly allocated (and initialized) trad_frame array.  */
60 struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame);
61
62 /* Given the trad_frame info, return the location of the specified
63    register.  */
64 void trad_frame_prev_register (struct frame_info *next_frame,
65                                struct trad_frame_saved_reg this_saved_regs[],
66                                int regnum, int *optimizedp,
67                                enum lval_type *lvalp, CORE_ADDR *addrp,
68                                int *realnump, void *bufferp);
69
70 #endif