This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 4/9] [gdbserver] Split a new tracepoint.h file out of server.h.
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 3 Sep 2013 21:26:34 +0100
- Subject: [PATCH 4/9] [gdbserver] Split a new tracepoint.h file out of server.h.
- Authentication-results: sourceware.org; auth=none
- References: <1378239999-15533-1-git-send-email-palves at redhat dot com>
gdb/gdbserver/
2013-09-03 Pedro Alves <palves@redhat.com>
* ax.c, linux-low.c, linux-x86-low.c, server.c: Include
tracepoint.h.
* server.h (IPA_BUFSIZ, initialize_tracepoint, tracing)
(disconnected_tracing, tracepoint_look_up_symbols, stop_tracing
(handle_tracepoint_general_set, handle_tracepoint_query)
(tracepoint_finished_step, tracepoint_was_hit)
(release_while_stepping_state_list, current_traceframe)
(in_readonly_region, traceframe_read_mem)
(fetch_traceframe_registers, traceframe_read_sdata)
(traceframe_read_info, struct fast_tpoint_collect_status)
(fast_tracepoint_collecting, force_unlock_trace_buffer)
(handle_tracepoit_bkpts, initialize_low_tracepoint)
(supply_fast_tracepoint_registers)
(supply_static_tracepoint_registers, set_trampoline_buffer_space)
(ipa_tdesc, claim_trampoline_space)
(have_fast_tracepoint_trampoline_buffer, gdb_agent_about_to_close)
(agent_mem_read, agent_get_trace_state_variable_value)
(agent_set_trace_state_variable_value, agent_tsv_read)
(agent_mem_read_string, get_raw_reg_func_addr)
(get_get_tsv_func_addr, get_set_tsv_func_addr): Move to ...
* tracepoint.h: ... this new file.
---
gdb/gdbserver/ax.c | 1 +
gdb/gdbserver/linux-low.c | 1 +
gdb/gdbserver/linux-x86-low.c | 1 +
gdb/gdbserver/server.c | 1 +
gdb/gdbserver/server.h | 112 -----------------------------------
gdb/gdbserver/target.c | 1 +
gdb/gdbserver/tracepoint.c | 1 +
gdb/gdbserver/tracepoint.h | 132 ++++++++++++++++++++++++++++++++++++++++++
8 files changed, 138 insertions(+), 112 deletions(-)
create mode 100644 gdb/gdbserver/tracepoint.h
diff --git a/gdb/gdbserver/ax.c b/gdb/gdbserver/ax.c
index b6824a2..d4768e1 100644
--- a/gdb/gdbserver/ax.c
+++ b/gdb/gdbserver/ax.c
@@ -19,6 +19,7 @@
#include "server.h"
#include "ax.h"
#include "format.h"
+#include "tracepoint.h"
static void ax_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 7db1fc8..7c95058 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -45,6 +45,7 @@
#include <sys/vfs.h>
#include <sys/uio.h>
#include "filestuff.h"
+#include "tracepoint.h"
#ifndef ELFMAG0
/* Don't include <linux/elf.h> here. If it got included by gdb_proc_service.h
then ELFMAG0 will have been defined. If it didn't get included by
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 3a4f007..afb4ef7 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -31,6 +31,7 @@
#include "gdb_proc_service.h"
#include "agent.h"
#include "tdesc.h"
+#include "tracepoint.h"
#ifdef __x86_64__
/* Defined in auto-generated file amd64-linux.c. */
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index d450779..3c70288 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -29,6 +29,7 @@
#include "gdb_wait.h"
#include "btrace-common.h"
#include "filestuff.h"
+#include "tracepoint.h"
/* The thread set with an `Hc' packet. `Hc' is deprecated in favor of
`vCont'. Note the multi-process extensions made `vCont' a
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 45c2ae3..94feba7 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -288,109 +288,6 @@ extern void hostio_last_error_from_errno (char *own_buf);
as large as the largest register set supported by gdbserver. */
#define PBUFSIZ 16384
-/* Functions from tracepoint.c */
-
-/* Size for a small buffer to report problems from the in-process
- agent back to GDBserver. */
-#define IPA_BUFSIZ 100
-
-void initialize_tracepoint (void);
-
-extern int tracing;
-extern int disconnected_tracing;
-
-void tracepoint_look_up_symbols (void);
-
-void stop_tracing (void);
-
-int handle_tracepoint_general_set (char *own_buf);
-int handle_tracepoint_query (char *own_buf);
-
-int tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc);
-int tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc);
-
-void release_while_stepping_state_list (struct thread_info *tinfo);
-
-extern int current_traceframe;
-
-int in_readonly_region (CORE_ADDR addr, ULONGEST length);
-int traceframe_read_mem (int tfnum, CORE_ADDR addr,
- unsigned char *buf, ULONGEST length,
- ULONGEST *nbytes);
-int fetch_traceframe_registers (int tfnum,
- struct regcache *regcache,
- int regnum);
-
-int traceframe_read_sdata (int tfnum, ULONGEST offset,
- unsigned char *buf, ULONGEST length,
- ULONGEST *nbytes);
-
-int traceframe_read_info (int tfnum, struct buffer *buffer);
-
-/* If a thread is determined to be collecting a fast tracepoint, this
- structure holds the collect status. */
-
-struct fast_tpoint_collect_status
-{
- /* The tracepoint that is presently being collected. */
- int tpoint_num;
- CORE_ADDR tpoint_addr;
-
- /* The address range in the jump pad of where the original
- instruction the tracepoint jump was inserted was relocated
- to. */
- CORE_ADDR adjusted_insn_addr;
- CORE_ADDR adjusted_insn_addr_end;
-};
-
-int fast_tracepoint_collecting (CORE_ADDR thread_area,
- CORE_ADDR stop_pc,
- struct fast_tpoint_collect_status *status);
-void force_unlock_trace_buffer (void);
-
-int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
-
-#ifdef IN_PROCESS_AGENT
-void initialize_low_tracepoint (void);
-void supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *regs);
-void supply_static_tracepoint_registers (struct regcache *regcache,
- const unsigned char *regs,
- CORE_ADDR pc);
-void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
- char *errmsg);
-
-extern const struct target_desc *ipa_tdesc;
-
-#else
-void stop_tracing (void);
-
-int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline);
-int have_fast_tracepoint_trampoline_buffer (char *msgbuf);
-void gdb_agent_about_to_close (int pid);
-#endif
-
-struct traceframe;
-struct eval_agent_expr_context;
-
-/* Do memory copies for bytecodes. */
-/* Do the recording of memory blocks for actions and bytecodes. */
-
-int agent_mem_read (struct eval_agent_expr_context *ctx,
- unsigned char *to, CORE_ADDR from,
- ULONGEST len);
-
-LONGEST agent_get_trace_state_variable_value (int num);
-void agent_set_trace_state_variable_value (int num, LONGEST val);
-
-/* Record the value of a trace state variable. */
-
-int agent_tsv_read (struct eval_agent_expr_context *ctx, int n);
-int agent_mem_read_string (struct eval_agent_expr_context *ctx,
- unsigned char *to,
- CORE_ADDR from,
- ULONGEST len);
-
/* Bytecode compilation function vector. */
struct emit_ops
@@ -444,15 +341,6 @@ struct emit_ops
void (*emit_ge_goto) (int *offset_p, int *size_p);
};
-/* Returns the address of the get_raw_reg function in the IPA. */
-CORE_ADDR get_raw_reg_func_addr (void);
-/* Returns the address of the get_trace_state_variable_value
- function in the IPA. */
-CORE_ADDR get_get_tsv_func_addr (void);
-/* Returns the address of the set_trace_state_variable_value
- function in the IPA. */
-CORE_ADDR get_set_tsv_func_addr (void);
-
extern CORE_ADDR current_insn_ptr;
extern int emit_error;
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index a47053c..1a0dee2 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+#include "tracepoint.h"
struct target_ops *the_target;
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 1327845..3288a13 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+#include "tracepoint.h"
#include "gdbthread.h"
#include "agent.h"
diff --git a/gdb/gdbserver/tracepoint.h b/gdb/gdbserver/tracepoint.h
new file mode 100644
index 0000000..7759033
--- /dev/null
+++ b/gdb/gdbserver/tracepoint.h
@@ -0,0 +1,132 @@
+/* Tracepoint code for remote server for GDB.
+ Copyright (C) 1993-2013 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef TRACEPOINT_H
+#define TRACEPOINT_H
+
+/* Size for a small buffer to report problems from the in-process
+ agent back to GDBserver. */
+#define IPA_BUFSIZ 100
+
+void initialize_tracepoint (void);
+
+extern int tracing;
+extern int disconnected_tracing;
+
+void tracepoint_look_up_symbols (void);
+
+void stop_tracing (void);
+
+int handle_tracepoint_general_set (char *own_buf);
+int handle_tracepoint_query (char *own_buf);
+
+int tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc);
+int tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc);
+
+void release_while_stepping_state_list (struct thread_info *tinfo);
+
+extern int current_traceframe;
+
+int in_readonly_region (CORE_ADDR addr, ULONGEST length);
+int traceframe_read_mem (int tfnum, CORE_ADDR addr,
+ unsigned char *buf, ULONGEST length,
+ ULONGEST *nbytes);
+int fetch_traceframe_registers (int tfnum,
+ struct regcache *regcache,
+ int regnum);
+
+int traceframe_read_sdata (int tfnum, ULONGEST offset,
+ unsigned char *buf, ULONGEST length,
+ ULONGEST *nbytes);
+
+int traceframe_read_info (int tfnum, struct buffer *buffer);
+
+/* If a thread is determined to be collecting a fast tracepoint, this
+ structure holds the collect status. */
+
+struct fast_tpoint_collect_status
+{
+ /* The tracepoint that is presently being collected. */
+ int tpoint_num;
+ CORE_ADDR tpoint_addr;
+
+ /* The address range in the jump pad of where the original
+ instruction the tracepoint jump was inserted was relocated
+ to. */
+ CORE_ADDR adjusted_insn_addr;
+ CORE_ADDR adjusted_insn_addr_end;
+};
+
+int fast_tracepoint_collecting (CORE_ADDR thread_area,
+ CORE_ADDR stop_pc,
+ struct fast_tpoint_collect_status *status);
+void force_unlock_trace_buffer (void);
+
+int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
+
+#ifdef IN_PROCESS_AGENT
+void initialize_low_tracepoint (void);
+void supply_fast_tracepoint_registers (struct regcache *regcache,
+ const unsigned char *regs);
+void supply_static_tracepoint_registers (struct regcache *regcache,
+ const unsigned char *regs,
+ CORE_ADDR pc);
+void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
+ char *errmsg);
+
+extern const struct target_desc *ipa_tdesc;
+
+#else
+void stop_tracing (void);
+
+int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline);
+int have_fast_tracepoint_trampoline_buffer (char *msgbuf);
+void gdb_agent_about_to_close (int pid);
+#endif
+
+struct traceframe;
+struct eval_agent_expr_context;
+
+/* Do memory copies for bytecodes. */
+/* Do the recording of memory blocks for actions and bytecodes. */
+
+int agent_mem_read (struct eval_agent_expr_context *ctx,
+ unsigned char *to, CORE_ADDR from,
+ ULONGEST len);
+
+LONGEST agent_get_trace_state_variable_value (int num);
+void agent_set_trace_state_variable_value (int num, LONGEST val);
+
+/* Record the value of a trace state variable. */
+
+int agent_tsv_read (struct eval_agent_expr_context *ctx, int n);
+int agent_mem_read_string (struct eval_agent_expr_context *ctx,
+ unsigned char *to,
+ CORE_ADDR from,
+ ULONGEST len);
+
+/* Returns the address of the get_raw_reg function in the IPA. */
+CORE_ADDR get_raw_reg_func_addr (void);
+/* Returns the address of the get_trace_state_variable_value
+ function in the IPA. */
+CORE_ADDR get_get_tsv_func_addr (void);
+/* Returns the address of the set_trace_state_variable_value
+ function in the IPA. */
+CORE_ADDR get_set_tsv_func_addr (void);
+
+#endif /* TRACEPOINT_H */
--
1.7.11.7