* ppc-opc.c (powerpc_opcodes) <"lswx">: Use RAX for the second and
[binutils-gdb.git] / gdb / sentinel-frame.c
blob9d1a81e9facffa5e5699ebd0f4757077d338a503
1 /* Code dealing with register stack frames, for GDB, the GNU debugger.
3 Copyright (C) 1986-2002, 2007-2012 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/>. */
21 #include "defs.h"
22 #include "regcache.h"
23 #include "sentinel-frame.h"
24 #include "inferior.h"
25 #include "frame-unwind.h"
27 struct frame_unwind_cache
29 struct regcache *regcache;
32 void *
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;
39 return cache;
42 /* Here the register value is taken direct from the register cache. */
44 static struct value *
45 sentinel_frame_prev_register (struct frame_info *this_frame,
46 void **this_prologue_cache,
47 int regnum)
49 struct frame_unwind_cache *cache = *this_prologue_cache;
50 struct value *value;
52 value = regcache_cooked_read_value (cache->regcache, regnum);
53 VALUE_FRAME_ID (value) = get_frame_id (this_frame);
55 return value;
58 static void
59 sentinel_frame_this_id (struct frame_info *this_frame,
60 void **this_prologue_cache,
61 struct frame_id *this_id)
63 /* The sentinel frame is used as a starting point for creating the
64 previous (inner most) frame. That frame's THIS_ID method will be
65 called to determine the inner most frame's ID. Not this one. */
66 internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called"));
69 static struct gdbarch *
70 sentinel_frame_prev_arch (struct frame_info *this_frame,
71 void **this_prologue_cache)
73 struct frame_unwind_cache *cache = *this_prologue_cache;
75 return get_regcache_arch (cache->regcache);
78 const struct frame_unwind sentinel_frame_unwind =
80 SENTINEL_FRAME,
81 default_frame_unwind_stop_reason,
82 sentinel_frame_this_id,
83 sentinel_frame_prev_register,
84 NULL,
85 NULL,
86 NULL,
87 sentinel_frame_prev_arch,