aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-04-29 11:08:24 -0400
committerSimon Marchi <simon.marchi@efficios.com>2024-05-30 15:40:54 -0400
commite2fbb7149660e6f3318ea768dee7adb340a166f0 (patch)
tree736ee351110a124f558854bc63d828016a83b49c
parent973bbc2236cbd9980734055c3f92689ae70d6012 (diff)
downloadgdb-e2fbb7149660e6f3318ea768dee7adb340a166f0.zip
gdb-e2fbb7149660e6f3318ea768dee7adb340a166f0.tar.gz
gdb-e2fbb7149660e6f3318ea768dee7adb340a166f0.tar.bz2
gdb: adjust includes in dwarf2/
For files under the dwarf2 directory: - Remove includes that are reported as unused by clangd. - Add any include required to ensure that all files include what they use. Change-Id: I2f13d75f18a390df480c6da8bdab1edba1e035e1
-rw-r--r--gdb/dwarf2/abbrev-cache.c1
-rw-r--r--gdb/dwarf2/abbrev-cache.h2
-rw-r--r--gdb/dwarf2/abbrev.c2
-rw-r--r--gdb/dwarf2/abbrev.h5
-rw-r--r--gdb/dwarf2/attribute.h1
-rw-r--r--gdb/dwarf2/cooked-index.c3
-rw-r--r--gdb/dwarf2/cooked-index.h6
-rw-r--r--gdb/dwarf2/dwz.h1
-rw-r--r--gdb/dwarf2/frame-tailcall.c2
-rw-r--r--gdb/dwarf2/frame.c2
-rw-r--r--gdb/dwarf2/index-cache.c2
-rw-r--r--gdb/dwarf2/index-cache.h2
-rw-r--r--gdb/dwarf2/index-write.c4
-rw-r--r--gdb/dwarf2/line-header.h4
-rw-r--r--gdb/dwarf2/loc.c1
-rw-r--r--gdb/dwarf2/macro.h8
-rw-r--r--gdb/dwarf2/mapped-index.h2
-rw-r--r--gdb/dwarf2/parent-map.h4
-rw-r--r--gdb/dwarf2/read.c3
-rw-r--r--gdb/dwarf2/read.h1
20 files changed, 26 insertions, 30 deletions
diff --git a/gdb/dwarf2/abbrev-cache.c b/gdb/dwarf2/abbrev-cache.c
index b87206c..7e1ff9c 100644
--- a/gdb/dwarf2/abbrev-cache.c
+++ b/gdb/dwarf2/abbrev-cache.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "dwarf2/read.h"
#include "dwarf2/abbrev-cache.h"
/* Hash function for an abbrev table. */
diff --git a/gdb/dwarf2/abbrev-cache.h b/gdb/dwarf2/abbrev-cache.h
index 99d1f93..8c32a40 100644
--- a/gdb/dwarf2/abbrev-cache.h
+++ b/gdb/dwarf2/abbrev-cache.h
@@ -21,6 +21,8 @@
#define GDB_DWARF2_ABBREV_CACHE_H
#include "dwarf2/abbrev.h"
+#include "dwarf2/types.h"
+#include "gdbsupport/gdb-hashtab.h"
/* An abbrev cache holds abbrev tables for easier reuse. */
class abbrev_cache
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
index 359a009..bae8d8b 100644
--- a/gdb/dwarf2/abbrev.c
+++ b/gdb/dwarf2/abbrev.c
@@ -24,9 +24,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "dwarf2/read.h"
#include "dwarf2/abbrev.h"
#include "dwarf2/leb.h"
+#include "dwarf2/section.h"
#include "bfd.h"
/* Hash function for an abbrev. */
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h
index 1fb90fd..d89983b 100644
--- a/gdb/dwarf2/abbrev.h
+++ b/gdb/dwarf2/abbrev.h
@@ -27,7 +27,10 @@
#ifndef GDB_DWARF2_ABBREV_H
#define GDB_DWARF2_ABBREV_H
-#include "hashtab.h"
+#include "dwarf2.h"
+#include "dwarf2/types.h"
+#include "gdbsupport/gdb-hashtab.h"
+#include "gdbsupport/gdb_obstack.h"
struct attr_abbrev
{
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index 3b971ad..115d006 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -29,7 +29,6 @@
#include "dwarf2.h"
#include "dwarf2/types.h"
-#include <optional>
/* Blocks are a bunch of untyped bytes. */
struct dwarf_block
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index c9e46af..e3545b5 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -24,14 +24,17 @@
#include "cp-support.h"
#include "c-lang.h"
#include "ada-lang.h"
+#include "dwarf2/tag.h"
#include "event-top.h"
#include "exceptions.h"
+#include "gdbsupport/task-group.h"
#include "split-name.h"
#include "observable.h"
#include "run-on-main-thread.h"
#include <algorithm>
#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/selftest.h"
+#include "gdbsupport/thread-pool.h"
#include <chrono>
#include <unordered_set>
#include "cli/cli-cmds.h"
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index d245570..45862a6 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -24,22 +24,16 @@
#include "dwarf2/types.h"
#include "symtab.h"
#include "hashtab.h"
-#include "dwarf2/index-common.h"
-#include <string_view>
#include "quick-symbol.h"
#include "gdbsupport/gdb_obstack.h"
#include "addrmap.h"
#include "gdbsupport/iterator-range.h"
-#include "gdbsupport/thread-pool.h"
#include "dwarf2/mapped-index.h"
#include "dwarf2/read.h"
-#include "dwarf2/tag.h"
#include "dwarf2/abbrev-cache.h"
#include "dwarf2/parent-map.h"
#include "gdbsupport/range-chain.h"
-#include "gdbsupport/task-group.h"
#include "complaints.h"
-#include "run-on-main-thread.h"
#if CXX_STD_THREAD
#include <mutex>
diff --git a/gdb/dwarf2/dwz.h b/gdb/dwarf2/dwz.h
index 5e6c1fa..3ec3af1 100644
--- a/gdb/dwarf2/dwz.h
+++ b/gdb/dwarf2/dwz.h
@@ -25,6 +25,7 @@
#include "dwarf2/section.h"
struct dwarf2_per_bfd;
+struct dwarf2_per_objfile;
/* This represents a '.dwz' file. */
diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c
index c489068..6ecf8a0 100644
--- a/gdb/dwarf2/frame-tailcall.c
+++ b/gdb/dwarf2/frame-tailcall.c
@@ -22,9 +22,7 @@
#include "dwarf2/frame-tailcall.h"
#include "dwarf2/loc.h"
#include "frame-unwind.h"
-#include "block.h"
#include "hashtab.h"
-#include "gdbtypes.h"
#include "regcache.h"
#include "value.h"
#include "dwarf2/frame.h"
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 9ebf3ac..79ef065 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -25,7 +25,6 @@
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
-#include "gdbcore.h"
#include "gdbtypes.h"
#include "symtab.h"
#include "objfiles.h"
@@ -37,7 +36,6 @@
#include "dwarf2/frame.h"
#include "dwarf2/read.h"
#include "dwarf2/public.h"
-#include "ax.h"
#include "dwarf2/loc.h"
#include "dwarf2/frame-tailcall.h"
#include "gdbsupport/gdb_binary_search.h"
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index 1720e92..529d1ef 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -28,8 +28,6 @@
#include "dwarf2/index-write.h"
#include "dwarf2/read.h"
#include "dwarf2/dwz.h"
-#include "objfiles.h"
-#include "gdbsupport/selftest.h"
#include <string>
#include <stdlib.h>
#include "run-on-main-thread.h"
diff --git a/gdb/dwarf2/index-cache.h b/gdb/dwarf2/index-cache.h
index 95f217e..08a2d56 100644
--- a/gdb/dwarf2/index-cache.h
+++ b/gdb/dwarf2/index-cache.h
@@ -20,9 +20,7 @@
#ifndef DWARF_INDEX_CACHE_H
#define DWARF_INDEX_CACHE_H
-#include "dwarf2/index-common.h"
#include "gdbsupport/array-view.h"
-#include "symfile.h"
class dwarf2_per_bfd;
class index_cache;
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 2a50e3b..1c2b16f 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -28,7 +28,6 @@
#include "gdbsupport/gdb_unlinker.h"
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/scoped_fd.h"
-#include "complaints.h"
#include "dwarf2/index-common.h"
#include "dwarf2/cooked-index.h"
#include "dwarf2.h"
@@ -43,10 +42,7 @@
#include "dwarf2/read-debug-names.h"
#include <algorithm>
-#include <cmath>
-#include <forward_list>
#include <map>
-#include <set>
#include <unordered_map>
#include <unordered_set>
diff --git a/gdb/dwarf2/line-header.h b/gdb/dwarf2/line-header.h
index c068dff..8e5a970 100644
--- a/gdb/dwarf2/line-header.h
+++ b/gdb/dwarf2/line-header.h
@@ -20,6 +20,8 @@
#ifndef DWARF2_LINE_HEADER_H
#define DWARF2_LINE_HEADER_H
+#include "dwarf2/types.h"
+
/* dir_index is 1-based in DWARF 4 and before, and is 0-based in DWARF 5 and
later. */
typedef int dir_index;
@@ -213,7 +215,7 @@ file_entry::include_dir (const line_header *lh) const
and must not be freed. */
extern line_header_up dwarf_decode_line_header
- (sect_offset sect_off, bool is_dwz, dwarf2_per_objfile *per_objfile,
+ (sect_offset sect_off, bool is_dwz, struct dwarf2_per_objfile *per_objfile,
struct dwarf2_section_info *section, const struct comp_unit_head *cu_header,
const char *comp_dir);
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 5fea668..dca0540 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -41,7 +41,6 @@
#include "dwarf2/frame.h"
#include "dwarf2/leb.h"
#include "compile/compile.h"
-#include "gdbsupport/selftest.h"
#include <algorithm>
#include <vector>
#include <unordered_set>
diff --git a/gdb/dwarf2/macro.h b/gdb/dwarf2/macro.h
index 586f5d5..e05f37c 100644
--- a/gdb/dwarf2/macro.h
+++ b/gdb/dwarf2/macro.h
@@ -21,16 +21,20 @@
#define GDB_DWARF2_MACRO_H
struct buildsym_compunit;
+struct dwarf2_cu;
+struct dwarf2_per_objfile;
+struct dwarf2_section_info;
+struct line_header;
extern void dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
buildsym_compunit *builder,
const dwarf2_section_info *section,
- const struct line_header *lh,
+ const line_header *lh,
unsigned int offset_size,
unsigned int offset,
dwarf2_section_info *str_section,
dwarf2_section_info *str_offsets_section,
std::optional<ULONGEST> str_offsets_base,
- int section_is_gnu, struct dwarf2_cu *cu);
+ int section_is_gnu, dwarf2_cu *cu);
#endif /* GDB_DWARF2_MACRO_H */
diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h
index 86a3c59..9d670ad 100644
--- a/gdb/dwarf2/mapped-index.h
+++ b/gdb/dwarf2/mapped-index.h
@@ -20,7 +20,9 @@
#ifndef GDB_DWARF2_MAPPED_INDEX_H
#define GDB_DWARF2_MAPPED_INDEX_H
+#include "dwarf2/index-common.h"
#include "language.h"
+#include "quick-symbol.h"
/* An index into a (C++) symbol name component in a symbol name as
recorded in the mapped_index's symbol table. For each C++ symbol
diff --git a/gdb/dwarf2/parent-map.h b/gdb/dwarf2/parent-map.h
index f070d50..5a94bd9 100644
--- a/gdb/dwarf2/parent-map.h
+++ b/gdb/dwarf2/parent-map.h
@@ -20,7 +20,9 @@
#ifndef GDB_DWARF2_PARENT_MAP_H
#define GDB_DWARF2_PARENT_MAP_H
-#include <algorithm>
+#include "addrmap.h"
+#include "dwarf2/types.h"
+#include "gdbsupport/gdb_obstack.h"
class cooked_index_entry;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4818da5..21d08b2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -48,6 +48,7 @@
#include "bfd.h"
#include "elf-bfd.h"
#include "event-top.h"
+#include "gdbsupport/task-group.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "objfiles.h"
@@ -70,7 +71,6 @@
#include "go-lang.h"
#include "valprint.h"
#include "gdbcore.h"
-#include "gdb/gdb-index.h"
#include "gdb_bfd.h"
#include "f-lang.h"
#include "source.h"
@@ -92,7 +92,6 @@
#include <unordered_set>
#include "dwarf2/abbrev-cache.h"
#include "cooked-index.h"
-#include "split-name.h"
#include "gdbsupport/thread-pool.h"
#include "run-on-main-thread.h"
#include "dwarf2/parent-map.h"
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 7ab6152..78fbd4d 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -28,7 +28,6 @@
#include "dwarf2/mapped-index.h"
#include "dwarf2/section.h"
#include "dwarf2/cu.h"
-#include "filename-seen-cache.h"
#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/hash_enum.h"
#include "gdbsupport/function-view.h"