[PATCH] Don't include gdbarch.h from defs.h

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Don't include gdbarch.h from defs.h

Tom Tromey-2
I touched symtab.h and was surprised to see how many files were
rebuilt.  I looked into it a bit, and found that defs.h includes
gdbarch.h, which in turn includes many things.

gdbarch.h is only needed by a minority ofthe files in gdb, so this
patch removes the include from defs.h and updates the fallout.

I did "wc -l" on the files in build/gdb/.deps; this patch reduces the
line count from 139935 to 137030; so there are definitely future
build-time savings here.

Note that while I configured with --enable-targets=all, it's possible
that some *-nat.c file needs an update.  I could not test all of
these.  The buildbot caught a few problems along these lines.

gdb/ChangeLog
2019-06-14  Tom Tromey  <[hidden email]>

        * defs.h: Don't include gdbarch.h.
        * aarch64-ravenscar-thread.c, aarch64-tdep.c, alpha-bsd-tdep.h,
        alpha-linux-tdep.c, alpha-mdebug-tdep.c, arch-utils.h, arm-tdep.h,
        ax-general.c, btrace.c, buildsym-legacy.c, buildsym.h, c-lang.c,
        cli/cli-decode.h, cli/cli-dump.c, cli/cli-script.h,
        cli/cli-style.h, coff-pe-read.h, compile/compile-c-support.c,
        compile/compile-cplus.h, compile/compile-loc2c.c, corefile.c,
        cp-valprint.c, cris-linux-tdep.c, ctf.c, d-lang.c, d-namespace.c,
        dcache.c, dicos-tdep.c, dictionary.c, disasm-selftests.c,
        dummy-frame.c, dummy-frame.h, dwarf2-frame-tailcall.c,
        dwarf2expr.c, expression.h, f-lang.c, frame-base.c,
        frame-unwind.c, frv-linux-tdep.c, gdbarch-selftests.c, gdbtypes.h,
        go-lang.c, hppa-nbsd-tdep.c, hppa-obsd-tdep.c, i386-dicos-tdep.c,
        i386-tdep.h, ia64-vms-tdep.c, interps.h, language.c,
        linux-record.c, location.h, m2-lang.c, m32r-linux-tdep.c,
        mem-break.c, memattr.c, mn10300-linux-tdep.c, nios2-linux-tdep.c,
        objfiles.h, opencl-lang.c, or1k-linux-tdep.c, p-lang.c,
        parser-defs.h, ppc-tdep.h, probe.h, python/py-record-btrace.c,
        record-btrace.c, record.h, regcache-dump.c, regcache.h,
        riscv-fbsd-tdep.c, riscv-linux-tdep.c, rust-exp.y,
        sh-linux-tdep.c, sh-nbsd-tdep.c, source-cache.c,
        sparc-nbsd-tdep.c, sparc-obsd-tdep.c, sparc-ravenscar-thread.c,
        sparc64-fbsd-tdep.c, std-regs.c, target-descriptions.h,
        target-float.c, tic6x-linux-tdep.c, tilegx-linux-tdep.c, top.c,
        tracefile.c, trad-frame.c, type-stack.h, ui-style.c, utils.c,
        utils.h, valarith.c, valprint.c, varobj.c, x86-tdep.c,
        xml-support.h, xtensa-linux-tdep.c: Update.
        * s390-linux-nat.c, procfs.c, inf-ptrace.c: Likewise.
---
 gdb/ChangeLog                   | 31 +++++++++++++++++++++++++++++++
 gdb/aarch64-ravenscar-thread.c  |  1 +
 gdb/aarch64-tdep.c              |  1 +
 gdb/alpha-bsd-tdep.h            |  2 ++
 gdb/alpha-linux-tdep.c          |  1 +
 gdb/alpha-mdebug-tdep.c         |  1 +
 gdb/arch-utils.h                |  3 ++-
 gdb/arm-tdep.h                  |  2 +-
 gdb/ax-general.c                |  1 +
 gdb/btrace.c                    |  1 +
 gdb/buildsym-legacy.c           |  1 +
 gdb/buildsym.h                  |  2 ++
 gdb/c-lang.c                    |  1 +
 gdb/cli/cli-decode.h            |  1 +
 gdb/cli/cli-dump.c              |  1 +
 gdb/cli/cli-script.h            |  2 ++
 gdb/cli/cli-style.h             |  1 +
 gdb/coff-pe-read.h              |  1 +
 gdb/compile/compile-c-support.c |  1 +
 gdb/compile/compile-cplus.h     |  1 +
 gdb/compile/compile-loc2c.c     |  1 +
 gdb/corefile.c                  |  1 +
 gdb/cp-valprint.c               |  1 +
 gdb/cris-linux-tdep.c           |  1 +
 gdb/ctf.c                       |  1 +
 gdb/d-lang.c                    |  1 +
 gdb/d-namespace.c               |  1 +
 gdb/dcache.c                    |  1 +
 gdb/defs.h                      |  3 ---
 gdb/dicos-tdep.c                |  1 +
 gdb/dictionary.c                |  1 +
 gdb/disasm-selftests.c          |  1 +
 gdb/dummy-frame.c               |  1 +
 gdb/dummy-frame.h               |  1 +
 gdb/dwarf2-frame-tailcall.c     |  1 +
 gdb/dwarf2expr.c                |  1 +
 gdb/expression.h                |  2 ++
 gdb/f-lang.c                    |  1 +
 gdb/frame-base.c                |  1 +
 gdb/frame-unwind.c              |  1 +
 gdb/frv-linux-tdep.c            |  1 +
 gdb/gdbarch-selftests.c         |  1 +
 gdb/gdbtypes.h                  |  1 -
 gdb/go-lang.c                   |  1 +
 gdb/hppa-nbsd-tdep.c            |  1 +
 gdb/hppa-obsd-tdep.c            |  1 +
 gdb/i386-dicos-tdep.c           |  1 +
 gdb/i386-tdep.h                 |  1 +
 gdb/ia64-vms-tdep.c             |  1 +
 gdb/inf-ptrace.c                |  1 +
 gdb/interps.h                   |  1 +
 gdb/language.c                  |  1 +
 gdb/linux-record.c              |  1 +
 gdb/location.h                  |  2 ++
 gdb/m2-lang.c                   |  1 +
 gdb/m32r-linux-tdep.c           |  1 +
 gdb/mem-break.c                 |  2 ++
 gdb/memattr.c                   |  1 +
 gdb/mn10300-linux-tdep.c        |  1 +
 gdb/nios2-linux-tdep.c          |  1 +
 gdb/objfiles.h                  |  1 +
 gdb/opencl-lang.c               |  1 +
 gdb/or1k-linux-tdep.c           |  1 +
 gdb/p-lang.c                    |  1 +
 gdb/parser-defs.h               |  1 +
 gdb/ppc-tdep.h                  |  2 ++
 gdb/probe.h                     |  2 ++
 gdb/procfs.c                    |  1 +
 gdb/python/py-record-btrace.c   |  1 +
 gdb/record-btrace.c             |  1 +
 gdb/record.h                    |  1 +
 gdb/regcache-dump.c             |  1 +
 gdb/regcache.h                  |  2 ++
 gdb/riscv-fbsd-tdep.c           |  1 +
 gdb/riscv-linux-tdep.c          |  1 +
 gdb/rust-exp.y                  |  1 +
 gdb/s390-linux-nat.c            |  1 +
 gdb/sh-linux-tdep.c             |  1 +
 gdb/sh-nbsd-tdep.c              |  1 +
 gdb/source-cache.c              |  1 +
 gdb/sparc-nbsd-tdep.c           |  1 +
 gdb/sparc-obsd-tdep.c           |  1 +
 gdb/sparc-ravenscar-thread.c    |  1 +
 gdb/sparc64-fbsd-tdep.c         |  1 +
 gdb/std-regs.c                  |  2 ++
 gdb/target-descriptions.h       |  1 +
 gdb/target-float.c              |  2 +-
 gdb/tic6x-linux-tdep.c          |  1 +
 gdb/tilegx-linux-tdep.c         |  1 +
 gdb/top.c                       |  1 +
 gdb/tracefile.c                 |  1 +
 gdb/trad-frame.c                |  1 +
 gdb/type-stack.h                |  1 +
 gdb/ui-style.c                  |  1 +
 gdb/utils.c                     |  1 +
 gdb/utils.h                     |  3 +++
 gdb/valarith.c                  |  1 +
 gdb/valprint.c                  |  1 +
 gdb/varobj.c                    |  1 +
 gdb/x86-tdep.c                  |  1 +
 gdb/xml-support.h               |  1 +
 gdb/xtensa-linux-tdep.c         |  1 +
 102 files changed, 143 insertions(+), 7 deletions(-)

diff --git a/gdb/aarch64-ravenscar-thread.c b/gdb/aarch64-ravenscar-thread.c
index 3e87a4bf5b9..ca22494a5ce 100644
--- a/gdb/aarch64-ravenscar-thread.c
+++ b/gdb/aarch64-ravenscar-thread.c
@@ -24,6 +24,7 @@
 #include "inferior.h"
 #include "ravenscar-thread.h"
 #include "aarch64-ravenscar-thread.h"
+#include "gdbarch.h"
 
 #define NO_OFFSET -1
 
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 96ebce4c352..40d2c9701c0 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -57,6 +57,7 @@
 #include "record.h"
 #include "record-full.h"
 #include "arch/aarch64-insn.h"
+#include "gdbarch.h"
 
 #include "opcode/aarch64.h"
 #include <algorithm>
diff --git a/gdb/alpha-bsd-tdep.h b/gdb/alpha-bsd-tdep.h
index 8c87e179a07..6e9719ff92c 100644
--- a/gdb/alpha-bsd-tdep.h
+++ b/gdb/alpha-bsd-tdep.h
@@ -20,6 +20,8 @@
 #ifndef ALPHA_BSD_TDEP_H
 #define ALPHA_BSD_TDEP_H
 
+#include "gdbarch.h"
+
 struct regcache;
 
 void alphabsd_supply_reg (struct regcache *, const char *, int);
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index bfa611e646f..27b2398fdbc 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -25,6 +25,7 @@
 #include "regcache.h"
 #include "linux-tdep.h"
 #include "alpha-tdep.h"
+#include "gdbarch.h"
 
 /* This enum represents the signals' numbers on the Alpha
    architecture.  It just contains the signal definitions which are
diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
index caab08b1220..cc10a5dd987 100644
--- a/gdb/alpha-mdebug-tdep.c
+++ b/gdb/alpha-mdebug-tdep.c
@@ -27,6 +27,7 @@
 
 #include "alpha-tdep.h"
 #include "mdebugread.h"
+#include "gdbarch.h"
 
 /* FIXME: Some of this code should perhaps be merged with mips.  */
 
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 155cf5cfe30..588e7c07624 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -20,7 +20,8 @@
 #ifndef ARCH_UTILS_H
 #define ARCH_UTILS_H
 
-struct gdbarch;
+#include "gdbarch.h"
+
 struct frame_info;
 struct minimal_symbol;
 struct type;
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index 23dd40ea8be..77b85677884 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -20,13 +20,13 @@
 #define ARM_TDEP_H
 
 /* Forward declarations.  */
-struct gdbarch;
 struct regset;
 struct address_space;
 struct get_next_pcs;
 struct arm_get_next_pcs;
 struct gdb_get_next_pcs;
 
+#include "gdbarch.h"
 #include "arch/arm.h"
 #include "infrun.h"
 
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index f956dfc2f53..52d76cf9ba0 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -23,6 +23,7 @@
 
 #include "defs.h"
 #include "ax.h"
+#include "gdbarch.h"
 
 #include "value.h"
 #include "user-regs.h"
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 2806b8c69d5..995c52b4460 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -34,6 +34,7 @@
 #include "common/rsp-low.h"
 #include "gdbcmd.h"
 #include "cli/cli-utils.h"
+#include "gdbarch.h"
 
 /* For maintenance commands.  */
 #include "record-btrace.h"
diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c
index a29c1280971..91f8eb869b7 100644
--- a/gdb/buildsym-legacy.c
+++ b/gdb/buildsym-legacy.c
@@ -18,6 +18,7 @@
 
 #include "defs.h"
 #include "buildsym-legacy.h"
+#include "symtab.h"
 
 /* The work-in-progress of the compunit we are building.
    This is created first, before any subfiles by start_symtab.  */
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 0f38d597a0f..193832fc37a 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -19,6 +19,8 @@
 #if !defined (BUILDSYM_H)
 #define BUILDSYM_H 1
 
+#include "gdb_obstack.h"
+
 struct objfile;
 struct symbol;
 struct addrmap;
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 5bb771b8643..57592dfbce0 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -35,6 +35,7 @@
 #include "gdb_obstack.h"
 #include <ctype.h>
 #include "gdbcore.h"
+#include "gdbarch.h"
 
 /* Given a C string type, STR_TYPE, return the corresponding target
    character set name.  */
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 05280d9d220..16a6ce9f66b 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -25,6 +25,7 @@
 #include "command.h"
 #include "gdb_regex.h"
 #include "cli-script.h"
+#include "completer.h"
 
 #if 0
 /* FIXME: cagney/2002-03-17: Once cmd_type() has been removed, ``enum
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 621bc9373ff..714c157d62a 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -32,6 +32,7 @@
 #include "gdb_bfd.h"
 #include "common/filestuff.h"
 #include "common/byte-vector.h"
+#include "gdbarch.h"
 
 static gdb::unique_xmalloc_ptr<char>
 scan_expression (const char **cmd, const char *def)
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index e76e794be57..eca34d9823e 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -17,6 +17,8 @@
 #ifndef CLI_CLI_SCRIPT_H
 #define CLI_CLI_SCRIPT_H
 
+#include "common/function-view.h"
+
 struct ui_file;
 struct cmd_list_element;
 
diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h
index 6ae265e6ef4..cdcea84f0ee 100644
--- a/gdb/cli/cli-style.h
+++ b/gdb/cli/cli-style.h
@@ -21,6 +21,7 @@
 #define CLI_CLI_STYLE_H
 
 #include "ui-file.h"
+#include "command.h"
 
 /* A single CLI style option.  */
 class cli_style_option
diff --git a/gdb/coff-pe-read.h b/gdb/coff-pe-read.h
index 539fe065454..ee4d69cec7c 100644
--- a/gdb/coff-pe-read.h
+++ b/gdb/coff-pe-read.h
@@ -22,6 +22,7 @@
 #if !defined (COFF_PE_READ_H)
 #define COFF_PE_READ_H
 
+class minimal_symbol_reader;
 struct objfile;
 struct bfd;
 
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index d1947da6570..9cf64926b6d 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -29,6 +29,7 @@
 #include "regcache.h"
 #include "common/function-view.h"
 #include "common/preprocessor.h"
+#include "gdbarch.h"
 
 /* See compile-internal.h.  */
 
diff --git a/gdb/compile/compile-cplus.h b/gdb/compile/compile-cplus.h
index e5ea7d7c81a..d3998e416a1 100644
--- a/gdb/compile/compile-cplus.h
+++ b/gdb/compile/compile-cplus.h
@@ -19,6 +19,7 @@
 
 #include "common/enum-flags.h"
 #include "gcc-cp-plugin.h"
+#include "symtab.h"
 
 struct type;
 struct block;
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index b5682d80a55..1ce4a629a01 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -30,6 +30,7 @@
 #include "dwarf2-frame.h"
 #include "common/gdb_vecs.h"
 #include "value.h"
+#include "gdbarch.h"
 
 
 
diff --git a/gdb/corefile.c b/gdb/corefile.c
index bf859fbbb8d..2354e64c0ce 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -32,6 +32,7 @@
 #include "completer.h"
 #include "observable.h"
 #include "cli/cli-utils.h"
+#include "gdbarch.h"
 
 /* You can have any number of hooks for `exec_file_command' command to
    call.  If there's only one hook, it is set in exec_file_display
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 5781d7ab561..9324a2d7fbf 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -36,6 +36,7 @@
 #include "extension.h"
 #include "typeprint.h"
 #include "common/byte-vector.h"
+#include "gdbarch.h"
 
 static struct obstack dont_print_vb_obstack;
 static struct obstack dont_print_statmem_obstack;
diff --git a/gdb/cris-linux-tdep.c b/gdb/cris-linux-tdep.c
index 27681cb8b27..3bab7404b17 100644
--- a/gdb/cris-linux-tdep.c
+++ b/gdb/cris-linux-tdep.c
@@ -26,6 +26,7 @@
 #include "linux-tdep.h"
 #include "solib-svr4.h"
 #include "symtab.h"
+#include "gdbarch.h"
 
 #include "cris-tdep.h"
 
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 7a95df78152..02c6fd3e898 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -32,6 +32,7 @@
 #include <ctype.h>
 #include <algorithm>
 #include "common/filestuff.h"
+#include "gdbarch.h"
 
 /* The CTF target.  */
 
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 0f8f916c9b1..b80b374d6f1 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -25,6 +25,7 @@
 #include "c-lang.h"
 #include "demangle.h"
 #include "cp-support.h"
+#include "gdbarch.h"
 
 /* The name of the symbol to use to get the name of the main subprogram.  */
 static const char D_MAIN[] = "D main";
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index 4edef188e9e..768ba23f014 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -24,6 +24,7 @@
 #include "namespace.h"
 #include "d-lang.h"
 #include "gdb_obstack.h"
+#include "gdbarch.h"
 
 /* This returns the length of first component of NAME, which should be
    the demangled name of a D variable/function/method/etc.
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 5a2e8f8000b..1716def4c4a 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -24,6 +24,7 @@
 #include "target-dcache.h"
 #include "inferior.h"
 #include "splay-tree.h"
+#include "gdbarch.h"
 
 /* Commands with a prefix of `{set,show} dcache'.  */
 static struct cmd_list_element *dcache_set_list = NULL;
diff --git a/gdb/defs.h b/gdb/defs.h
index e95d0d43480..42301eda09e 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -522,9 +522,6 @@ enum symbol_needs_kind
   SYMBOL_NEEDS_FRAME
 };
 
-/* Dynamic target-system-dependent parameters for GDB.  */
-#include "gdbarch.h"
-
 /* In findvar.c.  */
 
 template<typename T, typename = RequireLongest<T>>
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index bacba963685..954428a1101 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -23,6 +23,7 @@
 #include "solib-target.h"
 #include "inferior.h"
 #include "dicos-tdep.h"
+#include "gdbarch.h"
 
 void
 dicos_init_abi (struct gdbarch *gdbarch)
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 4e38b2e2340..2546c054e17 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -28,6 +28,7 @@
 #include "dictionary.h"
 #include "safe-ctype.h"
 #include <unordered_map>
+#include "language.h"
 
 /* This file implements dictionaries, which are tables that associate
    symbols to names.  They are represented by an opaque type 'struct
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index e0d84d981ee..13ee1c0a912 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -23,6 +23,7 @@
 #if GDB_SELF_TEST
 #include "common/selftest.h"
 #include "selftest-arch.h"
+#include "gdbarch.h"
 
 namespace selftests {
 
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index aebdd233d74..d3ede7c9a0c 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -29,6 +29,7 @@
 #include "observable.h"
 #include "gdbthread.h"
 #include "infcall.h"
+#include "gdbarch.h"
 
 struct dummy_frame_id
 {
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index b886f2eb010..6b8cbf6fc7a 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -24,6 +24,7 @@
 
 struct infcall_suspend_state;
 struct frame_unwind;
+class thread_info;
 
 /* Push the information needed to identify, and unwind from, a dummy
    frame onto the dummy frame stack.  */
diff --git a/gdb/dwarf2-frame-tailcall.c b/gdb/dwarf2-frame-tailcall.c
index 07db655ec56..e8f5aaf9c75 100644
--- a/gdb/dwarf2-frame-tailcall.c
+++ b/gdb/dwarf2-frame-tailcall.c
@@ -28,6 +28,7 @@
 #include "regcache.h"
 #include "value.h"
 #include "dwarf2-frame.h"
+#include "gdbarch.h"
 
 /* Contains struct tailcall_cache indexed by next_bottom_frame.  */
 static htab_t cache_htab;
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 3bd9abc4401..c085df01903 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -28,6 +28,7 @@
 #include "dwarf2expr.h"
 #include "dwarf2loc.h"
 #include "common/underlying.h"
+#include "gdbarch.h"
 
 /* Cookie for gdbarch data.  */
 
diff --git a/gdb/expression.h b/gdb/expression.h
index 841bf9891be..02b51f56e0d 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -20,6 +20,8 @@
 #if !defined (EXPRESSION_H)
 #define EXPRESSION_H 1
 
+#include "gdbtypes.h"
+
 /* While parsing expressions we need to track the innermost lexical block
    that we encounter.  In some situations we need to track the innermost
    block just for symbols, and in other situations we want to track the
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index e612eeda7f7..e93a5f34276 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -35,6 +35,7 @@
 #include "charset.h"
 #include "c-lang.h"
 #include "target-float.h"
+#include "gdbarch.h"
 
 #include <math.h>
 
diff --git a/gdb/frame-base.c b/gdb/frame-base.c
index 47897fc653d..30715869793 100644
--- a/gdb/frame-base.c
+++ b/gdb/frame-base.c
@@ -21,6 +21,7 @@
 #include "frame-base.h"
 #include "frame.h"
 #include "gdb_obstack.h"
+#include "gdbarch.h"
 
 /* A default frame base implementations.  If it wasn't for the old
    DEPRECATED_FRAME_LOCALS_ADDRESS and DEPRECATED_FRAME_ARGS_ADDRESS,
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index 4b38f64c2f1..61486652d42 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -26,6 +26,7 @@
 #include "regcache.h"
 #include "gdb_obstack.h"
 #include "target.h"
+#include "gdbarch.h"
 
 static struct gdbarch_data *frame_unwind_data;
 
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index e5261455fd9..cee2d0c5e24 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -31,6 +31,7 @@
 #include "frame-unwind.h"
 #include "regset.h"
 #include "linux-tdep.h"
+#include "gdbarch.h"
 
 /* Define the size (in bytes) of an FR-V instruction.  */
 static const int frv_instr_size = 4;
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
index 0efd4bc1305..a42db96c69b 100644
--- a/gdb/gdbarch-selftests.c
+++ b/gdb/gdbarch-selftests.c
@@ -27,6 +27,7 @@
 #include "test-target.h"
 #include "target-float.h"
 #include "common/def-vector.h"
+#include "gdbarch.h"
 
 namespace selftests {
 
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 49653ffcaf7..fee1bb1d3a3 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -50,7 +50,6 @@
 #include "common/enum-flags.h"
 #include "common/underlying.h"
 #include "common/print-utils.h"
-#include "gdbarch.h"
 
 /* Forward declarations for prototypes.  */
 struct field;
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 6473468d4d9..c77676c8a57 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -40,6 +40,7 @@
 #include "go-lang.h"
 #include "c-lang.h"
 #include "parser-defs.h"
+#include "gdbarch.h"
 
 #include <ctype.h>
 
diff --git a/gdb/hppa-nbsd-tdep.c b/gdb/hppa-nbsd-tdep.c
index 2ce842e7af7..bc80fcd4157 100644
--- a/gdb/hppa-nbsd-tdep.c
+++ b/gdb/hppa-nbsd-tdep.c
@@ -27,6 +27,7 @@
 
 #include "hppa-tdep.h"
 #include "hppa-bsd-tdep.h"
+#include "gdbarch.h"
 
 /* From <machine/mcontext.h>.  */
 static int hppanbsd_mc_reg_offset[] =
diff --git a/gdb/hppa-obsd-tdep.c b/gdb/hppa-obsd-tdep.c
index 553334535ee..983f9962078 100644
--- a/gdb/hppa-obsd-tdep.c
+++ b/gdb/hppa-obsd-tdep.c
@@ -24,6 +24,7 @@
 
 #include "hppa-tdep.h"
 #include "hppa-bsd-tdep.h"
+#include "gdbarch.h"
 
 /* Core file support.  */
 
diff --git a/gdb/i386-dicos-tdep.c b/gdb/i386-dicos-tdep.c
index 3f78cebb526..02af91aefd8 100644
--- a/gdb/i386-dicos-tdep.c
+++ b/gdb/i386-dicos-tdep.c
@@ -20,6 +20,7 @@
 #include "defs.h"
 #include "osabi.h"
 #include "dicos-tdep.h"
+#include "gdbarch.h"
 
 static void
 i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index c0d494824cc..456dd549c67 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -20,6 +20,7 @@
 #ifndef I386_TDEP_H
 #define I386_TDEP_H
 
+#include "gdbarch.h"
 #include "infrun.h"
 
 struct frame_info;
diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
index 6a15c92c805..f249f82438b 100644
--- a/gdb/ia64-vms-tdep.c
+++ b/gdb/ia64-vms-tdep.c
@@ -23,6 +23,7 @@
 #include "osabi.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
+#include "gdbarch.h"
 
 #ifdef HAVE_LIBUNWIND_IA64_H
 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index e1acd8dc9df..3e65412f4bf 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -33,6 +33,7 @@
 #include "gdbthread.h"
 #include "nat/fork-inferior.h"
 #include "utils.h"
+#include "gdbarch.h"
 
 
 
diff --git a/gdb/interps.h b/gdb/interps.h
index 7cdb4d97e80..7a349d9209a 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -25,6 +25,7 @@
 struct ui_out;
 struct interp;
 struct ui;
+class completion_tracker;
 
 typedef struct interp *(*interp_factory_func) (const char *name);
 
diff --git a/gdb/language.c b/gdb/language.c
index a7c09ccd6db..023f0f4ccba 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -45,6 +45,7 @@
 #include "frame.h"
 #include "c-lang.h"
 #include <algorithm>
+#include "gdbarch.h"
 
 static int unk_lang_parser (struct parser_state *);
 
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 338e8b93c91..11bb990fcae 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -24,6 +24,7 @@
 #include "record.h"
 #include "record-full.h"
 #include "linux-record.h"
+#include "gdbarch.h"
 
 /* These macros are the values of the first argument of system call
    "sys_ptrace".  The values of these macros were obtained from Linux
diff --git a/gdb/location.h b/gdb/location.h
index 9e87520dfb1..e4058ed6bd9 100644
--- a/gdb/location.h
+++ b/gdb/location.h
@@ -19,6 +19,8 @@
 #ifndef LOCATION_H
 #define LOCATION_H
 
+#include "symtab.h"
+
 struct language_defn;
 struct event_location;
 
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 6fe628978cf..759414d7f0f 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -27,6 +27,7 @@
 #include "m2-lang.h"
 #include "c-lang.h"
 #include "valprint.h"
+#include "gdbarch.h"
 
 static void m2_printchar (int, struct type *, struct ui_file *);
 static void m2_emit_char (int, struct type *, struct ui_file *, int);
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index 4c088ec0dee..a1c88394351 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -36,6 +36,7 @@
 
 #include "m32r-tdep.h"
 #include "linux-tdep.h"
+#include "gdbarch.h"
 
 
 
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index abf8885b5ad..cf2ba593a59 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -24,6 +24,8 @@
 #include "breakpoint.h"
 #include "inferior.h"
 #include "target.h"
+#include "gdbarch.h"
+
 /* Insert a breakpoint on targets that don't have any better
    breakpoint support.  We read the contents of the target location
    and stash it, then overwrite it with a breakpoint instruction.
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 858a41abfb4..14df07de61e 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -29,6 +29,7 @@
 #include "breakpoint.h"
 #include "cli/cli-utils.h"
 #include <algorithm>
+#include "gdbarch.h"
 
 static std::vector<mem_region> user_mem_region_list, target_mem_region_list;
 static std::vector<mem_region> *mem_region_list = &target_mem_region_list;
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index 706096c7529..70f377f80ae 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -30,6 +30,7 @@
 #include "trad-frame.h"
 #include "tramp-frame.h"
 #include "linux-tdep.h"
+#include "gdbarch.h"
 
 /* Transliterated from <asm-mn10300/elf.h>...  */
 #define MN10300_ELF_NGREG 28
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index 2d38e603c06..f48cd9a1bad 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -29,6 +29,7 @@
 #include "linux-tdep.h"
 #include "glibc-tdep.h"
 #include "nios2-tdep.h"
+#include "gdbarch.h"
 
 /* Core file and register set support.  */
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index e0ff8343439..ec79ee3fb0d 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -33,6 +33,7 @@
 #include "common/next-iterator.h"
 #include "common/safe-iterator.h"
 #include "bcache.h"
+#include "gdbarch.h"
 
 struct htab;
 struct objfile_data;
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 93d8e2f5dd3..8ced334a2d3 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -26,6 +26,7 @@
 #include "language.h"
 #include "varobj.h"
 #include "c-lang.h"
+#include "gdbarch.h"
 
 /* This macro generates enum values from a given type.  */
 
diff --git a/gdb/or1k-linux-tdep.c b/gdb/or1k-linux-tdep.c
index f75a17b2c53..b8076dc8056 100644
--- a/gdb/or1k-linux-tdep.c
+++ b/gdb/or1k-linux-tdep.c
@@ -25,6 +25,7 @@
 #include "regset.h"
 #include "tramp-frame.h"
 #include "trad-frame.h"
+#include "gdbarch.h"
 
 /* Define the general register mapping.  The kernel puts the PC at offset 0,
    gdb puts it at offset 32.  Register x0 is always 0 and can be ignored.
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 9b9f19b69cf..cfe2a888722 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -31,6 +31,7 @@
 #include "value.h"
 #include <ctype.h>
 #include "c-lang.h"
+#include "gdbarch.h"
 
 /* All GPC versions until now (2007-09-27) also define a symbol called
    '_p_initialize'.  Check for the presence of this symbol first.  */
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 4254ef60e62..6f47f19fe6b 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -25,6 +25,7 @@
 
 #include "common/vec.h"
 #include "expression.h"
+#include "symtab.h"
 
 struct block;
 struct language_defn;
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 9297fe2b097..1749f476eb1 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -20,6 +20,8 @@
 #ifndef PPC_TDEP_H
 #define PPC_TDEP_H
 
+#include "gdbarch.h"
+
 struct gdbarch;
 struct frame_info;
 struct value;
diff --git a/gdb/probe.h b/gdb/probe.h
index 5c83f494714..8abf69e3540 100644
--- a/gdb/probe.h
+++ b/gdb/probe.h
@@ -20,6 +20,8 @@
 #if !defined (PROBE_H)
 #define PROBE_H 1
 
+#include "symtab.h"
+
 struct event_location;
 struct linespec_result;
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 020336e5ba4..23e8ee4169e 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -32,6 +32,7 @@
 #include "inf-child.h"
 #include "nat/fork-inferior.h"
 #include "common/filestuff.h"
+#include "gdbarch.h"
 
 #define _STRUCTURED_PROC 1 /* Should be done by configure script.  */
 
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index e7153fb6d7b..82cef4f0864 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -26,6 +26,7 @@
 #include "py-record-btrace.h"
 #include "record-btrace.h"
 #include "disasm.h"
+#include "gdbarch.h"
 
 #if defined (IS_PY3K)
 
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 21085d5c62c..56fbd8986da 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -41,6 +41,7 @@
 #include "common/vec.h"
 #include "inferior.h"
 #include <algorithm>
+#include "gdbarch.h"
 
 static const target_info record_btrace_target_info = {
   "record-btrace",
diff --git a/gdb/record.h b/gdb/record.h
index 03f96e8ab78..7f5dab3e6bd 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -23,6 +23,7 @@
 #include "target/waitstatus.h" /* For enum target_stop_reason.  */
 #include "common/enum-flags.h"
 
+struct address_space;
 struct cmd_list_element;
 struct inferior;
 
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c
index 1bcf9c3d17a..876998dc17e 100644
--- a/gdb/regcache-dump.c
+++ b/gdb/regcache-dump.c
@@ -23,6 +23,7 @@
 #include "remote.h"
 #include "reggroups.h"
 #include "target.h"
+#include "gdbarch.h"
 
 /* Dump registers from regcache, used for dumping raw registers and
    cooked registers.  */
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 2b703ea4a4b..60bc5c7c47e 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -21,12 +21,14 @@
 #define REGCACHE_H
 
 #include "common/common-regcache.h"
+#include "common/function-view.h"
 #include <forward_list>
 
 struct regcache;
 struct regset;
 struct gdbarch;
 struct address_space;
+class thread_info;
 
 extern struct regcache *get_current_regcache (void);
 extern struct regcache *get_thread_regcache (ptid_t ptid);
diff --git a/gdb/riscv-fbsd-tdep.c b/gdb/riscv-fbsd-tdep.c
index 3125a2285e1..a17d55b08b0 100644
--- a/gdb/riscv-fbsd-tdep.c
+++ b/gdb/riscv-fbsd-tdep.c
@@ -25,6 +25,7 @@
 #include "target.h"
 #include "trad-frame.h"
 #include "tramp-frame.h"
+#include "gdbarch.h"
 
 /* Register maps.  */
 
diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c
index 91061c5b3e9..adeb25441da 100644
--- a/gdb/riscv-linux-tdep.c
+++ b/gdb/riscv-linux-tdep.c
@@ -25,6 +25,7 @@
 #include "regset.h"
 #include "tramp-frame.h"
 #include "trad-frame.h"
+#include "gdbarch.h"
 
 /* Define the general register mapping.  The kernel puts the PC at offset 0,
    gdb puts it at offset 32.  Register x0 is always 0 and can be ignored.
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index 15932638397..63adc57c66f 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -41,6 +41,7 @@
 #include "common/selftest.h"
 #include "value.h"
 #include "common/vec.h"
+#include "gdbarch.h"
 
 #define GDB_YY_REMAP_PREFIX rust
 #include "yy-remap.h"
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index e2f13def9de..ecb90b2422b 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -43,6 +43,7 @@
 #include <algorithm>
 #include "inf-ptrace.h"
 #include "linux-tdep.h"
+#include "gdbarch.h"
 
 /* Per-thread arch-specific data.  */
 
diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
index 8aa60170a9c..a4684e65da7 100644
--- a/gdb/sh-linux-tdep.c
+++ b/gdb/sh-linux-tdep.c
@@ -29,6 +29,7 @@
 #include "glibc-tdep.h"
 #include "sh-tdep.h"
 #include "linux-tdep.h"
+#include "gdbarch.h"
 
 #define REGSx16(base) \
   {(base),      0}, \
diff --git a/gdb/sh-nbsd-tdep.c b/gdb/sh-nbsd-tdep.c
index 4ae989a3926..976b344965b 100644
--- a/gdb/sh-nbsd-tdep.c
+++ b/gdb/sh-nbsd-tdep.c
@@ -27,6 +27,7 @@
 
 #include "sh-tdep.h"
 #include "solib-svr4.h"
+#include "gdbarch.h"
 
 /* Convert a register number into an offset into a ptrace
    register structure.  */
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index d2fb4b81b71..42197a44a81 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -21,6 +21,7 @@
 #include "common/scoped_fd.h"
 #include "source.h"
 #include "cli/cli-style.h"
+#include "symtab.h"
 
 #ifdef HAVE_SOURCE_HIGHLIGHT
 /* If Gnulib redirects 'open' and 'close' to its replacements
diff --git a/gdb/sparc-nbsd-tdep.c b/gdb/sparc-nbsd-tdep.c
index 486d9abadc1..3f71d964591 100644
--- a/gdb/sparc-nbsd-tdep.c
+++ b/gdb/sparc-nbsd-tdep.c
@@ -29,6 +29,7 @@
 #include "solib-svr4.h"
 #include "symtab.h"
 #include "trad-frame.h"
+#include "gdbarch.h"
 
 #include "sparc-tdep.h"
 #include "nbsd-tdep.h"
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index 6149db9419b..3a8930a9efe 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -30,6 +30,7 @@
 #include "sparc-tdep.h"
 #include "solib-svr4.h"
 #include "bsd-uthread.h"
+#include "gdbarch.h"
 
 /* Signal trampolines.  */
 
diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c
index c619f6e3c10..ca885b42420 100644
--- a/gdb/sparc-ravenscar-thread.c
+++ b/gdb/sparc-ravenscar-thread.c
@@ -24,6 +24,7 @@
 #include "inferior.h"
 #include "ravenscar-thread.h"
 #include "sparc-ravenscar-thread.h"
+#include "gdbarch.h"
 
 struct sparc_ravenscar_ops : public ravenscar_arch_ops
 {
diff --git a/gdb/sparc64-fbsd-tdep.c b/gdb/sparc64-fbsd-tdep.c
index 4016006bd35..4989772f118 100644
--- a/gdb/sparc64-fbsd-tdep.c
+++ b/gdb/sparc64-fbsd-tdep.c
@@ -30,6 +30,7 @@
 #include "sparc64-tdep.h"
 #include "fbsd-tdep.h"
 #include "solib-svr4.h"
+#include "gdbarch.h"
 
 /* From <machine/reg.h>.  */
 const struct sparc_gregmap sparc64fbsd_gregmap =
diff --git a/gdb/std-regs.c b/gdb/std-regs.c
index 26e6d0bf419..8dc94f80120 100644
--- a/gdb/std-regs.c
+++ b/gdb/std-regs.c
@@ -24,6 +24,8 @@
 #include "frame.h"
 #include "gdbtypes.h"
 #include "value.h"
+#include "gdbarch.h"
+
 static struct value *
 value_of_builtin_frame_fp_reg (struct frame_info *frame, const void *baton)
 {
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index fe07d425a5f..a7dddd7aa54 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -22,6 +22,7 @@
 #ifndef TARGET_DESCRIPTIONS_H
 #define TARGET_DESCRIPTIONS_H 1
 #include "common/tdesc.h"
+#include "gdbarch.h"
 
 struct tdesc_arch_data;
 struct target_ops;
diff --git a/gdb/target-float.c b/gdb/target-float.c
index 68c55f4dc7d..39abb126965 100644
--- a/gdb/target-float.c
+++ b/gdb/target-float.c
@@ -21,7 +21,7 @@
 #include "gdbtypes.h"
 #include "floatformat.h"
 #include "target-float.h"
-
+#include "gdbarch.h"
 
 /* Target floating-point operations.
 
diff --git a/gdb/tic6x-linux-tdep.c b/gdb/tic6x-linux-tdep.c
index 2b8bc93fd1d..ca3395763b5 100644
--- a/gdb/tic6x-linux-tdep.c
+++ b/gdb/tic6x-linux-tdep.c
@@ -26,6 +26,7 @@
 #include "tramp-frame.h"
 #include "elf-bfd.h"
 #include "elf/tic6x.h"
+#include "gdbarch.h"
 
 /* The offset from rt_sigframe pointer to SP register.  */
 #define TIC6X_SP_RT_SIGFRAME 8
diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
index 5f02199da29..23454860bb6 100644
--- a/gdb/tilegx-linux-tdep.c
+++ b/gdb/tilegx-linux-tdep.c
@@ -28,6 +28,7 @@
 #include "tramp-frame.h"
 #include "trad-frame.h"
 #include "tilegx-tdep.h"
+#include "gdbarch.h"
 
 /* Signal trampoline support.  */
 
diff --git a/gdb/top.c b/gdb/top.c
index 857207c3767..6725ffa6467 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -53,6 +53,7 @@
 #include "common/buffer.h"
 #include "gdb_select.h"
 #include "common/scope-exit.h"
+#include "gdbarch.h"
 
 /* readline include files.  */
 #include "readline/readline.h"
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index bf886e06521..be37a1d6a81 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -23,6 +23,7 @@
 #include "exec.h"
 #include "regcache.h"
 #include "common/byte-vector.h"
+#include "gdbarch.h"
 
 /* Helper macros.  */
 
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index d9114753c5e..a33fa89e335 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -24,6 +24,7 @@
 #include "frame-unwind.h"
 #include "target.h"
 #include "value.h"
+#include "gdbarch.h"
 
 struct trad_frame_cache
 {
diff --git a/gdb/type-stack.h b/gdb/type-stack.h
index 762afde0bf7..dce032343b3 100644
--- a/gdb/type-stack.h
+++ b/gdb/type-stack.h
@@ -20,6 +20,7 @@
 #ifndef TYPE_STACK_H
 #define TYPE_STACK_H
 
+#include "gdbtypes.h"
 #include <vector>
 
 struct type;
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index e61fb064ea0..6c3f6e6646f 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -18,6 +18,7 @@
 
 #include "defs.h"
 #include "ui-style.h"
+#include "gdb_regex.h"
 
 /* A regular expression that is used for matching ANSI terminal escape
    sequences.  */
diff --git a/gdb/utils.c b/gdb/utils.c
index f55661287eb..3ea2acfbdfe 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -73,6 +73,7 @@
 #include "common/pathstuff.h"
 #include "cli/cli-style.h"
 #include "common/scope-exit.h"
+#include "gdbarch.h"
 
 void (*deprecated_error_begin_hook) (void);
 
diff --git a/gdb/utils.h b/gdb/utils.h
index 58b4a283447..7acb023b13f 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -25,6 +25,9 @@
 #include "common/scoped_restore.h"
 #include <chrono>
 
+struct completion_match_for_lcd;
+class compiled_regex;
+
 extern void initialize_utils (void);
 
 /* String utilities.  */
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 8d310b504a2..b1caf688d7b 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -27,6 +27,7 @@
 #include "target-float.h"
 #include "infcall.h"
 #include "common/byte-vector.h"
+#include "gdbarch.h"
 
 /* Define whether or not the C operator '/' truncates towards zero for
    differently signed operands (truncation direction is undefined in C).  */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6f9b47da80c..58eea8d8536 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -37,6 +37,7 @@
 #include <algorithm>
 #include "common/byte-vector.h"
 #include "cli/cli-option.h"
+#include "gdbarch.h"
 
 /* Maximum number of wchars returned from wchar_iterate.  */
 #define MAX_WCHARS 4
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 8ec8298a12c..aa061018b6f 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -31,6 +31,7 @@
 #include "inferior.h"
 #include "varobj-iter.h"
 #include "parser-defs.h"
+#include "gdbarch.h"
 
 #if HAVE_PYTHON
 #include "python/python.h"
diff --git a/gdb/x86-tdep.c b/gdb/x86-tdep.c
index 96a70d73158..41b209ef546 100644
--- a/gdb/x86-tdep.c
+++ b/gdb/x86-tdep.c
@@ -19,6 +19,7 @@
 
 #include "defs.h"
 #include "x86-tdep.h"
+#include "symtab.h"
 
 
 /* Check whether NAME is included in NAMES[LO] (inclusive) to NAMES[HI]
diff --git a/gdb/xml-support.h b/gdb/xml-support.h
index c5cf617050a..0a9c720be6e 100644
--- a/gdb/xml-support.h
+++ b/gdb/xml-support.h
@@ -25,6 +25,7 @@
 #include "common/vec.h"
 #include "common/xml-utils.h"
 #include "common/byte-vector.h"
+#include "common/gdb_optional.h"
 
 struct gdb_xml_parser;
 struct gdb_xml_element;
diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
index 796143c6699..be1fba97c72 100644
--- a/gdb/xtensa-linux-tdep.c
+++ b/gdb/xtensa-linux-tdep.c
@@ -23,6 +23,7 @@
 #include "linux-tdep.h"
 #include "solib-svr4.h"
 #include "symtab.h"
+#include "gdbarch.h"
 
 /* This enum represents the signals' numbers on the Xtensa
    architecture.  It just contains the signal definitions which are
--
2.17.2

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Don't include gdbarch.h from defs.h

Tom Tromey-2
>>>>> "Tom" == Tom Tromey <[hidden email]> writes:

Tom> I touched symtab.h and was surprised to see how many files were
Tom> rebuilt.  I looked into it a bit, and found that defs.h includes
Tom> gdbarch.h, which in turn includes many things.

Tom> gdbarch.h is only needed by a minority ofthe files in gdb, so this
Tom> patch removes the include from defs.h and updates the fallout.

I've updated this patch, and I'm running it through the buildbot again.
If that goes ok, barring any objections I plan to check it in.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Don't include gdbarch.h from defs.h

Simon Marchi
In reply to this post by Tom Tromey-2
On 2019-06-14 17:10, Tom Tromey wrote:

> I touched symtab.h and was surprised to see how many files were
> rebuilt.  I looked into it a bit, and found that defs.h includes
> gdbarch.h, which in turn includes many things.
>
> gdbarch.h is only needed by a minority ofthe files in gdb, so this
> patch removes the include from defs.h and updates the fallout.
>
> I did "wc -l" on the files in build/gdb/.deps; this patch reduces the
> line count from 139935 to 137030; so there are definitely future
> build-time savings here.
>
> Note that while I configured with --enable-targets=all, it's possible
> that some *-nat.c file needs an update.  I could not test all of
> these.  The buildbot caught a few problems along these lines.

Thanks, I think this makes sense.

Simon
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Don't include gdbarch.h from defs.h

Tom Tromey-2
>>>>> "Simon" == Simon Marchi <[hidden email]> writes:

Simon> On 2019-06-14 17:10, Tom Tromey wrote:

>> I touched symtab.h and was surprised to see how many files were
>> rebuilt.  I looked into it a bit, and found that defs.h includes
>> gdbarch.h, which in turn includes many things.
>>
>> gdbarch.h is only needed by a minority ofthe files in gdb, so this
>> patch removes the include from defs.h and updates the fallout.
>>
>> I did "wc -l" on the files in build/gdb/.deps; this patch reduces the
>> line count from 139935 to 137030; so there are definitely future
>> build-time savings here.
>>
>> Note that while I configured with --enable-targets=all, it's possible
>> that some *-nat.c file needs an update.  I could not test all of
>> these.  The buildbot caught a few problems along these lines.

Simon> Thanks, I think this makes sense.

Thanks.

The results came back looking good.  It is possible that there could
still be a build failure in some untested *-nat.c file.  However, these
are easily fixed, normally by including gdbarch.h explicitly.

So, I'm checking it in now.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Don't include gdbarch.h from defs.h

Andreas Schwab
In reply to this post by Tom Tromey-2
In file included from ../../gdb/ia64-tdep.h:25:0,
                 from ../../gdb/ia64-linux-tdep.c:21:
../../gdb/ia64-libunwind-tdep.h:74:11: error: ‘readable_regcache’ has not been declared
           readable_regcache *regcache,
           ^
../../gdb/ia64-linux-nat.c: In function ‘CORE_ADDR ia64_register_addr(gdbarch*, int)’:
../../gdb/ia64-linux-nat.c:350:54: error: ‘gdbarch_num_regs’ was not declared in this scope
   if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
                                                      ^
../../gdb/ia64-linux-nat.c: In function ‘int ia64_cannot_fetch_register(gdbarch*, int)’:
../../gdb/ia64-linux-nat.c:365:40: error: ‘gdbarch_num_regs’ was not declared in this scope
   || regno >= gdbarch_num_regs (gdbarch)
                                        ^
../../gdb/ia64-linux-nat.c: In function ‘int ia64_cannot_store_register(gdbarch*, int)’:
../../gdb/ia64-linux-nat.c:402:40: error: ‘gdbarch_num_regs’ was not declared in this scope
   || regno >= gdbarch_num_regs (gdbarch)
                                        ^
../../gdb/ia64-linux-nat.c: In function ‘void ia64_linux_fetch_register(regcache*, int)’:
../../gdb/ia64-linux-nat.c:793:47: error: ‘gdbarch_register_name’ was not declared in this scope
         gdbarch_register_name (gdbarch, regnum),
                                               ^
../../gdb/ia64-linux-nat.c: In member function ‘virtual void ia64_linux_nat_target::fetch_registers(regcache*, int)’:
../../gdb/ia64-linux-nat.c:809:47: error: ‘gdbarch_num_regs’ was not declared in this scope
   regnum < gdbarch_num_regs (regcache->arch ());
                                               ^
../../gdb/ia64-linux-nat.c: In function ‘void ia64_linux_store_register(const regcache*, int)’:
../../gdb/ia64-linux-nat.c:848:47: error: ‘gdbarch_register_name’ was not declared in this scope
         gdbarch_register_name (gdbarch, regnum),
                                               ^
../../gdb/ia64-linux-nat.c: In member function ‘virtual void ia64_linux_nat_target::store_registers(regcache*, int)’:
../../gdb/ia64-linux-nat.c:863:47: error: ‘gdbarch_num_regs’ was not declared in this scope
   regnum < gdbarch_num_regs (regcache->arch ());
                                               ^

Andreas.

--
Andreas Schwab, SUSE Labs, [hidden email]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Don't include gdbarch.h from defs.h

Tom Tromey-2
>>>>> "Andreas" == Andreas Schwab <[hidden email]> writes:

Andreas> In file included from ../../gdb/ia64-tdep.h:25:0,
Andreas>                  from ../../gdb/ia64-linux-tdep.c:21:
Andreas> ../../gdb/ia64-libunwind-tdep.h:74:11: error: ‘readable_regcache’ has not been declared
Andreas>            readable_regcache *regcache,

I don't have libunwind-ia64.h, so I couldn't reproduce this locally.

Anyway, please try the appended.  Maybe it will work.

thanks,
Tom

diff --git a/gdb/ia64-libunwind-tdep.h b/gdb/ia64-libunwind-tdep.h
index 3ad3d44f367..06a8d5463d7 100644
--- a/gdb/ia64-libunwind-tdep.h
+++ b/gdb/ia64-libunwind-tdep.h
@@ -36,6 +36,8 @@ struct frame_unwind;
    running on.  */
 #include "libunwind-ia64.h"
 
+#include "gdbarch.h"
+
 struct libunwind_descr
 {
   int (*gdb2uw) (int);
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Don't include gdbarch.h from defs.h

Andreas Schwab
On Jul 31 2019, Tom Tromey <[hidden email]> wrote:

>>>>>> "Andreas" == Andreas Schwab <[hidden email]> writes:
>
> Andreas> In file included from ../../gdb/ia64-tdep.h:25:0,
> Andreas>                  from ../../gdb/ia64-linux-tdep.c:21:
> Andreas> ../../gdb/ia64-libunwind-tdep.h:74:11: error: ‘readable_regcache’ has not been declared
> Andreas>            readable_regcache *regcache,
>
> I don't have libunwind-ia64.h, so I couldn't reproduce this locally.
>
> Anyway, please try the appended.  Maybe it will work.

This fixes the errors.

Andreas.

--
Andreas Schwab, SUSE Labs, [hidden email]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."