GDB (xrefs)
/tmp/gdb-7.10/gdb/sentinel-frame.c
Go to the documentation of this file.
1 /* Code dealing with register stack frames, for GDB, the GNU debugger.
2 
3  Copyright (C) 1986-2015 Free Software Foundation, Inc.
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
9  the Free Software Foundation; either version 3 of the License, or
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
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
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 
28 {
29  struct regcache *regcache;
30 };
31 
32 void *
34 {
35  struct frame_unwind_cache *cache =
37 
38  cache->regcache = regcache;
39  return cache;
40 }
41 
42 /* Here the register value is taken direct from the register cache. */
43 
44 static struct value *
46  void **this_prologue_cache,
47  int regnum)
48 {
49  struct frame_unwind_cache *cache = *this_prologue_cache;
50  struct value *value;
51 
52  value = regcache_cooked_read_value (cache->regcache, regnum);
53  VALUE_FRAME_ID (value) = get_frame_id (this_frame);
54 
55  return value;
56 }
57 
58 static void
59 sentinel_frame_this_id (struct frame_info *this_frame,
60  void **this_prologue_cache,
61  struct frame_id *this_id)
62 {
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"));
67 }
68 
69 static struct gdbarch *
71  void **this_prologue_cache)
72 {
73  struct frame_unwind_cache *cache = *this_prologue_cache;
74 
75  return get_regcache_arch (cache->regcache);
76 }
77 
78 const struct frame_unwind sentinel_frame_unwind =
79 {
84  NULL,
85  NULL,
86  NULL,
88 };
static struct gdbarch * sentinel_frame_prev_arch(struct frame_info *this_frame, void **this_prologue_cache)
#define VALUE_FRAME_ID(val)
Definition: value.h:436
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
Definition: regcache.c:297
void * sentinel_frame_cache(struct regcache *regcache)
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
#define _(String)
Definition: gdb_locale.h:40
#define FRAME_OBSTACK_ZALLOC(TYPE)
Definition: frame.h:660
struct frame_id get_frame_id(struct frame_info *fi)
Definition: frame.c:473
static struct value * sentinel_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
int regnum
Definition: aarch64-tdep.c:69
Definition: value.c:172
struct value * regcache_cooked_read_value(struct regcache *regcache, int regnum)
Definition: regcache.c:784
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
Definition: frame-unwind.c:180
struct regcache * regcache
static void sentinel_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)