| 1 | /* DWARF DWZ handling for GDB. |
| 2 | |
| 3 | Copyright (C) 2003-2020 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_DWARF2_DWZ_H |
| 21 | #define GDB_DWARF2_DWZ_H |
| 22 | |
| 23 | #include "gdb_bfd.h" |
| 24 | #include "dwarf2/index-cache.h" |
| 25 | #include "dwarf2/section.h" |
| 26 | |
| 27 | /* This represents a '.dwz' file. */ |
| 28 | |
| 29 | struct dwz_file |
| 30 | { |
| 31 | dwz_file (gdb_bfd_ref_ptr &&bfd) |
| 32 | : dwz_bfd (std::move (bfd)) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | const char *filename () const |
| 37 | { |
| 38 | return bfd_get_filename (this->dwz_bfd.get ()); |
| 39 | } |
| 40 | |
| 41 | /* A dwz file can only contain a few sections. */ |
| 42 | struct dwarf2_section_info abbrev {}; |
| 43 | struct dwarf2_section_info info {}; |
| 44 | struct dwarf2_section_info str {}; |
| 45 | struct dwarf2_section_info line {}; |
| 46 | struct dwarf2_section_info macro {}; |
| 47 | struct dwarf2_section_info gdb_index {}; |
| 48 | struct dwarf2_section_info debug_names {}; |
| 49 | |
| 50 | /* The dwz's BFD. */ |
| 51 | gdb_bfd_ref_ptr dwz_bfd; |
| 52 | |
| 53 | /* If we loaded the index from an external file, this contains the |
| 54 | resources associated to the open file, memory mapping, etc. */ |
| 55 | std::unique_ptr<index_cache_resource> index_cache_res; |
| 56 | |
| 57 | /* Read a string at offset STR_OFFSET in the .debug_str section from |
| 58 | this dwz file. Throw an error if the offset is too large. If |
| 59 | the string consists of a single NUL byte, return NULL; otherwise |
| 60 | return a pointer to the string. */ |
| 61 | |
| 62 | const char *read_string (struct objfile *objfile, LONGEST str_offset); |
| 63 | }; |
| 64 | |
| 65 | #endif /* GDB_DWARF2_DWZ_H */ |