gdb/exec.h - gdb

Macros defined

Source code

  1. /* Work with executable files, for GDB, the GNU debugger.

  2.    Copyright (C) 2003-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 EXEC_H
  15. #define EXEC_H

  16. #include "target.h"
  17. #include "progspace.h"
  18. #include "memrange.h"

  19. struct target_section;
  20. struct target_ops;
  21. struct bfd;
  22. struct objfile;

  23. #define exec_bfd current_program_space->ebfd
  24. #define exec_bfd_mtime current_program_space->ebfd_mtime
  25. #define exec_filename current_program_space->pspace_exec_filename

  26. /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
  27.    Returns 0 if OK, 1 on error.  */

  28. extern int build_section_table (struct bfd *, struct target_section **,
  29.                                 struct target_section **);

  30. /* Remove all entries from TABLE.  */

  31. extern void clear_section_table (struct target_section_table *table);

  32. /* Read from mappable read-only sections of BFD executable files.
  33.    Return TARGET_XFER_OK, if read is successful.  Return
  34.    TARGET_XFER_EOF if read is done.  Return TARGET_XFER_E_IO
  35.    otherwise.  */

  36. extern enum target_xfer_status
  37.   exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
  38.                                ULONGEST len, ULONGEST *xfered_len);

  39. /* Read or write from mappable sections of BFD executable files.

  40.    Request to transfer up to LEN 8-bit bytes of the target sections
  41.    defined by SECTIONS and SECTIONS_END.  The OFFSET specifies the
  42.    starting address.
  43.    If SECTION_NAME is not NULL, only access sections with that same
  44.    name.

  45.    Return the number of bytes actually transfered, or zero when no
  46.    data is available for the requested range.

  47.    This function is intended to be used from target_xfer_partial
  48.    implementations.  See target_read and target_write for more
  49.    information.

  50.    One, and only one, of readbuf or writebuf must be non-NULL.  */

  51. extern enum target_xfer_status
  52.   section_table_xfer_memory_partial (gdb_byte *,
  53.                                      const gdb_byte *,
  54.                                      ULONGEST, ULONGEST, ULONGEST *,
  55.                                      struct target_section *,
  56.                                      struct target_section *,
  57.                                      const char *);

  58. /* Read from mappable read-only sections of BFD executable files.
  59.    Similar to exec_read_partial_read_only, but return
  60.    TARGET_XFER_UNAVAILABLE if data is unavailable.  */

  61. extern enum target_xfer_status
  62.   section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
  63.                                        ULONGEST len, ULONGEST *xfered_len);

  64. /* Set the loaded address of a section.  */
  65. extern void exec_set_section_address (const char *, int, CORE_ADDR);

  66. /* Remove all target sections owned by OWNER.  */

  67. extern void remove_target_sections (void *owner);

  68. /* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the
  69.    current set of target sections.  */

  70. extern void add_target_sections (void *owner,
  71.                                  struct target_section *sections,
  72.                                  struct target_section *sections_end);

  73. /* Add the sections of OBJFILE to the current set of target sections.
  74. * OBJFILE owns the new target sections.  */

  75. extern void add_target_sections_of_objfile (struct objfile *objfile);

  76. /* Prints info about all sections defined in the TABLE.  ABFD is
  77.    special cased --- it's filename is omitted; if it is the executable
  78.    file, its entry point is printed.  */

  79. extern void print_section_info (struct target_section_table *table,
  80.                                 bfd *abfd);

  81. extern void exec_close (void);

  82. #endif