1 /* Code dealing with register stack frames, for GDB, the GNU debugger.
3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
4 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, 2008, 2009, 2010, 2011
5 Free Software Foundation, Inc.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "sentinel-frame.h"
27 #include "frame-unwind.h"
29 struct frame_unwind_cache
31 struct regcache
*regcache
;
35 sentinel_frame_cache (struct regcache
*regcache
)
37 struct frame_unwind_cache
*cache
=
38 FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache
);
40 cache
->regcache
= regcache
;
44 /* Here the register value is taken direct from the register cache. */
47 sentinel_frame_prev_register (struct frame_info
*this_frame
,
48 void **this_prologue_cache
,
51 struct frame_unwind_cache
*cache
= *this_prologue_cache
;
54 value
= regcache_cooked_read_value (cache
->regcache
, regnum
);
55 VALUE_FRAME_ID (value
) = get_frame_id (this_frame
);
61 sentinel_frame_this_id (struct frame_info
*this_frame
,
62 void **this_prologue_cache
,
63 struct frame_id
*this_id
)
65 /* The sentinel frame is used as a starting point for creating the
66 previous (inner most) frame. That frame's THIS_ID method will be
67 called to determine the inner most frame's ID. Not this one. */
68 internal_error (__FILE__
, __LINE__
, _("sentinel_frame_this_id called"));
71 static struct gdbarch
*
72 sentinel_frame_prev_arch (struct frame_info
*this_frame
,
73 void **this_prologue_cache
)
75 struct frame_unwind_cache
*cache
= *this_prologue_cache
;
77 return get_regcache_arch (cache
->regcache
);
80 const struct frame_unwind sentinel_frame_unwind
=
83 default_frame_unwind_stop_reason
,
84 sentinel_frame_this_id
,
85 sentinel_frame_prev_register
,
89 sentinel_frame_prev_arch
,