| 1 | /* Target sections. |
| 2 | |
| 3 | Copyright (C) 2020-2021 Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | #ifndef GDB_TARGET_SECTION_H |
| 21 | #define GDB_TARGET_SECTION_H |
| 22 | |
| 23 | /* Struct target_section maps address ranges to file sections. It is |
| 24 | mostly used with BFD files, but can be used without (e.g. for handling |
| 25 | raw disks, or files not in formats handled by BFD). */ |
| 26 | |
| 27 | struct target_section |
| 28 | { |
| 29 | target_section (CORE_ADDR addr_, CORE_ADDR end_, struct bfd_section *sect_, |
| 30 | void *owner_ = nullptr) |
| 31 | : addr (addr_), |
| 32 | endaddr (end_), |
| 33 | the_bfd_section (sect_), |
| 34 | owner (owner_) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | /* Lowest address in section. */ |
| 39 | CORE_ADDR addr; |
| 40 | /* Highest address in section, plus 1. */ |
| 41 | CORE_ADDR endaddr; |
| 42 | |
| 43 | /* The BFD section. */ |
| 44 | struct bfd_section *the_bfd_section; |
| 45 | |
| 46 | /* The "owner" of the section. |
| 47 | It can be any unique value. It is set by add_target_sections |
| 48 | and used by remove_target_sections. |
| 49 | For example, for executables it is a pointer to exec_bfd and |
| 50 | for shlibs it is the so_list pointer. */ |
| 51 | void *owner; |
| 52 | }; |
| 53 | |
| 54 | /* Holds an array of target sections. */ |
| 55 | |
| 56 | using target_section_table = std::vector<target_section>; |
| 57 | |
| 58 | #endif /* GDB_TARGET_SECTION_H */ |