From: Tom Tromey Date: Mon, 12 Oct 2020 21:53:16 +0000 (-0600) Subject: Introduce target-section.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b466b10241f3971ab628ace1e75cf1166209af5;p=binutils-gdb.git Introduce target-section.h This introduces a new target-section.h file. This makes some of the later patches in this series a bit cleaner, because new includes of target.h won't be required. Also I think it's better to have small header files for each separate data structure. gdb/ChangeLog 2020-10-12 Tom Tromey * target.h (struct target_section, struct target_section_table): Move to target-section.h. * target-section.h: New file. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 63ed7e4a5a4..96d57c7780f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-10-12 Tom Tromey + + * target.h (struct target_section, struct target_section_table): + Move to target-section.h. + * target-section.h: New file. + 2020-10-12 Pedro Alves PR exp/26602 diff --git a/gdb/target-section.h b/gdb/target-section.h new file mode 100644 index 00000000000..ff81675d7eb --- /dev/null +++ b/gdb/target-section.h @@ -0,0 +1,53 @@ +/* Target sections. + + Copyright (C) 2020 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_TARGET_SECTION_H +#define GDB_TARGET_SECTION_H + +/* Struct target_section maps address ranges to file sections. It is + mostly used with BFD files, but can be used without (e.g. for handling + raw disks, or files not in formats handled by BFD). */ + +struct target_section +{ + /* Lowest address in section. */ + CORE_ADDR addr; + /* Highest address in section, plus 1. */ + CORE_ADDR endaddr; + + /* The BFD section. */ + struct bfd_section *the_bfd_section; + + /* The "owner" of the section. + It can be any unique value. It is set by add_target_sections + and used by remove_target_sections. + For example, for executables it is a pointer to exec_bfd and + for shlibs it is the so_list pointer. */ + void *owner; +}; + +/* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */ + +struct target_section_table +{ + struct target_section *sections; + struct target_section *sections_end; +}; + +#endif /* GDB_TARGET_SECTION_H */ diff --git a/gdb/target.h b/gdb/target.h index 85455335714..cf0a296075d 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -44,6 +44,7 @@ struct inferior; #include "breakpoint.h" /* For enum bptype. */ #include "gdbsupport/scoped_restore.h" #include "gdbsupport/refcounted-object.h" +#include "target-section.h" /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or @@ -2405,33 +2406,6 @@ extern bool target_is_pushed (target_ops *t); extern CORE_ADDR target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset); -/* Struct target_section maps address ranges to file sections. It is - mostly used with BFD files, but can be used without (e.g. for handling - raw disks, or files not in formats handled by BFD). */ - -struct target_section - { - CORE_ADDR addr; /* Lowest address in section */ - CORE_ADDR endaddr; /* 1+highest address in section */ - - struct bfd_section *the_bfd_section; - - /* The "owner" of the section. - It can be any unique value. It is set by add_target_sections - and used by remove_target_sections. - For example, for executables it is a pointer to exec_bfd and - for shlibs it is the so_list pointer. */ - void *owner; - }; - -/* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */ - -struct target_section_table -{ - struct target_section *sections; - struct target_section *sections_end; -}; - /* Return the "section" containing the specified address. */ struct target_section *target_section_by_addr (struct target_ops *target, CORE_ADDR addr);