GDBserver
/home/stan/gdb/src/gdb/gdbserver/regcache.h
Go to the documentation of this file.
00001 /* Register support routines for the remote server for GDB.
00002    Copyright (C) 2001-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #ifndef REGCACHE_H
00020 #define REGCACHE_H
00021 
00022 struct inferior_list_entry;
00023 struct thread_info;
00024 struct target_desc;
00025 
00026 /* The register exists, it has a value, but we don't know what it is.
00027    Used when inspecting traceframes.  */
00028 #define REG_UNAVAILABLE 0
00029 
00030 /* We know the register's value (and we have it cached).  */
00031 #define REG_VALID 1
00032 
00033 /* The data for the register cache.  Note that we have one per
00034    inferior; this is primarily for simplicity, as the performance
00035    benefit is minimal.  */
00036 
00037 struct regcache
00038 {
00039   /* The regcache's target description.  */
00040   const struct target_desc *tdesc;
00041 
00042   /* Whether the REGISTERS buffer's contents are valid.  If false, we
00043      haven't fetched the registers from the target yet.  Not that this
00044      register cache is _not_ pass-through, unlike GDB's.  Note that
00045      "valid" here is unrelated to whether the registers are available
00046      in a traceframe.  For that, check REGISTER_STATUS below.  */
00047   int registers_valid;
00048   int registers_owned;
00049   unsigned char *registers;
00050 #ifndef IN_PROCESS_AGENT
00051   /* One of REG_UNAVAILBLE or REG_VALID.  */
00052   unsigned char *register_status;
00053 #endif
00054 };
00055 
00056 struct regcache *init_register_cache (struct regcache *regcache,
00057                                       const struct target_desc *tdesc,
00058                                       unsigned char *regbuf);
00059 
00060 void regcache_cpy (struct regcache *dst, struct regcache *src);
00061 
00062 /* Create a new register cache for INFERIOR.  */
00063 
00064 struct regcache *new_register_cache (const struct target_desc *tdesc);
00065 
00066 struct regcache *get_thread_regcache (struct thread_info *thread, int fetch);
00067 
00068 /* Release all memory associated with the register cache for INFERIOR.  */
00069 
00070 void free_register_cache (struct regcache *regcache);
00071 
00072 /* Invalidate cached registers for one thread.  */
00073 
00074 void regcache_invalidate_thread (struct thread_info *);
00075 
00076 /* Invalidate cached registers for all threads of the current
00077    process.  */
00078 
00079 void regcache_invalidate (void);
00080 
00081 /* Invalidate and release the register cache of all threads of the
00082    current process.  */
00083 
00084 void regcache_release (void);
00085 
00086 /* Convert all registers to a string in the currently specified remote
00087    format.  */
00088 
00089 void registers_to_string (struct regcache *regcache, char *buf);
00090 
00091 /* Convert a string to register values and fill our register cache.  */
00092 
00093 void registers_from_string (struct regcache *regcache, char *buf);
00094 
00095 CORE_ADDR regcache_read_pc (struct regcache *regcache);
00096 
00097 void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);
00098 
00099 /* Return a pointer to the description of register ``n''.  */
00100 
00101 struct reg *find_register_by_number (const struct target_desc *tdesc, int n);
00102 
00103 int register_cache_size (const struct target_desc *tdesc);
00104 
00105 int register_size (const struct target_desc *tdesc, int n);
00106 
00107 int find_regno (const struct target_desc *tdesc, const char *name);
00108 
00109 void supply_register (struct regcache *regcache, int n, const void *buf);
00110 
00111 void supply_register_zeroed (struct regcache *regcache, int n);
00112 
00113 void supply_register_by_name (struct regcache *regcache,
00114                               const char *name, const void *buf);
00115 
00116 void supply_regblock (struct regcache *regcache, const void *buf);
00117 
00118 void collect_register (struct regcache *regcache, int n, void *buf);
00119 
00120 void collect_register_as_string (struct regcache *regcache, int n, char *buf);
00121 
00122 void collect_register_by_name (struct regcache *regcache,
00123                                const char *name, void *buf);
00124 
00125 #endif /* REGCACHE_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines