gdb/gdbserver/regcache.h - gdb

Data types defined

Macros defined

Source code

  1. /* Register support routines for the remote server for GDB.
  2.    Copyright (C) 2001-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef REGCACHE_H
  15. #define REGCACHE_H

  16. #include "common-regcache.h"

  17. struct thread_info;
  18. struct target_desc;

  19. /* The register exists, it has a value, but we don't know what it is.
  20.    Used when inspecting traceframes.  */
  21. #define REG_UNAVAILABLE 0

  22. /* We know the register's value (and we have it cached).  */
  23. #define REG_VALID 1

  24. /* The data for the register cache.  Note that we have one per
  25.    inferior; this is primarily for simplicity, as the performance
  26.    benefit is minimal.  */

  27. struct regcache
  28. {
  29.   /* The regcache's target description.  */
  30.   const struct target_desc *tdesc;

  31.   /* Whether the REGISTERS buffer's contents are valid.  If false, we
  32.      haven't fetched the registers from the target yet.  Not that this
  33.      register cache is _not_ pass-through, unlike GDB's.  Note that
  34.      "valid" here is unrelated to whether the registers are available
  35.      in a traceframe.  For that, check REGISTER_STATUS below.  */
  36.   int registers_valid;
  37.   int registers_owned;
  38.   unsigned char *registers;
  39. #ifndef IN_PROCESS_AGENT
  40.   /* One of REG_UNAVAILBLE or REG_VALID.  */
  41.   unsigned char *register_status;
  42. #endif
  43. };

  44. struct regcache *init_register_cache (struct regcache *regcache,
  45.                                       const struct target_desc *tdesc,
  46.                                       unsigned char *regbuf);

  47. void regcache_cpy (struct regcache *dst, struct regcache *src);

  48. /* Create a new register cache for INFERIOR.  */

  49. struct regcache *new_register_cache (const struct target_desc *tdesc);

  50. struct regcache *get_thread_regcache (struct thread_info *thread, int fetch);

  51. /* Release all memory associated with the register cache for INFERIOR.  */

  52. void free_register_cache (struct regcache *regcache);

  53. /* Invalidate cached registers for one thread.  */

  54. void regcache_invalidate_thread (struct thread_info *);

  55. /* Invalidate cached registers for all threads of the current
  56.    process.  */

  57. void regcache_invalidate (void);

  58. /* Invalidate and release the register cache of all threads of the
  59.    current process.  */

  60. void regcache_release (void);

  61. /* Convert all registers to a string in the currently specified remote
  62.    format.  */

  63. void registers_to_string (struct regcache *regcache, char *buf);

  64. /* Convert a string to register values and fill our register cache.  */

  65. void registers_from_string (struct regcache *regcache, char *buf);

  66. /* For regcache_read_pc see common/common-regcache.h.  */

  67. void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);

  68. /* Return a pointer to the description of register ``n''.  */

  69. struct reg *find_register_by_number (const struct target_desc *tdesc, int n);

  70. int register_cache_size (const struct target_desc *tdesc);

  71. int register_size (const struct target_desc *tdesc, int n);

  72. int find_regno (const struct target_desc *tdesc, const char *name);

  73. void supply_register (struct regcache *regcache, int n, const void *buf);

  74. void supply_register_zeroed (struct regcache *regcache, int n);

  75. void supply_register_by_name (struct regcache *regcache,
  76.                               const char *name, const void *buf);

  77. void supply_regblock (struct regcache *regcache, const void *buf);

  78. void collect_register (struct regcache *regcache, int n, void *buf);

  79. void collect_register_as_string (struct regcache *regcache, int n, char *buf);

  80. void collect_register_by_name (struct regcache *regcache,
  81.                                const char *name, void *buf);

  82. #endif /* REGCACHE_H */