gdb/gdbcore.h - gdb

Data types defined

Macros defined

Source code

  1. /* Machine independent variables that describe the core file under GDB.

  2.    Copyright (C) 1986-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. /* Interface routines for core, executable, etc.  */

  15. #if !defined (GDBCORE_H)
  16. #define GDBCORE_H 1

  17. struct type;
  18. struct regcache;

  19. #include "bfd.h"
  20. #include "exec.h"
  21. #include "target.h"

  22. /* Return the name of the executable file as a string.
  23.    ERR nonzero means get error if there is none specified;
  24.    otherwise return 0 in that case.  */

  25. extern char *get_exec_file (int err);

  26. /* Nonzero if there is a core file.  */

  27. extern int have_core_file_p (void);

  28. /* Report a memory error with error().  */

  29. extern void memory_error (enum target_xfer_status status, CORE_ADDR memaddr);

  30. /* The string 'memory_error' would use as exception message.  Space
  31.    for the result is malloc'd, caller must free.  */

  32. extern char *memory_error_message (enum target_xfer_status err,
  33.                                    struct gdbarch *gdbarch, CORE_ADDR memaddr);

  34. /* Like target_read_memory, but report an error if can't read.  */

  35. extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);

  36. /* Like target_read_stack, but report an error if can't read.  */

  37. extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);

  38. /* Like target_read_code, but report an error if can't read.  */

  39. extern void read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);

  40. /* Read an integer from debugged memory, given address and number of
  41.    bytes.  */

  42. extern LONGEST read_memory_integer (CORE_ADDR memaddr,
  43.                                     int len, enum bfd_endian byte_order);
  44. extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
  45.                                      enum bfd_endian byte_order,
  46.                                      LONGEST *return_value);

  47. /* Read an unsigned integer from debugged memory, given address and
  48.    number of bytes.  */

  49. extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
  50.                                               int len,
  51.                                               enum bfd_endian byte_order);

  52. /* Read an integer from debugged code memory, given address,
  53.    number of bytes, and byte order for code.  */

  54. extern LONGEST read_code_integer (CORE_ADDR memaddr, int len,
  55.                                   enum bfd_endian byte_order);

  56. /* Read an unsigned integer from debugged code memory, given address,
  57.    number of bytes, and byte order for code.  */

  58. extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr,
  59.                                             int len,
  60.                                             enum bfd_endian byte_order);

  61. /* Read a null-terminated string from the debuggee's memory, given
  62.    address, a buffer into which to place the string, and the maximum
  63.    available space.  */

  64. extern void read_memory_string (CORE_ADDR, char *, int);

  65. /* Read the pointer of type TYPE at ADDR, and return the address it
  66.    represents.  */

  67. CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);

  68. /* This takes a char *, not void *.  This is probably right, because
  69.    passing in an int * or whatever is wrong with respect to
  70.    byteswapping, alignment, different sizes for host vs. target types,
  71.    etc.  */

  72. extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
  73.                           ssize_t len);

  74. /* Same as write_memory, but notify 'memory_changed' observers.  */

  75. extern void write_memory_with_notification (CORE_ADDR memaddr,
  76.                                             const bfd_byte *myaddr,
  77.                                             ssize_t len);

  78. /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer.  */
  79. extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
  80.                                            enum bfd_endian byte_order,
  81.                                            ULONGEST value);

  82. /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer.  */
  83. extern void write_memory_signed_integer (CORE_ADDR addr, int len,
  84.                                          enum bfd_endian byte_order,
  85.                                          LONGEST value);

  86. /* Hook for `exec_file_command' command to call.  */

  87. extern void (*deprecated_exec_file_display_hook) (const char *filename);

  88. /* Hook for "file_command", which is more useful than above
  89.    (because it is invoked AFTER symbols are read, not before).  */

  90. extern void (*deprecated_file_changed_hook) (char *filename);

  91. extern void specify_exec_file_hook (void (*hook) (const char *filename));

  92. /* Binary File Diddler for the core file.  */

  93. extern bfd *core_bfd;

  94. extern struct target_ops *core_target;

  95. /* Whether to open exec and core files read-only or read-write.  */

  96. extern int write_files;

  97. extern void core_file_command (char *filename, int from_tty);

  98. extern void exec_file_attach (const char *filename, int from_tty);

  99. extern void exec_file_clear (int from_tty);

  100. extern void validate_files (void);

  101. /* The current default bfd target.  */

  102. extern char *gnutarget;

  103. extern void set_gnutarget (char *);

  104. /* Structure to keep track of core register reading functions for
  105.    various core file types.  */

  106. struct core_fns
  107.   {

  108.     /* BFD flavour that a core file handler is prepared to read.  This
  109.        can be used by the handler's core tasting function as a first
  110.        level filter to reject BFD's that don't have the right
  111.        flavour.  */

  112.     enum bfd_flavour core_flavour;

  113.     /* Core file handler function to call to recognize corefile
  114.        formats that BFD rejects.  Some core file format just don't fit
  115.        into the BFD model, or may require other resources to identify
  116.        them, that simply aren't available to BFD (such as symbols from
  117.        another file).  Returns nonzero if the handler recognizes the
  118.        format, zero otherwise.  */

  119.     int (*check_format) (bfd *);

  120.     /* Core file handler function to call to ask if it can handle a
  121.        given core file format or not.  Returns zero if it can't,
  122.        nonzero otherwise.  */

  123.     int (*core_sniffer) (struct core_fns *, bfd *);

  124.     /* Extract the register values out of the core file and supply them
  125.        into REGCACHE.

  126.        CORE_REG_SECT points to the register values themselves, read into
  127.        memory.

  128.        CORE_REG_SIZE is the size of that area.

  129.        WHICH says which set of registers we are handling:
  130.          0 --- integer registers
  131.          2 --- floating-point registers, on machines where they are
  132.                discontiguous
  133.          3 --- extended floating-point registers, on machines where
  134.                these are present in yet a third area.  (GNU/Linux uses
  135.                this to get at the SSE registers.)

  136.        REG_ADDR is the offset from u.u_ar0 to the register values relative to
  137.        core_reg_sect.  This is used with old-fashioned core files to locate the
  138.        registers in a large upage-plus-stack ".reg" section.  Original upage
  139.        address X is at location core_reg_sect+x+reg_addr.  */

  140.     void (*core_read_registers) (struct regcache *regcache,
  141.                                  char *core_reg_sect,
  142.                                  unsigned core_reg_size,
  143.                                  int which, CORE_ADDR reg_addr);

  144.     /* Finds the next struct core_fns.  They are allocated and
  145.        initialized in whatever module implements the functions pointed
  146.        to; an initializer calls deprecated_add_core_fns to add them to
  147.        the global chain.  */

  148.     struct core_fns *next;

  149.   };

  150. /* NOTE: cagney/2004-04-05: Replaced by "regset.h" and
  151.    regset_from_core_section().  */
  152. extern void deprecated_add_core_fns (struct core_fns *cf);
  153. extern int default_core_sniffer (struct core_fns *cf, bfd * abfd);
  154. extern int default_check_format (bfd * abfd);

  155. #endif /* !defined (GDBCORE_H) */