aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-01-13 14:05:32 -0500
committerSimon Marchi <simon.marchi@efficios.com>2020-01-13 14:05:32 -0500
commit6e37c371af4a25d28623b618e30f93b040b4d4ae (patch)
tree13b5d5b60eadbbeeb69fb9b7c5dbda6791a2d80d
parentdf4a0200dc896abe32bef4172ca047465caaedfe (diff)
downloadgdb-6e37c371af4a25d28623b618e30f93b040b4d4ae.zip
gdb-6e37c371af4a25d28623b618e30f93b040b4d4ae.tar.gz
gdb-6e37c371af4a25d28623b618e30f93b040b4d4ae.tar.bz2
gdbserver: set IP_AGENT_EXPORT_FUNC to static when not building IPA, add declarations
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
-rw-r--r--gdb/gdbserver/ChangeLog8
-rw-r--r--gdb/gdbserver/tracepoint.c20
-rw-r--r--gdb/gdbserver/tracepoint.h2
3 files changed, 29 insertions, 1 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 9842da5..233bc62 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,13 @@
2020-01-13 Simon Marchi <simon.marchi@efficios.com>
+ * 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.
+
+2020-01-13 Simon Marchi <simon.marchi@efficios.com>
+
* linux-x86-low.c (x86_linux_regs_info, amd64_emit_eq_goto,
amd64_emit_ne_goto, amd64_emit_lt_goto, amd64_emit_le_goto,
amd64_emit_gt_goto, amd64_emit_ge_goto, amd64_emit_ge_goto,
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 2ef94e6..bbca48b 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 a56e8bf..030b2a9 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