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