GDB (xrefs)
Loading...
Searching...
No Matches
user-regs.h
Go to the documentation of this file.
1/* Per-frame user registers, for GDB, the GNU debugger.
2
3 Copyright (C) 2002-2023 Free Software Foundation, Inc.
4
5 Contributed by Red Hat.
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
11 the Free Software Foundation; either version 3 of the License, or
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
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22#ifndef USER_REGS_H
23#define USER_REGS_H
24
25/* Implement both builtin, and architecture specific, per-frame user
26 visible registers.
27
28 Builtin registers apply to all architectures, where as architecture
29 specific registers are present when the architecture is selected.
30
31 These registers are assigned register numbers outside the
32 architecture's register range
33 [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs].
34 Their values should be constructed using per-frame information. */
35
36/* TODO: cagney/2003-06-27: Need to think more about how these
37 registers are added, read, and modified. At present they are kind
38 of assumed to be read-only. Should it, for instance, return a
39 register descriptor that contains all the relevant access methods. */
40
41class frame_info_ptr;
42struct gdbarch;
43
44/* Given an architecture, map a user visible register name onto its
45 index. */
46
48 const char *str, int len);
49
50extern const char *user_reg_map_regnum_to_name (struct gdbarch *gdbarch,
51 int regnum);
52
53/* Return the value of the frame register in the specified frame.
54
55 Note; These methods return a "struct value" instead of the raw
56 bytes as, at the time the register is being added, the type needed
57 to describe the register has not bee initialized. */
58
59typedef struct value *(user_reg_read_ftype) (frame_info_ptr frame,
60 const void *baton);
61extern struct value *value_of_user_reg (int regnum, frame_info_ptr frame);
62
63/* Add a builtin register (present in all architectures). */
64extern void user_reg_add_builtin (const char *name,
66 const void *baton);
67
68/* Add a per-architecture frame register. */
69extern void user_reg_add (struct gdbarch *gdbarch, const char *name,
70 user_reg_read_ftype *read, const void *baton);
71
72#endif
int regnum
const char *const name
ssize_t read(int fd, void *buf, size_t count)
Definition value.h:130
int user_reg_map_name_to_regnum(struct gdbarch *gdbarch, const char *str, int len)
Definition user-regs.c:132
void user_reg_add_builtin(const char *name, user_reg_read_ftype *read, const void *baton)
Definition user-regs.c:88
const char * user_reg_map_regnum_to_name(struct gdbarch *gdbarch, int regnum)
Definition user-regs.c:187
struct value * user_reg_read_ftype(frame_info_ptr frame, const void *baton)
Definition user-regs.h:59
void user_reg_add(struct gdbarch *gdbarch, const char *name, user_reg_read_ftype *read, const void *baton)
Definition user-regs.c:122
struct value * value_of_user_reg(int regnum, frame_info_ptr frame)
Definition user-regs.c:206