GDB (API)
/home/stan/gdb/src/gdb/exec.h
Go to the documentation of this file.
00001 /* Work with executable files, for GDB, the GNU debugger.
00002 
00003    Copyright (C) 2003-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifndef EXEC_H
00021 #define EXEC_H
00022 
00023 #include "target.h"
00024 #include "progspace.h"
00025 #include "memrange.h"
00026 
00027 struct target_section;
00028 struct target_ops;
00029 struct bfd;
00030 
00031 extern struct target_ops exec_ops;
00032 
00033 #define exec_bfd current_program_space->ebfd
00034 #define exec_bfd_mtime current_program_space->ebfd_mtime
00035 #define exec_filename current_program_space->pspace_exec_filename
00036 
00037 /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
00038    Returns 0 if OK, 1 on error.  */
00039 
00040 extern int build_section_table (struct bfd *, struct target_section **,
00041                                 struct target_section **);
00042 
00043 /* Resize the section table held by TABLE, by NUM_ADDED.  Returns the
00044    old size.  */
00045 
00046 extern int resize_section_table (struct target_section_table *, int);
00047 
00048 /* Appends all read-only memory ranges found in the target section
00049    table defined by SECTIONS and SECTIONS_END, starting at (and
00050    intersected with) MEMADDR for LEN bytes.  Returns the augmented
00051    VEC.  */
00052 
00053 extern VEC(mem_range_s) *
00054   section_table_available_memory (VEC(mem_range_s) *ranges,
00055                                   CORE_ADDR memaddr, ULONGEST len,
00056                                   struct target_section *sections,
00057                                   struct target_section *sections_end);
00058 
00059 /* Read or write from mappable sections of BFD executable files.
00060 
00061    Request to transfer up to LEN 8-bit bytes of the target sections
00062    defined by SECTIONS and SECTIONS_END.  The OFFSET specifies the
00063    starting address.
00064    If SECTION_NAME is not NULL, only access sections with that same
00065    name.
00066 
00067    Return the number of bytes actually transfered, or zero when no
00068    data is available for the requested range.
00069 
00070    This function is intended to be used from target_xfer_partial
00071    implementations.  See target_read and target_write for more
00072    information.
00073 
00074    One, and only one, of readbuf or writebuf must be non-NULL.  */
00075 
00076 extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
00077                                               ULONGEST, LONGEST,
00078                                               struct target_section *,
00079                                               struct target_section *,
00080                                               const char *);
00081 
00082 /* Set the loaded address of a section.  */
00083 extern void exec_set_section_address (const char *, int, CORE_ADDR);
00084 
00085 /* Remove all target sections owned by OWNER.  */
00086 
00087 extern void remove_target_sections (void *owner);
00088 
00089 /* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the
00090    current set of target sections.  */
00091 
00092 extern void add_target_sections (void *owner,
00093                                  struct target_section *sections,
00094                                  struct target_section *sections_end);
00095 
00096 /* Prints info about all sections defined in the TABLE.  ABFD is
00097    special cased --- it's filename is omitted; if it is the executable
00098    file, its entry point is printed.  */
00099 
00100 extern void print_section_info (struct target_section_table *table,
00101                                 bfd *abfd);
00102 
00103 extern void exec_close (void);
00104 
00105 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines