1 /* Code dealing with register stack frames, for GDB, the GNU debugger.
3 Copyright (C) 1986-2017 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 3 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, see <http://www.gnu.org/licenses/>. */
23 #include "sentinel-frame.h"
25 #include "frame-unwind.h"
27 struct frame_unwind_cache
29 struct regcache
*regcache
;
33 sentinel_frame_cache (struct regcache
*regcache
)
35 struct frame_unwind_cache
*cache
=
36 FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache
);
38 cache
->regcache
= regcache
;
42 /* Here the register value is taken direct from the register cache. */
45 sentinel_frame_prev_register (struct frame_info
*this_frame
,
46 void **this_prologue_cache
,
49 struct frame_unwind_cache
*cache
50 = (struct frame_unwind_cache
*) *this_prologue_cache
;
53 value
= regcache_cooked_read_value (cache
->regcache
, regnum
);
54 VALUE_NEXT_FRAME_ID (value
) = sentinel_frame_id
;
60 sentinel_frame_this_id (struct frame_info
*this_frame
,
61 void **this_prologue_cache
,
62 struct frame_id
*this_id
)
64 /* The sentinel frame is used as a starting point for creating the
65 previous (inner most) frame. That frame's THIS_ID method will be
66 called to determine the inner most frame's ID. Not this one. */
67 internal_error (__FILE__
, __LINE__
, _("sentinel_frame_this_id called"));
70 static struct gdbarch
*
71 sentinel_frame_prev_arch (struct frame_info
*this_frame
,
72 void **this_prologue_cache
)
74 struct frame_unwind_cache
*cache
75 = (struct frame_unwind_cache
*) *this_prologue_cache
;
77 return cache
->regcache
->arch ();
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
,