1 /* DWARF DWZ handling for GDB.
3 Copyright (C) 2003-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #ifndef GDB_DWARF2_DWZ_H
21 #define GDB_DWARF2_DWZ_H
24 #include "dwarf2/index-cache.h"
25 #include "dwarf2/section.h"
27 struct dwarf2_per_bfd
;
29 /* This represents a '.dwz' file. */
33 dwz_file (gdb_bfd_ref_ptr
&&bfd
)
34 : dwz_bfd (std::move (bfd
))
38 const char *filename () const
40 return bfd_get_filename (this->dwz_bfd
.get ());
43 /* A dwz file can only contain a few sections. */
44 struct dwarf2_section_info abbrev
{};
45 struct dwarf2_section_info info
{};
46 struct dwarf2_section_info str
{};
47 struct dwarf2_section_info line
{};
48 struct dwarf2_section_info macro
{};
49 struct dwarf2_section_info gdb_index
{};
50 struct dwarf2_section_info debug_names
{};
53 gdb_bfd_ref_ptr dwz_bfd
;
55 /* If we loaded the index from an external file, this contains the
56 resources associated to the open file, memory mapping, etc. */
57 std::unique_ptr
<index_cache_resource
> index_cache_res
;
59 /* Read a string at offset STR_OFFSET in the .debug_str section from
60 this dwz file. Throw an error if the offset is too large. If
61 the string consists of a single NUL byte, return NULL; otherwise
62 return a pointer to the string. */
64 const char *read_string (struct objfile
*objfile
, LONGEST str_offset
);
67 /* Open the separate '.dwz' debug file, if needed. If there is no
68 .gnu_debugaltlink section in the file, then the result depends on
69 REQUIRE: if REQUIRE is true, then error; if REQUIRE is false,
70 return NULL. Always error if there is such a section but the file
73 extern dwz_file
*dwarf2_get_dwz_file (dwarf2_per_bfd
*per_bfd
,
74 bool require
= false);
76 #endif /* GDB_DWARF2_DWZ_H */