1 /* Definitions for a frame unwinder, for GDB, the GNU debugger.
3 Copyright 2003 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
22 #if !defined (FRAME_UNWIND_H)
23 #define FRAME_UNWIND_H 1
31 /* Return the frame unwind methods for the function that contains PC,
32 or NULL if this this unwinder can't handle this frame. */
34 typedef const struct frame_unwind *(frame_unwind_p_ftype) (CORE_ADDR pc);
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
40 extern void frame_unwind_append_predicate (struct gdbarch *gdbarch,
41 frame_unwind_p_ftype *p);
43 /* Iterate through the list of frame unwinders until one returns an
46 extern const struct frame_unwind *frame_unwind_find_by_pc (struct gdbarch
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.
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().
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. */
64 typedef void (frame_unwind_reg_ftype) (struct frame_info * frame,
68 enum lval_type * lvalp,
70 int *realnump, void *valuep);
72 /* Same as for registers above, but return the ID of the frame that
75 typedef void (frame_unwind_id_ftype) (struct frame_info * frame,
77 struct frame_id * id);
79 /* Discard the frame by restoring the registers (in regcache) back to
80 that of the caller. */
81 /* NOTE: cagney/2003-01-19: While at present the callers all pop each
82 frame in turn, the implementor should try to code things so that
83 any frame can be popped directly. */
84 /* FIXME: cagney/2003-01-19: Since both FRAME and REGCACHE refer to a
85 common register cache, care must be taken when restoring the
86 registers. The `correct fix' is to first first save the registers
87 in a scratch cache, and second write that scratch cache back to to
88 the real register cache. */
90 typedef void (frame_unwind_pop_ftype) (struct frame_info *frame,
92 struct regcache *regcache);
96 /* Should the frame's type go here? */
97 /* Should an attribute indicating the frame's address-in-block go
99 frame_unwind_pop_ftype *pop;
100 frame_unwind_id_ftype *id;
101 frame_unwind_reg_ftype *reg;