Commit | Line | Data |
---|---|---|
0a30fbc4 | 1 | /* Register support routines for the remote server for GDB. |
32d0add0 | 2 | Copyright (C) 2001-2015 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 | ||
361c8ade GB |
22 | #include "common-regcache.h" |
23 | ||
442ea881 | 24 | struct thread_info; |
3aee8918 | 25 | struct target_desc; |
442ea881 | 26 | |
1c79eb8a PA |
27 | /* The register exists, it has a value, but we don't know what it is. |
28 | Used when inspecting traceframes. */ | |
29 | #define REG_UNAVAILABLE 0 | |
30 | ||
31 | /* We know the register's value (and we have it cached). */ | |
32 | #define REG_VALID 1 | |
33 | ||
442ea881 PA |
34 | /* The data for the register cache. Note that we have one per |
35 | inferior; this is primarily for simplicity, as the performance | |
36 | benefit is minimal. */ | |
37 | ||
38 | struct regcache | |
39 | { | |
3aee8918 PA |
40 | /* The regcache's target description. */ |
41 | const struct target_desc *tdesc; | |
42 | ||
1c79eb8a PA |
43 | /* Whether the REGISTERS buffer's contents are valid. If false, we |
44 | haven't fetched the registers from the target yet. Not that this | |
45 | register cache is _not_ pass-through, unlike GDB's. Note that | |
46 | "valid" here is unrelated to whether the registers are available | |
47 | in a traceframe. For that, check REGISTER_STATUS below. */ | |
442ea881 | 48 | int registers_valid; |
219f2f23 | 49 | int registers_owned; |
442ea881 | 50 | unsigned char *registers; |
1c79eb8a PA |
51 | #ifndef IN_PROCESS_AGENT |
52 | /* One of REG_UNAVAILBLE or REG_VALID. */ | |
53 | unsigned char *register_status; | |
54 | #endif | |
442ea881 | 55 | }; |
d06f167a | 56 | |
219f2f23 | 57 | struct regcache *init_register_cache (struct regcache *regcache, |
3aee8918 | 58 | const struct target_desc *tdesc, |
219f2f23 PA |
59 | unsigned char *regbuf); |
60 | ||
61 | void regcache_cpy (struct regcache *dst, struct regcache *src); | |
62 | ||
c04a1aa8 DJ |
63 | /* Create a new register cache for INFERIOR. */ |
64 | ||
3aee8918 | 65 | struct regcache *new_register_cache (const struct target_desc *tdesc); |
442ea881 PA |
66 | |
67 | struct regcache *get_thread_regcache (struct thread_info *thread, int fetch); | |
c04a1aa8 DJ |
68 | |
69 | /* Release all memory associated with the register cache for INFERIOR. */ | |
70 | ||
442ea881 | 71 | void free_register_cache (struct regcache *regcache); |
0d62e5e8 | 72 | |
3aee8918 PA |
73 | /* Invalidate cached registers for one thread. */ |
74 | ||
75 | void regcache_invalidate_thread (struct thread_info *); | |
76 | ||
77 | /* Invalidate cached registers for all threads of the current | |
78 | process. */ | |
0d62e5e8 | 79 | |
0d62e5e8 | 80 | void regcache_invalidate (void); |
c04a1aa8 | 81 | |
3aee8918 PA |
82 | /* Invalidate and release the register cache of all threads of the |
83 | current process. */ | |
84 | ||
85 | void regcache_release (void); | |
86 | ||
0a30fbc4 DJ |
87 | /* Convert all registers to a string in the currently specified remote |
88 | format. */ | |
89 | ||
442ea881 | 90 | void registers_to_string (struct regcache *regcache, char *buf); |
0a30fbc4 DJ |
91 | |
92 | /* Convert a string to register values and fill our register cache. */ | |
93 | ||
442ea881 | 94 | void registers_from_string (struct regcache *regcache, char *buf); |
0a30fbc4 | 95 | |
361c8ade | 96 | /* For regcache_read_pc see common/common-regcache.h. */ |
219f2f23 PA |
97 | |
98 | void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc); | |
99 | ||
0a30fbc4 DJ |
100 | /* Return a pointer to the description of register ``n''. */ |
101 | ||
3aee8918 | 102 | struct reg *find_register_by_number (const struct target_desc *tdesc, int n); |
0a30fbc4 | 103 | |
3aee8918 | 104 | int register_cache_size (const struct target_desc *tdesc); |
219f2f23 | 105 | |
3aee8918 | 106 | int register_size (const struct target_desc *tdesc, int n); |
0a30fbc4 | 107 | |
3aee8918 | 108 | int find_regno (const struct target_desc *tdesc, const char *name); |
0a30fbc4 | 109 | |
442ea881 | 110 | void supply_register (struct regcache *regcache, int n, const void *buf); |
0729219d | 111 | |
1c79eb8a PA |
112 | void supply_register_zeroed (struct regcache *regcache, int n); |
113 | ||
442ea881 PA |
114 | void supply_register_by_name (struct regcache *regcache, |
115 | const char *name, const void *buf); | |
0729219d | 116 | |
219f2f23 PA |
117 | void supply_regblock (struct regcache *regcache, const void *buf); |
118 | ||
442ea881 | 119 | void collect_register (struct regcache *regcache, int n, void *buf); |
0729219d | 120 | |
442ea881 | 121 | void collect_register_as_string (struct regcache *regcache, int n, char *buf); |
0d62e5e8 | 122 | |
493e2a69 MS |
123 | void collect_register_by_name (struct regcache *regcache, |
124 | const char *name, void *buf); | |
0729219d | 125 | |
0a30fbc4 | 126 | #endif /* REGCACHE_H */ |