Commit | Line | Data |
---|---|---|
0a30fbc4 | 1 | /* Register support routines for the remote server for GDB. |
7b6bb8da | 2 | Copyright (C) 2001, 2002, 2007, 2008, 2009, 2010, 2011 |
4c38e0a4 | 3 | Free Software Foundation, Inc. |
0a30fbc4 DJ |
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
0a30fbc4 DJ |
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 | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
0a30fbc4 DJ |
19 | |
20 | #ifndef REGCACHE_H | |
21 | #define REGCACHE_H | |
22 | ||
0d62e5e8 | 23 | struct inferior_list_entry; |
442ea881 PA |
24 | struct thread_info; |
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 | { | |
1c79eb8a PA |
39 | /* Whether the REGISTERS buffer's contents are valid. If false, we |
40 | haven't fetched the registers from the target yet. Not that this | |
41 | register cache is _not_ pass-through, unlike GDB's. Note that | |
42 | "valid" here is unrelated to whether the registers are available | |
43 | in a traceframe. For that, check REGISTER_STATUS below. */ | |
442ea881 | 44 | int registers_valid; |
219f2f23 | 45 | int registers_owned; |
442ea881 | 46 | unsigned char *registers; |
1c79eb8a PA |
47 | #ifndef IN_PROCESS_AGENT |
48 | /* One of REG_UNAVAILBLE or REG_VALID. */ | |
49 | unsigned char *register_status; | |
50 | #endif | |
442ea881 | 51 | }; |
d06f167a | 52 | |
219f2f23 PA |
53 | struct regcache *init_register_cache (struct regcache *regcache, |
54 | unsigned char *regbuf); | |
55 | ||
56 | void regcache_cpy (struct regcache *dst, struct regcache *src); | |
57 | ||
c04a1aa8 DJ |
58 | /* Create a new register cache for INFERIOR. */ |
59 | ||
442ea881 PA |
60 | struct regcache *new_register_cache (void); |
61 | ||
62 | struct regcache *get_thread_regcache (struct thread_info *thread, int fetch); | |
c04a1aa8 DJ |
63 | |
64 | /* Release all memory associated with the register cache for INFERIOR. */ | |
65 | ||
442ea881 | 66 | void free_register_cache (struct regcache *regcache); |
0d62e5e8 DJ |
67 | |
68 | /* Invalidate cached registers for one or all threads. */ | |
69 | ||
70 | void regcache_invalidate_one (struct inferior_list_entry *); | |
71 | void regcache_invalidate (void); | |
c04a1aa8 | 72 | |
0a30fbc4 DJ |
73 | /* Convert all registers to a string in the currently specified remote |
74 | format. */ | |
75 | ||
442ea881 | 76 | void registers_to_string (struct regcache *regcache, char *buf); |
0a30fbc4 DJ |
77 | |
78 | /* Convert a string to register values and fill our register cache. */ | |
79 | ||
442ea881 | 80 | void registers_from_string (struct regcache *regcache, char *buf); |
0a30fbc4 | 81 | |
219f2f23 PA |
82 | CORE_ADDR regcache_read_pc (struct regcache *regcache); |
83 | ||
84 | void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc); | |
85 | ||
0a30fbc4 DJ |
86 | /* Return a pointer to the description of register ``n''. */ |
87 | ||
88 | struct reg *find_register_by_number (int n); | |
89 | ||
0a30fbc4 DJ |
90 | int register_size (int n); |
91 | ||
219f2f23 PA |
92 | int register_cache_size (void); |
93 | ||
0a30fbc4 DJ |
94 | int find_regno (const char *name); |
95 | ||
9b4b61c8 UW |
96 | /* The following two variables are set by auto-generated |
97 | code in the init_registers_... routines. */ | |
0a30fbc4 | 98 | extern const char **gdbserver_expedite_regs; |
9b4b61c8 | 99 | extern const char *gdbserver_xmltarget; |
0a30fbc4 | 100 | |
442ea881 | 101 | void supply_register (struct regcache *regcache, int n, const void *buf); |
0729219d | 102 | |
1c79eb8a PA |
103 | void supply_register_zeroed (struct regcache *regcache, int n); |
104 | ||
442ea881 PA |
105 | void supply_register_by_name (struct regcache *regcache, |
106 | const char *name, const void *buf); | |
0729219d | 107 | |
219f2f23 PA |
108 | void supply_regblock (struct regcache *regcache, const void *buf); |
109 | ||
442ea881 | 110 | void collect_register (struct regcache *regcache, int n, void *buf); |
0729219d | 111 | |
442ea881 | 112 | void collect_register_as_string (struct regcache *regcache, int n, char *buf); |
0d62e5e8 | 113 | |
493e2a69 MS |
114 | void collect_register_by_name (struct regcache *regcache, |
115 | const char *name, void *buf); | |
0729219d | 116 | |
0a30fbc4 | 117 | #endif /* REGCACHE_H */ |