From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 42D1E3858C52 for ; Mon, 4 Apr 2022 22:20:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 42D1E3858C52 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-398-WADaqHkuN8-RdQO12jZ_lg-1; Mon, 04 Apr 2022 18:20:06 -0400 X-MC-Unique: WADaqHkuN8-RdQO12jZ_lg-1 Received: by mail-wr1-f70.google.com with SMTP id h33-20020adf9024000000b00203fcba8aadso2088985wrh.15 for ; Mon, 04 Apr 2022 15:20:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h9r0+CZOc0TOn+Q0nt+Z+wWOa3gGjw0qRzZ7b501PQE=; b=GvKgeuJeTUZAHIIv5svDbKKaidOb4opyTQ+PehPp7Ew+xLROwQh46QYTjrAMDIWOy1 A2XSAmSK7LplcVoqUfziND0TiQB8a786YKn+9/qbGQ8DwyL19LAAaKgXFje+ovQzjai4 7MVIXuKp9aMbVmkzeJa+v7SXZnTqDMVMy/icTZfu9+Wy1VecSwyogOy54U6NeJw/WthU XMo8K/McDzjXEZw3p0XRmh/MjlLlFDlv/LorZ42pd40qw/YbJ3lBytCpmHW3lhHSSBbB WLLv6hJJOyHnOZgcwjOmOD4v52ehx7GfD3p+t73foIBOQTwSGqAjVxCAlFRrPTFmxIcx 3neQ== X-Gm-Message-State: AOAM531vCvHl3wCi9BtZjy5l2VvLtRlEs2pVH2pIMvi1WYTCq+Hx/eEm QoyrYFIoPd48NjU/acwokMbL4h7+7IXfygZENGTsodISjx75LzW3pmCdV0vYbSWa2TQd6z92Twj JHF7bUtp0LJyRuUCHI0PG7nQBH5+RnGY0VGzkGtqq+sh4YYcPravCiur9tqtXhfqRuAFtSQhUJQ == X-Received: by 2002:a05:600c:1d8e:b0:389:d079:cc0 with SMTP id p14-20020a05600c1d8e00b00389d0790cc0mr196574wms.98.1649110804413; Mon, 04 Apr 2022 15:20:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7wmIGiO1hfp3e0dmZbIe0xJ3U+HkOghzX+a78OIAhM/9cIJN0oy6LQ0A1Jaj9jeMAScyojw== X-Received: by 2002:a05:600c:1d8e:b0:389:d079:cc0 with SMTP id p14-20020a05600c1d8e00b00389d0790cc0mr196552wms.98.1649110804119; Mon, 04 Apr 2022 15:20:04 -0700 (PDT) Received: from localhost (host86-169-131-113.range86-169.btcentralplus.com. [86.169.131.113]) by smtp.gmail.com with ESMTPSA id o4-20020a5d6484000000b002057ad822d4sm10793269wri.48.2022.04.04.15.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 15:20:03 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 1/6] gdb: move gdb_disassembly_flag into a new disasm-flags.h file Date: Mon, 4 Apr 2022 23:19:54 +0100 Message-Id: <0ea56c5ecbca357d715457bd08c62d671b4ac4b7.1649110564.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2022 22:20:10 -0000 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 was 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 need to include disasm.h is much reduced. Now, after changing disasm.h, GDB rebuilds much quicker. There should be no user visible changes after this commit. --- 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(-) create mode 100644 gdb/disasm-flags.h 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 = \ 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" /* 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 = (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 */ + 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 #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; 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" /* 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" #include "gdbsupport/break-common.h" /* For enum target_hw_bp_type. */ -- 2.25.4