]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/gdbserver/regcache.h
14619759427ccb8c6992cb968897864322e71641
[thirdparty/binutils-gdb.git] / gdb / gdbserver / regcache.h
1 /* Register support routines for the remote server for GDB.
2 Copyright (C) 2001, 2002, 2007, 2008, 2009, 2010, 2011
3 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 #ifndef REGCACHE_H
21 #define REGCACHE_H
22
23 struct inferior_list_entry;
24 struct thread_info;
25
26 /* The data for the register cache. Note that we have one per
27 inferior; this is primarily for simplicity, as the performance
28 benefit is minimal. */
29
30 struct regcache
31 {
32 int registers_valid;
33 int registers_owned;
34 unsigned char *registers;
35 };
36
37 struct regcache *init_register_cache (struct regcache *regcache,
38 unsigned char *regbuf);
39
40 void regcache_cpy (struct regcache *dst, struct regcache *src);
41
42 /* Create a new register cache for INFERIOR. */
43
44 struct regcache *new_register_cache (void);
45
46 struct regcache *get_thread_regcache (struct thread_info *thread, int fetch);
47
48 /* Release all memory associated with the register cache for INFERIOR. */
49
50 void free_register_cache (struct regcache *regcache);
51
52 /* Invalidate cached registers for one or all threads. */
53
54 void regcache_invalidate_one (struct inferior_list_entry *);
55 void regcache_invalidate (void);
56
57 /* Convert all registers to a string in the currently specified remote
58 format. */
59
60 void registers_to_string (struct regcache *regcache, char *buf);
61
62 /* Convert a string to register values and fill our register cache. */
63
64 void registers_from_string (struct regcache *regcache, char *buf);
65
66 CORE_ADDR regcache_read_pc (struct regcache *regcache);
67
68 void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);
69
70 /* Return a pointer to the description of register ``n''. */
71
72 struct reg *find_register_by_number (int n);
73
74 int register_size (int n);
75
76 int register_cache_size (void);
77
78 int find_regno (const char *name);
79
80 /* The following two variables are set by auto-generated
81 code in the init_registers_... routines. */
82 extern const char **gdbserver_expedite_regs;
83 extern const char *gdbserver_xmltarget;
84
85 void supply_register (struct regcache *regcache, int n, const void *buf);
86
87 void supply_register_by_name (struct regcache *regcache,
88 const char *name, const void *buf);
89
90 void supply_regblock (struct regcache *regcache, const void *buf);
91
92 void collect_register (struct regcache *regcache, int n, void *buf);
93
94 void collect_register_as_string (struct regcache *regcache, int n, char *buf);
95
96 void collect_register_by_name (struct regcache *regcache, const char *name, void *buf);
97
98 #endif /* REGCACHE_H */