]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/dwarf2/dwz.h
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / dwarf2 / dwz.h
CommitLineData
9fda78b6
TT
1/* DWARF DWZ handling for GDB.
2
1d506c26 3 Copyright (C) 2003-2024 Free Software Foundation, Inc.
9fda78b6
TT
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
9938d15a
TT
27struct dwarf2_per_bfd;
28
9fda78b6
TT
29/* This represents a '.dwz' file. */
30
31struct dwz_file
32{
33 dwz_file (gdb_bfd_ref_ptr &&bfd)
34 : dwz_bfd (std::move (bfd))
35 {
36 }
37
38 const char *filename () const
39 {
40 return bfd_get_filename (this->dwz_bfd.get ());
41 }
42
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 {};
973db6fa 51 struct dwarf2_section_info types {};
9fda78b6
TT
52
53 /* The dwz's BFD. */
54 gdb_bfd_ref_ptr dwz_bfd;
55
56 /* If we loaded the index from an external file, this contains the
57 resources associated to the open file, memory mapping, etc. */
58 std::unique_ptr<index_cache_resource> index_cache_res;
0314b390
TT
59
60 /* Read a string at offset STR_OFFSET in the .debug_str section from
61 this dwz file. Throw an error if the offset is too large. If
62 the string consists of a single NUL byte, return NULL; otherwise
63 return a pointer to the string. */
64
65 const char *read_string (struct objfile *objfile, LONGEST str_offset);
9fda78b6
TT
66};
67
a37fbcfe 68/* Return the separate '.dwz' debug file. If there is no
9938d15a
TT
69 .gnu_debugaltlink section in the file, then the result depends on
70 REQUIRE: if REQUIRE is true, then error; if REQUIRE is false,
a37fbcfe 71 return NULL. */
9938d15a
TT
72
73extern dwz_file *dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd,
74 bool require = false);
75
a37fbcfe
TT
76/* Open the separate '.dwz' debug file, if needed. This just sets the
77 appropriate field in the per-BFD structure. If the DWZ file
78 exists, the relevant sections are read in as well. Throws an error
79 if the .gnu_debugaltlink section exists but the file cannot be
80 found. */
81
82extern void dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile);
83
9fda78b6 84#endif /* GDB_DWARF2_DWZ_H */