xref: /dflybsd-src/contrib/gdb-7/gdb/exec.h (revision cf7f2e2d389e8012d562650bd94d7e433f449d6e)
15796c8dcSSimon Schubert /* Work with executable files, for GDB, the GNU debugger.
25796c8dcSSimon Schubert 
3*cf7f2e2dSJohn Marino    Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert    This file is part of GDB.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
85796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
95796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
105796c8dcSSimon Schubert    (at your option) any later version.
115796c8dcSSimon Schubert 
125796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
135796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
145796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
155796c8dcSSimon Schubert    GNU General Public License for more details.
165796c8dcSSimon Schubert 
175796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
185796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
195796c8dcSSimon Schubert 
205796c8dcSSimon Schubert #ifndef EXEC_H
215796c8dcSSimon Schubert #define EXEC_H
225796c8dcSSimon Schubert 
235796c8dcSSimon Schubert #include "target.h"
24*cf7f2e2dSJohn Marino #include "progspace.h"
255796c8dcSSimon Schubert 
265796c8dcSSimon Schubert struct target_section;
275796c8dcSSimon Schubert struct target_ops;
285796c8dcSSimon Schubert struct bfd;
295796c8dcSSimon Schubert 
305796c8dcSSimon Schubert extern struct target_ops exec_ops;
315796c8dcSSimon Schubert 
32*cf7f2e2dSJohn Marino #define exec_bfd current_program_space->ebfd
33*cf7f2e2dSJohn Marino #define exec_bfd_mtime current_program_space->ebfd_mtime
34*cf7f2e2dSJohn Marino 
355796c8dcSSimon Schubert /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
365796c8dcSSimon Schubert    Returns 0 if OK, 1 on error.  */
375796c8dcSSimon Schubert 
385796c8dcSSimon Schubert extern int build_section_table (struct bfd *, struct target_section **,
395796c8dcSSimon Schubert 				struct target_section **);
405796c8dcSSimon Schubert 
415796c8dcSSimon Schubert /* Resize the section table held by TABLE, by NUM_ADDED.  Returns the
425796c8dcSSimon Schubert    old size.  */
435796c8dcSSimon Schubert 
445796c8dcSSimon Schubert extern int resize_section_table (struct target_section_table *, int);
455796c8dcSSimon Schubert 
465796c8dcSSimon Schubert /* Read or write from mappable sections of BFD executable files.
475796c8dcSSimon Schubert 
485796c8dcSSimon Schubert    Request to transfer up to LEN 8-bit bytes of the target sections
495796c8dcSSimon Schubert    defined by SECTIONS and SECTIONS_END.  The OFFSET specifies the
505796c8dcSSimon Schubert    starting address.
515796c8dcSSimon Schubert    If SECTION_NAME is not NULL, only access sections with that same
525796c8dcSSimon Schubert    name.
535796c8dcSSimon Schubert 
545796c8dcSSimon Schubert    Return the number of bytes actually transfered, or zero when no
555796c8dcSSimon Schubert    data is available for the requested range.
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert    This function is intended to be used from target_xfer_partial
585796c8dcSSimon Schubert    implementations.  See target_read and target_write for more
595796c8dcSSimon Schubert    information.
605796c8dcSSimon Schubert 
615796c8dcSSimon Schubert    One, and only one, of readbuf or writebuf must be non-NULL.  */
625796c8dcSSimon Schubert 
635796c8dcSSimon Schubert extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
645796c8dcSSimon Schubert 					      ULONGEST, LONGEST,
655796c8dcSSimon Schubert 					      struct target_section *,
665796c8dcSSimon Schubert 					      struct target_section *,
675796c8dcSSimon Schubert 					      const char *);
685796c8dcSSimon Schubert 
695796c8dcSSimon Schubert /* Set the loaded address of a section.  */
705796c8dcSSimon Schubert extern void exec_set_section_address (const char *, int, CORE_ADDR);
715796c8dcSSimon Schubert 
725796c8dcSSimon Schubert /* Remove all target sections taken from ABFD.  */
735796c8dcSSimon Schubert 
745796c8dcSSimon Schubert extern void remove_target_sections (bfd *abfd);
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert /* Add the sections array defined by [SECTIONS..SECTIONS_END[ to the
775796c8dcSSimon Schubert    current set of target sections.  */
785796c8dcSSimon Schubert 
795796c8dcSSimon Schubert extern void add_target_sections (struct target_section *sections,
805796c8dcSSimon Schubert 				 struct target_section *sections_end);
815796c8dcSSimon Schubert 
825796c8dcSSimon Schubert /* Prints info about all sections defined in the TABLE.  ABFD is
835796c8dcSSimon Schubert    special cased --- it's filename is omitted; if it is the executable
845796c8dcSSimon Schubert    file, its entry point is printed.  */
855796c8dcSSimon Schubert 
865796c8dcSSimon Schubert extern void print_section_info (struct target_section_table *table,
875796c8dcSSimon Schubert 				bfd *abfd);
885796c8dcSSimon Schubert 
89*cf7f2e2dSJohn Marino extern void exec_close (void);
905796c8dcSSimon Schubert 
915796c8dcSSimon Schubert #endif
92