Commit | Line | Data |
---|---|---|
0a30fbc4 | 1 | /* Register support routines for the remote server for GDB. |
ecd75fc8 | 2 | Copyright (C) 2001-2014 Free Software Foundation, Inc. |
0a30fbc4 DJ |
3 | |
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 8 | the Free Software Foundation; either version 3 of the License, or |
0a30fbc4 DJ |
9 | (at your option) any later version. |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
0a30fbc4 DJ |
18 | |
19 | #ifndef REGCACHE_H | |
20 | #define REGCACHE_H | |
21 | ||
0d62e5e8 | 22 | struct inferior_list_entry; |
442ea881 | 23 | struct thread_info; |
3aee8918 | 24 | struct target_desc; |
442ea881 | 25 | |
1c79eb8a PA |
26 | /* The register exists, it has a value, but we don't know what it is. |
27 | Used when inspecting traceframes. */ | |
28 | #define REG_UNAVAILABLE 0 | |
29 | ||
30 | /* We know the register's value (and we have it cached). */ | |
31 | #define REG_VALID 1 | |
32 | ||
442ea881 PA |
33 | /* The data for the register cache. Note that we have one per |
34 | inferior; this is primarily for simplicity, as the performance | |
35 | benefit is minimal. */ | |
36 | ||
37 | struct regcache | |
38 | { | |
3aee8918 PA |
39 | /* The regcache's target description. */ |
40 | const struct target_desc *tdesc; | |
41 | ||
1c79eb8a PA |
42 | /* Whether the REGISTERS buffer's contents are valid. If false, we |
43 | haven't fetched the registers from the target yet. Not that this | |
44 | register cache is _not_ pass-through, unlike GDB's. Note that | |
45 | "valid" here is unrelated to whether the registers are available | |
46 | in a traceframe. For that, check REGISTER_STATUS below. */ | |
442ea881 | 47 | int registers_valid; |
219f2f23 | 48 | int registers_owned; |
442ea881 | 49 | unsigned char *registers; |
1c79eb8a PA |
50 | #ifndef IN_PROCESS_AGENT |
51 | /* One of REG_UNAVAILBLE or REG_VALID. */ | |
52 | unsigned char *register_status; | |
53 | #endif | |
442ea881 | 54 | }; |
d06f167a | 55 | |
219f2f23 | 56 | struct regcache *init_register_cache (struct regcache *regcache, |
3aee8918 | 57 | const struct target_desc *tdesc, |
219f2f23 PA |
58 | unsigned char *regbuf); |
59 | ||
60 | void regcache_cpy (struct regcache *dst, struct regcache *src); | |
61 | ||
c04a1aa8 DJ |
62 | /* Create a new register cache for INFERIOR. */ |
63 | ||
3aee8918 | 64 | struct regcache *new_register_cache (const struct target_desc *tdesc); |
442ea881 PA |
65 | |
66 | struct regcache *get_thread_regcache (struct thread_info *thread, int fetch); | |
c04a1aa8 DJ |
67 | |
68 | /* Release all memory associated with the register cache for INFERIOR. */ | |
69 | ||
442ea881 | 70 | void free_register_cache (struct regcache *regcache); |
0d62e5e8 | 71 | |
3aee8918 PA |
72 | /* Invalidate cached registers for one thread. */ |
73 | ||
74 | void regcache_invalidate_thread (struct thread_info *); | |
75 | ||
76 | /* Invalidate cached registers for all threads of the current | |
77 | process. */ | |
0d62e5e8 | 78 | |
0d62e5e8 | 79 | void regcache_invalidate (void); |
c04a1aa8 | 80 | |
3aee8918 PA |
81 | /* Invalidate and release the register cache of all threads of the |
82 | current process. */ | |
83 | ||
84 | void regcache_release (void); | |
85 | ||
0a30fbc4 DJ |
86 | /* Convert all registers to a string in the currently specified remote |
87 | format. */ | |
88 | ||
442ea881 | 89 | void registers_to_string (struct regcache *regcache, char *buf); |
0a30fbc4 DJ |
90 | |
91 | /* Convert a string to register values and fill our register cache. */ | |
92 | ||
442ea881 | 93 | void registers_from_string (struct regcache *regcache, char *buf); |
0a30fbc4 | 94 | |
219f2f23 PA |
95 | CORE_ADDR regcache_read_pc (struct regcache *regcache); |
96 | ||
97 | void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc); | |
98 | ||
0a30fbc4 DJ |
99 | /* Return a pointer to the description of register ``n''. */ |
100 | ||
3aee8918 | 101 | struct reg *find_register_by_number (const struct target_desc *tdesc, int n); |
0a30fbc4 | 102 | |
3aee8918 | 103 | int register_cache_size (const struct target_desc *tdesc); |
219f2f23 | 104 | |
3aee8918 | 105 | int register_size (const struct target_desc *tdesc, int n); |
0a30fbc4 | 106 | |
3aee8918 | 107 | int find_regno (const struct target_desc *tdesc, const char *name); |
0a30fbc4 | 108 | |
442ea881 | 109 | void supply_register (struct regcache *regcache, int n, const void *buf); |
0729219d | 110 | |
1c79eb8a PA |
111 | void supply_register_zeroed (struct regcache *regcache, int n); |
112 | ||
442ea881 PA |
113 | void supply_register_by_name (struct regcache *regcache, |
114 | const char *name, const void *buf); | |
0729219d | 115 | |
219f2f23 PA |
116 | void supply_regblock (struct regcache *regcache, const void *buf); |
117 | ||
442ea881 | 118 | void collect_register (struct regcache *regcache, int n, void *buf); |
0729219d | 119 | |
442ea881 | 120 | void collect_register_as_string (struct regcache *regcache, int n, char *buf); |
0d62e5e8 | 121 | |
493e2a69 MS |
122 | void collect_register_by_name (struct regcache *regcache, |
123 | const char *name, void *buf); | |
0729219d | 124 | |
0a30fbc4 | 125 | #endif /* REGCACHE_H */ |