GDB (xrefs)

/tmp/gdb-8.1/gdb/trad-frame.h
Go to the documentation of this file.
1 /* Traditional frame unwind support, for GDB the GNU Debugger.
2
3 Copyright (C) 2003-2018 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 3 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, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef TRAD_FRAME_H
21 #define TRAD_FRAME_H
22
23 #include "frame.h" /* For "struct frame_id". */
24
25 struct frame_info;
26 struct trad_frame_cache;
27
28 /* A simple, or traditional frame cache.
29
30 The entire cache is populated in a single pass and then generic
31 routines are used to extract the various cache values. */
32
33 struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *);
34
35 /* This frame's ID. */
36 void trad_frame_set_id (struct trad_frame_cache *this_trad_cache,
37 struct frame_id this_id);
38 void trad_frame_get_id (struct trad_frame_cache *this_trad_cache,
39 struct frame_id *this_id);
40 void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache,
41 CORE_ADDR this_base);
42 CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache);
43
44 void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
45 int regnum, int realreg);
46 void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
47 int regnum, CORE_ADDR addr);
48 void trad_frame_set_reg_value (struct trad_frame_cache *this_cache,
49 int regnum, LONGEST val);
50
51 struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
52 struct frame_info *this_frame,
53 int regnum);
54
55 /* A traditional saved regs table, indexed by REGNUM, encoding where
56 the value of REGNUM for the previous frame can be found in this
57 frame.
58
59 The table is initialized with an identity encoding (ADDR == -1,
60 REALREG == REGNUM) indicating that the value of REGNUM in the
61 previous frame can be found in register REGNUM (== REALREG) in this
62 frame.
63
64 The initial encoding can then be changed:
65
66 Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
67 of register REGNUM in the previous frame can be found in memory at
68 ADDR in this frame (addr_p, !realreg_p, !value_p).
69
70 Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
71 value of register REGNUM in the previous frame is found in register
72 REALREG in this frame (!addr_p, realreg_p, !value_p).
73
74 Call trad_frame_set_value (REALREG == -1) to indicate that the
75 value of register REGNUM in the previous frame is found in ADDR
76 (!addr_p, !realreg_p, value_p).
77
78 Call trad_frame_set_unknown (REALREG == -2) to indicate that the
79 register's value is not known. */
80
81 struct trad_frame_saved_reg
82 {
83 LONGEST addr; /* A CORE_ADDR fits in a longest. */
84 int realreg;
85 };
86
87 /* Encode REGNUM value in the trad-frame. */
88 void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
89 int regnum, LONGEST val);
90
91 /* Mark REGNUM as unknown. */
92 void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
93 int regnum);
94
95 /* Convenience functions, return non-zero if the register has been
96 encoded as specified. */
97 int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
98 int regnum);
99 int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
100 int regnum);
101 int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
102 int regnum);
103
104
105 /* Return a freshly allocated (and initialized) trad_frame array. */
106 struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *);
107 struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct gdbarch *);
108
109 /* Given the trad_frame info, return the location of the specified
110 register. */
111 struct value *trad_frame_get_prev_register (struct frame_info *this_frame,
112 struct trad_frame_saved_reg this_saved_regs[],
113 int regnum);
114
115 #endif
trad_frame_set_reg_realreg
void trad_frame_set_reg_realreg(struct trad_frame_cache *this_trad_cache, int regnum, int realreg)
Definition: trad-frame.c:118
gdbarch
Definition: gdbarch.c:127
trad_frame_set_id
void trad_frame_set_id(struct trad_frame_cache *this_trad_cache, struct frame_id this_id)
Definition: trad-frame.c:171
trad_frame_set_unknown
void trad_frame_set_unknown(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:133
trad_frame_addr_p
int trad_frame_addr_p(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:84
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
trad_frame_realreg_p
int trad_frame_realreg_p(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:91
frame_info
Definition: frame.c:85
trad_frame_alloc_saved_regs
struct trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct frame_info *)
Definition: trad-frame.c:68
trad_frame_get_this_base
CORE_ADDR trad_frame_get_this_base(struct trad_frame_cache *this_trad_cache)
Definition: trad-frame.c:192
trad_frame_cache::this_base
CORE_ADDR this_base
Definition: trad-frame.c:30
trad_frame_value_p
int trad_frame_value_p(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:78
trad_frame_set_value
void trad_frame_set_value(struct trad_frame_saved_reg this_saved_regs[], int regnum, LONGEST val)
Definition: trad-frame.c:99
trad_frame_cache
Definition: trad-frame.c:27
frame.h
trad_frame_get_id
void trad_frame_get_id(struct trad_frame_cache *this_trad_cache, struct frame_id *this_id)
Definition: trad-frame.c:178
trad_frame_cache_zalloc
struct trad_frame_cache * trad_frame_cache_zalloc(struct frame_info *)
Definition: trad-frame.c:36
trad_frame_get_prev_register
struct value * trad_frame_get_prev_register(struct frame_info *this_frame, struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:142
trad_frame_set_reg_value
void trad_frame_set_reg_value(struct trad_frame_cache *this_cache, int regnum, LONGEST val)
Definition: trad-frame.c:109
trad_frame_set_this_base
void trad_frame_set_this_base(struct trad_frame_cache *this_trad_cache, CORE_ADDR this_base)
Definition: trad-frame.c:185
regnum
int regnum
Definition: aarch64-tdep.c:77
value
Definition: value.c:169
trad_frame_saved_reg::addr
LONGEST addr
Definition: trad-frame.h:83
trad_frame_cache::this_id
struct frame_id this_id
Definition: trad-frame.c:32
trad_frame_get_register
struct value * trad_frame_get_register(struct trad_frame_cache *this_trad_cache, struct frame_info *this_frame, int regnum)
Definition: trad-frame.c:162
trad_frame_set_reg_addr
void trad_frame_set_reg_addr(struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr)
Definition: trad-frame.c:126
trad_frame_saved_reg
Definition: trad-frame.h:81
trad_frame_saved_reg::realreg
int realreg
Definition: trad-frame.h:84
frame_id
Definition: frame.h:111
LONGEST
long long LONGEST
Definition: common-types.h:52