From patchwork Fri Jan 10 22:00:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 37297 Received: (qmail 41390 invoked by alias); 10 Jan 2020 22:09:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 41373 invoked by uid 89); 10 Jan 2020 22:09:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Jan 2020 22:09:32 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 97462696114 for ; Fri, 10 Jan 2020 17:00:40 -0500 (EST) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id dB2msp9aClUC; Fri, 10 Jan 2020 17:00:40 -0500 (EST) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 42B706960DD; Fri, 10 Jan 2020 17:00:37 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 42B706960DD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1578693637; bh=1RkpjKGBiC9Ok5k58rISCk2Xf32XV+W1sEt2ITIHWaM=; h=From:To:Date:Message-Id:MIME-Version; b=A7dpfnFaIc/xKsMXArBg4oz0Z8rbhzsVUxiaT5h2MFNgGPft/qltrydKKzaSmHTJr ma6B0y0+BRAhhwsx414xmrbHXbDrVA7jmMJ8DWHCzvnJO+ANbwbmNqJtFSw9XR6qde pwVp+TU4RNl2nOPPXBsZbUOq0UPVVKcFjwUlWQeWgkvX347lRmFZRJdylAyTd4RzpM 8cinwk1oGePus6Zw9Wr23AtCkoi5BRdpKZiT+NEj35pn3H9rVKSewwMfky1d5GdBBD xEfZJNyedsw/pmIckO3Nnwap1YlJeJNAY4jnNahRSgSxzPXwDFQccfGbcKHAb1Fai+ SCz2BQ9nUPw+A== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id i23DxMrw-edf; Fri, 10 Jan 2020 17:00:37 -0500 (EST) Received: from smarchi-efficios.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by mail.efficios.com (Postfix) with ESMTPSA id DD8906960AD; Fri, 10 Jan 2020 17:00:35 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 6/7] gdbserver: set IP_AGENT_EXPORT_FUNC to static when not building IPA, add declarations Date: Fri, 10 Jan 2020 17:00:26 -0500 Message-Id: <20200110220027.26450-7-simon.marchi@efficios.com> In-Reply-To: <20200110220027.26450-1-simon.marchi@efficios.com> References: <20200110220027.26450-1-simon.marchi@efficios.com> MIME-Version: 1.0 Fixing the -Wmissing-declarations errors in gdbserver's tracepoint.c is a bit tricky, because some functions are compiled for both gdbserver, in which case they should be static, since they are only used in that file, and for libinproctrace.so, in which case they should be externally visible, since they need to be looked up. In the case where they are externally visible, -Wmissing-declarations requires that a declaration exists (that's the point of the warning). I've reused the IP_AGENT_EXPORT_FUNC macro to mark the functions as static when compiled for gdbserver. Some seemingly unnecessary declarations are added for when compiling libinproctrace.so (thanks to Tom for the suggestion). gdb/gdbserver/ChangeLog: * tracepoint.h (IP_AGENT_EXPORT_FUNC) [!IN_PROCESS_AGENT]: Define to static. * tracepoint.c (stop_tracing, flush_trace_buffer, about_to_request_buffer_space, get_trace_state_variable_value, set_trace_state_variable_value, gdb_collect): Add declaration. Change-Id: If9c66151bd00c3b9c5caa27a7c21c5a3a952de2a --- gdb/gdbserver/tracepoint.c | 20 ++++++++++++++++++++ gdb/gdbserver/tracepoint.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 2ef94e6998d1..bbca48b2efd3 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -370,6 +370,9 @@ read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) # define UNKNOWN_SIDE_EFFECTS() do {} while (0) #endif +/* This is needed for -Wmissing-declarations. */ +IP_AGENT_EXPORT_FUNC void stop_tracing (void); + IP_AGENT_EXPORT_FUNC void stop_tracing (void) { @@ -377,6 +380,9 @@ stop_tracing (void) UNKNOWN_SIDE_EFFECTS(); } +/* This is needed for -Wmissing-declarations. */ +IP_AGENT_EXPORT_FUNC void flush_trace_buffer (void); + IP_AGENT_EXPORT_FUNC void flush_trace_buffer (void) { @@ -1496,6 +1502,9 @@ init_trace_buffer (LONGEST bufsize) #ifdef IN_PROCESS_AGENT +/* This is needed for -Wmissing-declarations. */ +IP_AGENT_EXPORT_FUNC void about_to_request_buffer_space (void); + IP_AGENT_EXPORT_FUNC void about_to_request_buffer_space (void) { @@ -2091,6 +2100,9 @@ create_trace_state_variable (int num, int gdb) return tsv; } +/* This is needed for -Wmissing-declarations. */ +IP_AGENT_EXPORT_FUNC LONGEST get_trace_state_variable_value (int num); + IP_AGENT_EXPORT_FUNC LONGEST get_trace_state_variable_value (int num) { @@ -2117,6 +2129,10 @@ get_trace_state_variable_value (int num) return tsv->value; } +/* This is needed for -Wmissing-declarations. */ +IP_AGENT_EXPORT_FUNC void set_trace_state_variable_value (int num, + LONGEST val); + IP_AGENT_EXPORT_FUNC void set_trace_state_variable_value (int num, LONGEST val) { @@ -5786,6 +5802,10 @@ EXTERN_C_PUSH IP_AGENT_EXPORT_VAR collecting_t *collecting; EXTERN_C_POP +/* This is needed for -Wmissing-declarations. */ +IP_AGENT_EXPORT_FUNC void gdb_collect (struct tracepoint *tpoint, + unsigned char *regs); + /* This routine, called from the jump pad (in asm) is designed to be called from the jump pads of fast tracepoints, thus it is on the critical path. */ diff --git a/gdb/gdbserver/tracepoint.h b/gdb/gdbserver/tracepoint.h index a56e8bf5131e..030b2a923445 100644 --- a/gdb/gdbserver/tracepoint.h +++ b/gdb/gdbserver/tracepoint.h @@ -62,7 +62,7 @@ void initialize_tracepoint (void); # define IP_AGENT_EXPORT_VAR EXPORTED_SYMBOL ATTR_USED # define IP_AGENT_EXPORT_VAR_DECL EXTERN_C EXPORTED_SYMBOL #else -# define IP_AGENT_EXPORT_FUNC +# define IP_AGENT_EXPORT_FUNC static # define IP_AGENT_EXPORT_VAR # define IP_AGENT_EXPORT_VAR_DECL extern #endif