From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id 775013870858 for ; Wed, 15 Jul 2020 08:17:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 775013870858 IronPort-SDR: t5WbbOpQd7mgvkhpJYFXDU1MZic6i6d4GXuS3milgsnroeHzbrC6ueAQEbqgleqgvIZVfrXxW1 V0FHm31ZdA9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="149097739" X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="149097739" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 01:17:33 -0700 IronPort-SDR: nmoy5SEi06NkGHq1+Uy9b4+PpIMN99wwcjWXlB0czsOEWltr4imOYIvcUbzJGaG3PxGAZP9/22 VNlROQB3KXFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="317990391" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 15 Jul 2020 01:17:32 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 06F8HVfS014151; Wed, 15 Jul 2020 09:17:31 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 06F8HVoN020097; Wed, 15 Jul 2020 10:17:31 +0200 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 06F8HV06020092; Wed, 15 Jul 2020 10:17:31 +0200 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH v3 9/9] gdb/jit: skip jit symbol lookup if already detected the symbols don't exist Date: Wed, 15 Jul 2020 10:16:37 +0200 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_STOCKGEN, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Wed, 15 Jul 2020 08:17:36 -0000 From: Simon Marchi To detect whether an objfile is a JITer, we lookup JIT interface symbols in the objfile. If an objfile does not have these symbols, we conclude that it is not a JITer. An objfile that does not have the symbols will never have them. Therefore, once we do a lookup and find out that the objfile does not have JIT symbols, just set a flag so that we can skip symbol lookup for that objfile the next time we reset JIT breakpoints. gdb/ChangeLog: 2020-07-14 Simon Marchi Tankut Baris Aktemur * objfiles.h (struct objfile) : New field. * jit.c (jit_breakpoint_re_set_internal): Use the `skip_jit_symbol_lookup` field. --- gdb/jit.c | 15 +++++++++++++-- gdb/objfiles.h | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gdb/jit.c b/gdb/jit.c index 1850e5b143e..63d21d28bc0 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -891,19 +891,30 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) { for (objfile *the_objfile : pspace->objfiles ()) { + if (the_objfile->skip_jit_symbol_lookup) + continue; + /* Lookup the registration symbol. If it is missing, then we assume we are not attached to a JIT. */ bound_minimal_symbol reg_symbol = lookup_minimal_symbol (jit_break_name, nullptr, the_objfile); if (reg_symbol.minsym == NULL || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0) - continue; + { + /* No need to repeat the lookup the next time. */ + the_objfile->skip_jit_symbol_lookup = true; + continue; + } bound_minimal_symbol desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL, the_objfile); if (desc_symbol.minsym == NULL || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0) - continue; + { + /* No need to repeat the lookup the next time. */ + the_objfile->skip_jit_symbol_lookup = true; + continue; + } jiter_objfile_data *objf_data = get_jiter_objfile_data (reg_symbol.objfile); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index e5828618dfe..371f6b6cb91 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -741,6 +741,12 @@ struct objfile /* JIT-related data for this objfile, if the objfile is JITed; that is, it was produced by a JITer. */ std::unique_ptr jited_data = nullptr; + + /* A flag that is set to true if the JIT interface symbols are not + found in this objfile, so that we can skip the symbol lookup the + next time. If an objfile does not have the symbols, it will + never have them. */ + bool skip_jit_symbol_lookup = false; }; /* A deleter for objfile. */ -- 2.17.1