2011-07-26 Paul Pluzhnikov <ppluzhnikov@google.com>
[deliverable/binutils-gdb.git] / gdb / sentinel-frame.c
CommitLineData
a94dd1fd
AC
1/* Code dealing with register stack frames, for GDB, the GNU debugger.
2
6aba47ca 3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
7b6bb8da 4 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, 2008, 2009, 2010, 2011
6aba47ca 5 Free Software Foundation, Inc.
a94dd1fd
AC
6
7 This file is part of GDB.
8
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
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
a94dd1fd
AC
12 (at your option) any later version.
13
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.
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
a94dd1fd
AC
21
22
23#include "defs.h"
24#include "regcache.h"
25#include "sentinel-frame.h"
26#include "inferior.h"
27#include "frame-unwind.h"
28
29struct frame_unwind_cache
30{
31 struct regcache *regcache;
32};
33
34void *
35sentinel_frame_cache (struct regcache *regcache)
36{
37 struct frame_unwind_cache *cache =
38 FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache);
433759f7 39
a94dd1fd
AC
40 cache->regcache = regcache;
41 return cache;
42}
43
44/* Here the register value is taken direct from the register cache. */
45
669fac23
DJ
46static struct value *
47sentinel_frame_prev_register (struct frame_info *this_frame,
6dc42492 48 void **this_prologue_cache,
669fac23 49 int regnum)
a94dd1fd 50{
6dc42492 51 struct frame_unwind_cache *cache = *this_prologue_cache;
669fac23
DJ
52 struct value *value;
53
3543a589 54 value = regcache_cooked_read_value (cache->regcache, regnum);
669fac23
DJ
55 VALUE_FRAME_ID (value) = get_frame_id (this_frame);
56
669fac23 57 return value;
a94dd1fd
AC
58}
59
b9362cc7 60static void
669fac23 61sentinel_frame_this_id (struct frame_info *this_frame,
6dc42492
AC
62 void **this_prologue_cache,
63 struct frame_id *this_id)
a94dd1fd 64{
6dc42492
AC
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. */
e2e0b3e5 68 internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called"));
a94dd1fd
AC
69}
70
36f15f55
UW
71static struct gdbarch *
72sentinel_frame_prev_arch (struct frame_info *this_frame,
73 void **this_prologue_cache)
74{
75 struct frame_unwind_cache *cache = *this_prologue_cache;
433759f7 76
36f15f55
UW
77 return get_regcache_arch (cache->regcache);
78}
79
39d7b0e2 80const struct frame_unwind sentinel_frame_unwind =
a94dd1fd 81{
0e100dab 82 SENTINEL_FRAME,
8fbca658 83 default_frame_unwind_stop_reason,
6dc42492 84 sentinel_frame_this_id,
36f15f55
UW
85 sentinel_frame_prev_register,
86 NULL,
87 NULL,
88 NULL,
89 sentinel_frame_prev_arch,
a94dd1fd 90};
This page took 0.785324 seconds and 4 git commands to generate.