gdb/testsuite/
[deliverable/binutils-gdb.git] / gdb / sentinel-frame.c
CommitLineData
a94dd1fd
AC
1/* Code dealing with register stack frames, for GDB, the GNU debugger.
2
28e7fd62 3 Copyright (C) 1986-2013 Free Software Foundation, Inc.
a94dd1fd
AC
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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
a94dd1fd
AC
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
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
a94dd1fd
AC
19
20
21#include "defs.h"
22#include "regcache.h"
23#include "sentinel-frame.h"
24#include "inferior.h"
25#include "frame-unwind.h"
26
27struct frame_unwind_cache
28{
29 struct regcache *regcache;
30};
31
32void *
33sentinel_frame_cache (struct regcache *regcache)
34{
35 struct frame_unwind_cache *cache =
36 FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache);
433759f7 37
a94dd1fd
AC
38 cache->regcache = regcache;
39 return cache;
40}
41
42/* Here the register value is taken direct from the register cache. */
43
669fac23
DJ
44static struct value *
45sentinel_frame_prev_register (struct frame_info *this_frame,
6dc42492 46 void **this_prologue_cache,
669fac23 47 int regnum)
a94dd1fd 48{
6dc42492 49 struct frame_unwind_cache *cache = *this_prologue_cache;
669fac23
DJ
50 struct value *value;
51
3543a589 52 value = regcache_cooked_read_value (cache->regcache, regnum);
669fac23
DJ
53 VALUE_FRAME_ID (value) = get_frame_id (this_frame);
54
669fac23 55 return value;
a94dd1fd
AC
56}
57
b9362cc7 58static void
669fac23 59sentinel_frame_this_id (struct frame_info *this_frame,
6dc42492
AC
60 void **this_prologue_cache,
61 struct frame_id *this_id)
a94dd1fd 62{
6dc42492
AC
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. */
e2e0b3e5 66 internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called"));
a94dd1fd
AC
67}
68
36f15f55
UW
69static struct gdbarch *
70sentinel_frame_prev_arch (struct frame_info *this_frame,
71 void **this_prologue_cache)
72{
73 struct frame_unwind_cache *cache = *this_prologue_cache;
433759f7 74
36f15f55
UW
75 return get_regcache_arch (cache->regcache);
76}
77
39d7b0e2 78const struct frame_unwind sentinel_frame_unwind =
a94dd1fd 79{
0e100dab 80 SENTINEL_FRAME,
8fbca658 81 default_frame_unwind_stop_reason,
6dc42492 82 sentinel_frame_this_id,
36f15f55
UW
83 sentinel_frame_prev_register,
84 NULL,
85 NULL,
86 NULL,
87 sentinel_frame_prev_arch,
a94dd1fd 88};
This page took 0.915396 seconds and 4 git commands to generate.