From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 434B83888816; Wed, 6 Apr 2022 12:17:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 434B83888816 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: move gdb_disassembly_flag into a new disasm-flags.h file X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: ca028a46d51374864e4a4aa2942dfa7d93b893ce X-Git-Newrev: c8154ce0d6942e5988076edd674036ff384ab433 Message-Id: <20220406121739.434B83888816@sourceware.org> Date: Wed, 6 Apr 2022 12:17:39 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2022 12:17:39 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc8154ce0d694= 2e5988076edd674036ff384ab433 commit c8154ce0d6942e5988076edd674036ff384ab433 Author: Andrew Burgess Date: Mon Apr 4 21:07:54 2022 +0100 gdb: move gdb_disassembly_flag into a new disasm-flags.h file =20 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? =20 Turns out that disasm.h is included in target.h, so pretty much every file was being rebuilt! =20 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. =20 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. =20 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. =20 Now, after changing disasm.h, GDB rebuilds much quicker. =20 There should be no user visible changes after this commit. Diff: --- gdb/Makefile.in | 1 + gdb/arc-linux-tdep.c | 1 + gdb/disasm-flags.h | 40 ++++++++++++++++++++++++++++++++++++++++ gdb/disasm.h | 14 +------------- gdb/mep-tdep.c | 1 - gdb/python/py-registers.c | 1 - gdb/s12z-tdep.c | 1 + gdb/target.h | 2 +- 8 files changed, 45 insertions(+), 16 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a775b2f4d19..647f012ad4f 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1289,6 +1289,7 @@ HFILES_NO_SRCDIR =3D \ defs.h \ dicos-tdep.h \ dictionary.h \ + disasm-flags.h \ disasm.h \ dummy-frame.h \ dwarf2/cu.h \ diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c index e895b72ce71..1744b7544cd 100644 --- a/gdb/arc-linux-tdep.c +++ b/gdb/arc-linux-tdep.c @@ -24,6 +24,7 @@ #include "opcode/arc.h" #include "osabi.h" #include "solib-svr4.h" +#include "disasm.h" =20 /* ARC header files. */ #include "opcodes/arc-dis.h" diff --git a/gdb/disasm-flags.h b/gdb/disasm-flags.h new file mode 100644 index 00000000000..025b6893941 --- /dev/null +++ b/gdb/disasm-flags.h @@ -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 . = */ + +#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 =3D (0x1 << 0), + DISASSEMBLY_RAW_INSN =3D (0x1 << 1), + DISASSEMBLY_OMIT_FNAME =3D (0x1 << 2), + DISASSEMBLY_FILENAME =3D (0x1 << 3), + DISASSEMBLY_OMIT_PC =3D (0x1 << 4), + DISASSEMBLY_SOURCE =3D (0x1 << 5), + DISASSEMBLY_SPECULATIVE =3D (0x1 << 6), + }; +DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags); + +#endif /* DISASM_FLAGS_H */ + diff --git a/gdb/disasm.h b/gdb/disasm.h index b71cd097a16..7efab7db46c 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -20,19 +20,7 @@ #define DISASM_H =20 #include "dis-asm.h" -#include "gdbsupport/enum-flags.h" - -enum gdb_disassembly_flag - { - DISASSEMBLY_SOURCE_DEPRECATED =3D (0x1 << 0), - DISASSEMBLY_RAW_INSN =3D (0x1 << 1), - DISASSEMBLY_OMIT_FNAME =3D (0x1 << 2), - DISASSEMBLY_FILENAME =3D (0x1 << 3), - DISASSEMBLY_OMIT_PC =3D (0x1 << 4), - DISASSEMBLY_SOURCE =3D (0x1 << 5), - DISASSEMBLY_SPECULATIVE =3D (0x1 << 6), - }; -DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags); +#include "disasm-flags.h" =20 struct gdbarch; struct ui_out; diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 696d9c63bce..d16c68e6fb6 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -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" diff --git a/gdb/python/py-registers.c b/gdb/python/py-registers.c index eab88a30b3b..975eb2ca72d 100644 --- a/gdb/python/py-registers.c +++ b/gdb/python/py-registers.c @@ -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" diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c index bf6a71c7f7f..5394c1bbf5e 100644 --- a/gdb/s12z-tdep.c +++ b/gdb/s12z-tdep.c @@ -32,6 +32,7 @@ #include "remote.h" #include "opcodes/s12z-opc.h" #include "gdbarch.h" +#include "disasm.h" =20 /* Two of the registers included in S12Z_N_REGISTERS are the CCH and CCL "registers" which are just views into diff --git a/gdb/target.h b/gdb/target.h index 4cc79df05b4..c9791e850ac 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -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" =20 #include "gdbsupport/break-common.h" /* For enum target_hw_bp_type. */