From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 57A01385DC22 for ; Tue, 31 Mar 2020 17:12:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57A01385DC22 IronPort-SDR: 6NFkehPG2rJ2IfGkwdfqvRHCitMJged3Zd3f88dKaW0pc57G0U5qy50eS5swd/ywJeNGq2rsjD g4CBKLRddAuA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 10:12:18 -0700 IronPort-SDR: 9mGs5MBs6gNrKx3RdY6Bd3cLU9k2qo61sUNLi8TCMih2hUPS6PUtNbkIGEWc7hUqiKdb70uNVL GDUte2gd0H6A== X-IronPort-AV: E=Sophos;i="5.72,328,1580803200"; d="scan'208";a="241971153" Received: from labpc7920x-08.iul.intel.com (HELO localhost) ([172.28.49.151]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 10:12:17 -0700 From: Mihails Strasuns To: gdb-patches@sourceware.org Subject: [PATCH v3 3/9] [gdb/testsuite] share jit-protocol.h by all jit tests Date: Tue, 31 Mar 2020 19:13:50 +0200 Message-Id: <20200331171356.26126-3-mihails.strasuns@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200331171356.26126-1-mihails.strasuns@intel.com> References: <166773> <20200331171356.26126-1-mihails.strasuns@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-25.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, 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: Tue, 31 Mar 2020 17:12:21 -0000 There was an existing jit-protocol.h defining common symbols needed for JIT-supporting application, however, it was only used by few tests. Others redeclared the same symbols. This unifies all tests to use jit-protocol.h gdb/testsuite/ChangeLog: 2020-02-18 Mihails Strasuns * gdb.base/jit-attach-pie.c: use jit-protocol.h * gdb.base/jit-elf-main.c: use jit-protocol.h * gdb.base/jit-reader-host.c: use jit-protocol.h * gdb.base/jit-reader-simple-jit.c: use jit-protocol.h * gdb.base/jit-protocol.h: update definitions to match all usage contexts Change-Id: I0dbfa7b7dcda0ba7b5f09a2d7530dd6dce88fa1e Signed-off-by: Mihails Strasuns --- gdb/testsuite/gdb.base/jit-attach-pie.c | 24 +----------- gdb/testsuite/gdb.base/jit-elf-main.c | 38 ++----------------- gdb/testsuite/gdb.base/jit-protocol.h | 8 +++- gdb/testsuite/gdb.base/jit-reader-host.c | 3 -- .../gdb.base/jit-reader-simple-jit.c | 25 +----------- 5 files changed, 13 insertions(+), 85 deletions(-) diff --git a/gdb/testsuite/gdb.base/jit-attach-pie.c b/gdb/testsuite/gdb.base/jit-attach-pie.c index 55a03f73ae..fd08233521 100644 --- a/gdb/testsuite/gdb.base/jit-attach-pie.c +++ b/gdb/testsuite/gdb.base/jit-attach-pie.c @@ -19,29 +19,7 @@ #include #include -struct jit_code_entry -{ - struct jit_code_entry *next_entry; - struct jit_code_entry *prev_entry; - const char *symfile_addr; - uint64_t symfile_size; -}; - -struct jit_descriptor -{ - uint32_t version; - /* This type should be jit_actions_t, but we use uint32_t - to be explicit about the bitwidth. */ - uint32_t action_flag; - struct jit_code_entry *relevant_entry; - struct jit_code_entry *first_entry; -}; - -struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 }; - -void __jit_debug_register_code() -{ -} +#include "jit-protocol.h" static void * thread_proc (void *arg) diff --git a/gdb/testsuite/gdb.base/jit-elf-main.c b/gdb/testsuite/gdb.base/jit-elf-main.c index 40958ef5b5..fe0f540d6f 100644 --- a/gdb/testsuite/gdb.base/jit-elf-main.c +++ b/gdb/testsuite/gdb.base/jit-elf-main.c @@ -29,6 +29,8 @@ #include #include +#include "jit-protocol.h" + /* ElfW is coming from linux. On other platforms it does not exist. Let us define it here. */ #ifndef ElfW @@ -42,38 +44,6 @@ #define _ElfW_1(e,w,t) e##w##t #endif /* !ElfW */ -typedef enum -{ - JIT_NOACTION = 0, - JIT_REGISTER_FN, - JIT_UNREGISTER_FN -} jit_actions_t; - -struct jit_code_entry -{ - struct jit_code_entry *next_entry; - struct jit_code_entry *prev_entry; - const char *symfile_addr; - uint64_t symfile_size; -}; - -struct jit_descriptor -{ - uint32_t version; - /* This type should be jit_actions_t, but we use uint32_t - to be explicit about the bitwidth. */ - uint32_t action_flag; - struct jit_code_entry *relevant_entry; - struct jit_code_entry *first_entry; -}; - -/* GDB puts a breakpoint in this function. */ -void __attribute__((noinline)) __jit_debug_register_code () { } - -/* Make sure to specify the version statically, because the - debugger may check the version before we can set it. */ -struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 }; - static void usage (const char *const argv0) { @@ -203,7 +173,7 @@ MAIN (int argc, char *argv[]) __jit_debug_descriptor.first_entry = entry; /* Notify GDB. */ - __jit_debug_descriptor.action_flag = JIT_REGISTER_FN; + __jit_debug_descriptor.action_flag = JIT_REGISTER; __jit_debug_register_code (); } @@ -225,7 +195,7 @@ MAIN (int argc, char *argv[]) __jit_debug_descriptor.first_entry = NULL; /* Notify GDB. */ - __jit_debug_descriptor.action_flag = JIT_UNREGISTER_FN; + __jit_debug_descriptor.action_flag = JIT_UNREGISTER; __jit_debug_register_code (); __jit_debug_descriptor.relevant_entry = prev_entry; diff --git a/gdb/testsuite/gdb.base/jit-protocol.h b/gdb/testsuite/gdb.base/jit-protocol.h index 458523e5ff..2b2e902fe7 100644 --- a/gdb/testsuite/gdb.base/jit-protocol.h +++ b/gdb/testsuite/gdb.base/jit-protocol.h @@ -38,7 +38,7 @@ struct jit_code_entry { struct jit_code_entry *next_entry; struct jit_code_entry *prev_entry; - void *symfile_addr; + const void *symfile_addr; uint64_t symfile_size; }; @@ -51,4 +51,10 @@ struct jit_descriptor struct jit_code_entry *first_entry; }; +struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 }; + +void __attribute__((noinline)) __jit_debug_register_code() +{ +} + #endif /* JIT_PROTOCOL_H */ diff --git a/gdb/testsuite/gdb.base/jit-reader-host.c b/gdb/testsuite/gdb.base/jit-reader-host.c index d07acd54bb..f9c4833083 100644 --- a/gdb/testsuite/gdb.base/jit-reader-host.c +++ b/gdb/testsuite/gdb.base/jit-reader-host.c @@ -26,9 +26,6 @@ #include "jit-reader-host.h" #include "jit-protocol.h" -void __attribute__((noinline)) __jit_debug_register_code () { } - -struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 }; struct jit_code_entry only_entry; typedef void (jit_function_stack_mangle_t) (void); diff --git a/gdb/testsuite/gdb.base/jit-reader-simple-jit.c b/gdb/testsuite/gdb.base/jit-reader-simple-jit.c index 407666b98b..f446bf2d96 100644 --- a/gdb/testsuite/gdb.base/jit-reader-simple-jit.c +++ b/gdb/testsuite/gdb.base/jit-reader-simple-jit.c @@ -19,32 +19,9 @@ #include -struct jit_code_entry -{ - struct jit_code_entry *next_entry; - struct jit_code_entry *prev_entry; - const char *symfile_addr; - uint64_t symfile_size; -}; - -struct jit_descriptor -{ - uint32_t version; - /* This type should be jit_actions_t, but we use uint32_t - to be explicit about the bitwidth. */ - uint32_t action_flag; - struct jit_code_entry *relevant_entry; - struct jit_code_entry *first_entry; -}; - #ifdef SPACER /* This exists to change the address of __jit_debug_descriptor. */ int spacer = 4; #endif -struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 }; - -void -__jit_debug_register_code (void) -{ -} +#include "jit-protocol.h" \ No newline at end of file -- 2.25.2 Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Gary Kershaw Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928