gdb: move gdb_disassembly_flag into a new disasm-flags.h file
authorAndrew Burgess <aburgess@redhat.com>
Mon, 4 Apr 2022 20:07:54 +0000 (21:07 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 6 Apr 2022 12:09:44 +0000 (13:09 +0100)
While working on the disassembler I was getting frustrated.  Every
time I touched disasm.h it seemed like every file in GDB would need to
be rebuilt.  Surely the disassembler can't be required by that many
parts of GDB, right?

Turns out that disasm.h is included in target.h, so pretty much every
file was being rebuilt!

The only thing from disasm.h that target.h needed is the
gdb_disassembly_flag enum, as this is part of the target_ops api.

In this commit I move gdb_disassembly_flag into its own file.  This is
then included in target.h and disasm.h, after which, the number of
files that depend on disasm.h is much reduced.

I also audited all the other includes of disasm.h and found that the
includes in mep-tdep.c and python/py-registers.c are no longer needed,
so I've removed these.

Now, after changing disasm.h, GDB rebuilds much quicker.

There should be no user visible changes after this commit.

gdb/Makefile.in
gdb/arc-linux-tdep.c
gdb/disasm-flags.h [new file with mode: 0644]
gdb/disasm.h
gdb/mep-tdep.c
gdb/python/py-registers.c
gdb/s12z-tdep.c
gdb/target.h

index a775b2f4d191146c95a68bc6748b6ec66f6b17cd..647f012ad4f10f74a675766eccdab5a885e6e73f 100644 (file)
@@ -1289,6 +1289,7 @@ HFILES_NO_SRCDIR = \
        defs.h \
        dicos-tdep.h \
        dictionary.h \
+       disasm-flags.h \
        disasm.h \
        dummy-frame.h \
        dwarf2/cu.h \
index e895b72ce7162324929e382971e4725e731b5be8..1744b7544cdc5cc682c8b78d3001c86b5468d459 100644 (file)
@@ -24,6 +24,7 @@
 #include "opcode/arc.h"
 #include "osabi.h"
 #include "solib-svr4.h"
+#include "disasm.h"
 
 /* ARC header files.  */
 #include "opcodes/arc-dis.h"
diff --git a/gdb/disasm-flags.h b/gdb/disasm-flags.h
new file mode 100644 (file)
index 0000000..025b689
--- /dev/null
@@ -0,0 +1,40 @@
+/* Disassemble flags for GDB.
+
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef DISASM_FLAGS_H
+#define DISASM_FLAGS_H
+
+#include "gdbsupport/enum-flags.h"
+
+/* Flags used to control how GDB's disassembler behaves.  */
+
+enum gdb_disassembly_flag
+  {
+    DISASSEMBLY_SOURCE_DEPRECATED = (0x1 << 0),
+    DISASSEMBLY_RAW_INSN = (0x1 << 1),
+    DISASSEMBLY_OMIT_FNAME = (0x1 << 2),
+    DISASSEMBLY_FILENAME = (0x1 << 3),
+    DISASSEMBLY_OMIT_PC = (0x1 << 4),
+    DISASSEMBLY_SOURCE = (0x1 << 5),
+    DISASSEMBLY_SPECULATIVE = (0x1 << 6),
+  };
+DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags);
+
+#endif /* DISASM_FLAGS_H */
+
index b71cd097a16864627958ccaa28c8f3b0bf96082f..7efab7db46c4f8b36db9871c07d628df6a95cdad 100644 (file)
 #define DISASM_H
 
 #include "dis-asm.h"
-#include "gdbsupport/enum-flags.h"
-
-enum gdb_disassembly_flag
-  {
-    DISASSEMBLY_SOURCE_DEPRECATED = (0x1 << 0),
-    DISASSEMBLY_RAW_INSN = (0x1 << 1),
-    DISASSEMBLY_OMIT_FNAME = (0x1 << 2),
-    DISASSEMBLY_FILENAME = (0x1 << 3),
-    DISASSEMBLY_OMIT_PC = (0x1 << 4),
-    DISASSEMBLY_SOURCE = (0x1 << 5),
-    DISASSEMBLY_SPECULATIVE = (0x1 << 6),
-  };
-DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags);
+#include "disasm-flags.h"
 
 struct gdbarch;
 struct ui_out;
index 696d9c63bce978f72107111d78a7495130a023f9..d16c68e6fb63cf450ed46a13c940cc341b051f27 100644 (file)
@@ -37,7 +37,6 @@
 #include "regcache.h"
 #include "remote.h"
 #include "sim-regno.h"
-#include "disasm.h"
 #include "trad-frame.h"
 #include "reggroups.h"
 #include "elf-bfd.h"
index eab88a30b3b7640483042a48d0ceec2ff081fbbe..975eb2ca72db48fc31590f8b7936707d42428d96 100644 (file)
@@ -20,7 +20,6 @@
 #include "defs.h"
 #include "gdbarch.h"
 #include "arch-utils.h"
-#include "disasm.h"
 #include "reggroups.h"
 #include "python-internal.h"
 #include "user-regs.h"
index bf6a71c7f7f908f3d1184e9804fe54aea6d85255..5394c1bbf5ea457acb999a08a66ebde0a5372fce 100644 (file)
@@ -32,6 +32,7 @@
 #include "remote.h"
 #include "opcodes/s12z-opc.h"
 #include "gdbarch.h"
+#include "disasm.h"
 
 /* Two of the registers included in S12Z_N_REGISTERS are
    the CCH and CCL "registers" which are just views into
index 4cc79df05b41e40713586b4b897bedcc9324a341..c9791e850acd9d0a5ffd76bbee085299ffa14916 100644 (file)
@@ -79,7 +79,7 @@ struct inferior;
 #include "btrace.h"
 #include "record.h"
 #include "command.h"
-#include "disasm.h"
+#include "disasm-flags.h"
 #include "tracepoint.h"
 
 #include "gdbsupport/break-common.h" /* For enum target_hw_bp_type.  */