GDB (xrefs)
Loading...
Searching...
No Matches
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-2023 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{
30};
31
32void *
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
44static struct value *
46 void **this_prologue_cache,
47 int regnum)
48{
49 struct frame_unwind_cache *cache
50 = (struct frame_unwind_cache *) *this_prologue_cache;
51 struct value *value;
52
53 frame_id this_frame_id = get_frame_id (this_frame);
54 gdb_assert (is_sentinel_frame_id (this_frame_id));
55
57 VALUE_NEXT_FRAME_ID (value) = this_frame_id;
58
59 return value;
60}
61
62static void
64 void **this_prologue_cache,
65 struct frame_id *this_id)
66{
67 /* The sentinel frame is used as a starting point for creating the
68 previous (inner most) frame. That frame's THIS_ID method will be
69 called to determine the inner most frame's ID. Not this one. */
70 internal_error (_("sentinel_frame_this_id called"));
71}
72
73static struct gdbarch *
75 void **this_prologue_cache)
76{
77 struct frame_unwind_cache *cache
78 = (struct frame_unwind_cache *) *this_prologue_cache;
79
80 return cache->regcache->arch ();
81}
82
int regnum
struct value * cooked_read_value(int regnum)
Definition regcache.c:741
gdbarch * arch() const
Definition regcache.c:231
static bool is_sentinel_frame_id(frame_id id)
Definition frame-id.h:138
enum unwind_stop_reason default_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
struct frame_id get_frame_id(frame_info_ptr fi)
Definition frame.c:631
@ SENTINEL_FRAME
Definition frame.h:203
#define FRAME_OBSTACK_ZALLOC(TYPE)
Definition frame.h:825
int value
Definition py-param.c:79
const struct frame_unwind sentinel_frame_unwind
static struct value * sentinel_frame_prev_register(frame_info_ptr this_frame, void **this_prologue_cache, int regnum)
static void sentinel_frame_this_id(frame_info_ptr this_frame, void **this_prologue_cache, struct frame_id *this_id)
static struct gdbarch * sentinel_frame_prev_arch(frame_info_ptr this_frame, void **this_prologue_cache)
void * sentinel_frame_cache(struct regcache *regcache)
struct regcache * regcache
Definition value.h:130
#define VALUE_NEXT_FRAME_ID(val)
Definition value.h:959