GDB (xrefs)
Loading...
Searching...
No Matches
frame-base.c
Go to the documentation of this file.
1/* Definitions for frame address handler, for GDB, the GNU debugger.
2
3 Copyright (C) 2003-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#include "defs.h"
21#include "frame-base.h"
22#include "frame.h"
23#include "gdbsupport/gdb_obstack.h"
24#include "gdbarch.h"
25
26/* A default frame base implementations. If it wasn't for the old
27 DEPRECATED_FRAME_LOCALS_ADDRESS and DEPRECATED_FRAME_ARGS_ADDRESS,
28 these could be combined into a single function. All architectures
29 really need to override this. */
30
31static CORE_ADDR
32default_frame_base_address (frame_info_ptr this_frame, void **this_cache)
33{
34 return get_frame_base (this_frame); /* sigh! */
35}
36
37static CORE_ADDR
38default_frame_locals_address (frame_info_ptr this_frame, void **this_cache)
39{
40 return default_frame_base_address (this_frame, this_cache);
41}
42
43static CORE_ADDR
44default_frame_args_address (frame_info_ptr this_frame, void **this_cache)
45{
46 return default_frame_base_address (this_frame, this_cache);
47}
48
55
61
68
70
71static struct frame_base_table *
73{
75 if (table == nullptr)
76 table = frame_base_data.emplace (gdbarch);
77 return table;
78}
79
80void
83{
85
86 (*table->tail)
88 (*table->tail)->sniffer = sniffer;
89 table->tail = &(*table->tail)->next;
90}
91
92void
100
101const struct frame_base *
103{
104 struct gdbarch *gdbarch = get_frame_arch (this_frame);
106 struct frame_base_table_entry *entry;
107
108 for (entry = table->head; entry != NULL; entry = entry->next)
109 {
110 const struct frame_base *desc = NULL;
111
112 desc = entry->sniffer (this_frame);
113 if (desc != NULL)
114 return desc;
115 }
116 return table->default_base;
117}
void * get(unsigned key)
Definition registry.h:211
const struct frame_base default_frame_base
Definition frame-base.c:49
void frame_base_append_sniffer(struct gdbarch *gdbarch, frame_base_sniffer_ftype *sniffer)
Definition frame-base.c:81
const struct frame_base * frame_base_find_by_frame(frame_info_ptr this_frame)
Definition frame-base.c:102
static CORE_ADDR default_frame_locals_address(frame_info_ptr this_frame, void **this_cache)
Definition frame-base.c:38
static const registry< gdbarch >::key< struct frame_base_table > frame_base_data
Definition frame-base.c:69
static CORE_ADDR default_frame_args_address(frame_info_ptr this_frame, void **this_cache)
Definition frame-base.c:44
static CORE_ADDR default_frame_base_address(frame_info_ptr this_frame, void **this_cache)
Definition frame-base.c:32
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
Definition frame-base.c:93
static struct frame_base_table * get_frame_base_table(struct gdbarch *gdbarch)
Definition frame-base.c:72
const struct frame_base * frame_base_sniffer_ftype(frame_info_ptr this_frame)
Definition frame-base.h:71
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
Definition frame.c:3027
CORE_ADDR get_frame_base(frame_info_ptr fi)
Definition frame.c:2879
#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE)
Definition gdbarch.h:327
Definition frame-base.c:57
struct frame_base_table_entry * next
Definition frame-base.c:59
frame_base_sniffer_ftype * sniffer
Definition frame-base.c:58
struct frame_base_table_entry * head
Definition frame-base.c:64
struct frame_base_table_entry ** tail
Definition frame-base.c:65
const struct frame_base * default_base
Definition frame-base.c:66