From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH v2 6/7] gdbserver: set IP_AGENT_EXPORT_FUNC to static when not building IPA, add declarations
Date: Fri, 10 Jan 2020 22:09:00 -0000 [thread overview]
Message-ID: <20200110220027.26450-7-simon.marchi@efficios.com> (raw)
In-Reply-To: <20200110220027.26450-1-simon.marchi@efficios.com>
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
--
2.24.1
next prev parent reply other threads:[~2020-01-10 22:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 22:00 [PATCH v2 0/7] Enable -Wmissing-declarations diagnostic Simon Marchi
2020-01-10 22:00 ` [PATCH v2 7/7] " Simon Marchi
2020-01-11 3:33 ` Simon Marchi
2020-01-10 22:00 ` [PATCH v2 4/7] gdbserver: include gdbsupport/common-inferior.h in inferiors.c Simon Marchi
2020-01-10 22:00 ` [PATCH v2 3/7] gdbserver: include hostio.h in hostio-errno.c Simon Marchi
2020-01-10 22:00 ` [PATCH v2 2/7] gdb: add declaration to Python init function Simon Marchi
2020-01-10 22:01 ` [PATCH v2 1/7] gdb: add back declarations for _initialize functions Simon Marchi
2020-01-11 3:32 ` Simon Marchi
2020-01-10 22:09 ` Simon Marchi [this message]
2020-01-10 22:09 ` [PATCH v2 5/7] gdbserver: make some functions static in linux-x86-low.c Simon Marchi
2020-01-11 18:11 ` [PATCH v2 0/7] Enable -Wmissing-declarations diagnostic Tom Tromey
2020-01-11 17:29 ` Tom Tromey
2020-01-12 7:06 ` Simon Marchi
2020-01-13 19:19 ` Simon Marchi
2020-01-12 8:13 ` Joel Brobecker
2020-01-12 20:23 ` Simon Marchi
2020-01-13 17:42 ` Tom Tromey
2020-01-13 19:10 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200110220027.26450-7-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox