2003-01-18 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / frame-unwind.h
1 /* Definitions for a frame unwinder, 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 #if !defined (FRAME_UNWIND_H)
23 #define FRAME_UNWIND_H 1
24
25 struct frame_info;
26 struct frame_id;
27 struct frame_unwind;
28 struct gdbarch;
29 struct regcache;
30
31 /* Return the frame unwind methods for the function that contains PC,
32 or NULL if this this unwinder can't handle this frame. */
33
34 typedef const struct frame_unwind *(frame_unwind_p_ftype) (CORE_ADDR pc);
35
36 /* Add a frame unwinder to the list. The predicates are polled in the
37 order that they are appended. The initial list contains the dummy
38 frame's predicate. */
39
40 extern void frame_unwind_append_predicate (struct gdbarch *gdbarch,
41 frame_unwind_p_ftype *p);
42
43 /* Iterate through the list of frame unwinders until one returns an
44 implementation. */
45
46 extern const struct frame_unwind *frame_unwind_find_by_pc (struct gdbarch
47 *gdbarch,
48 CORE_ADDR pc);
49
50 /* Return the location (and possibly value) of REGNUM for the previous
51 (older, up) frame. All parameters except VALUEP can be assumed to
52 be non NULL. When VALUEP is NULL, just the location of the
53 register should be returned.
54
55 UNWIND_CACHE is provided as mechanism for implementing a per-frame
56 local cache. It's initial value being NULL. Memory for that cache
57 should be allocated using frame_obstack_zalloc().
58
59 Register window architectures (eg SPARC) should note that REGNUM
60 identifies the register for the previous frame. For instance, a
61 request for the value of "o1" for the previous frame would be found
62 in the register "i1" in this FRAME. */
63
64 typedef void (frame_unwind_reg_ftype) (struct frame_info * frame,
65 void **unwind_cache,
66 int regnum,
67 int *optimized,
68 enum lval_type * lvalp,
69 CORE_ADDR *addrp,
70 int *realnump, void *valuep);
71
72 /* Same as for registers above, but return the address at which the
73 calling frame would resume. */
74
75 typedef CORE_ADDR (frame_unwind_pc_ftype) (struct frame_info * frame,
76 void **unwind_cache);
77
78 /* Same as for registers above, but return the ID of the frame that
79 called this one. */
80
81 typedef void (frame_unwind_id_ftype) (struct frame_info * frame,
82 void **unwind_cache,
83 struct frame_id * id);
84
85
86 struct frame_unwind
87 {
88 /* Should the frame's type go here? */
89 /* Should an attribute indicating the frame's address-in-block go
90 here? */
91 frame_unwind_pc_ftype *pc;
92 frame_unwind_id_ftype *id;
93 frame_unwind_reg_ftype *reg;
94 };
95
96 #endif
This page took 0.03296 seconds and 5 git commands to generate.