/* Tracepoint code for remote server for GDB.
- Copyright (C) 1993-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-2019 Free Software Foundation, Inc.
This file is part of GDB.
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
+#ifndef GDBSERVER_TRACEPOINT_H
+#define GDBSERVER_TRACEPOINT_H
/* Size for a small buffer to report problems from the in-process
agent back to GDBserver. */
void initialize_tracepoint (void);
-extern int tracing;
+#if defined(__GNUC__)
+# define ATTR_USED __attribute__((used))
+# define ATTR_NOINLINE __attribute__((noinline))
+#else
+# define ATTR_USED
+# define ATTR_NOINLINE
+#endif
+
+/* How to make symbol public/exported. */
+
+#if defined _WIN32 || defined __CYGWIN__
+# define EXPORTED_SYMBOL __declspec (dllexport)
+#else
+# if __GNUC__ >= 4
+# define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
+# else
+# define EXPORTED_SYMBOL
+# endif
+#endif
+
+/* Use these to make sure the functions and variables the IPA needs to
+ export (symbols GDBserver needs to query GDB about) are visible and
+ have C linkage.
+
+ Tag exported functions with IP_AGENT_EXPORT_FUNC, tag the
+ definitions of exported variables with IP_AGENT_EXPORT_VAR, and
+ variable declarations with IP_AGENT_EXPORT_VAR_DECL. Variables
+ must also be exported with C linkage. As we can't both use extern
+ "C" and initialize a variable in the same statement, variables that
+ don't have a separate declaration must use
+ EXTERN_C_PUSH/EXTERN_C_POP around their definition. */
+
+#ifdef IN_PROCESS_AGENT
+# define IP_AGENT_EXPORT_FUNC EXTERN_C EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED
+# 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_VAR
+# define IP_AGENT_EXPORT_VAR_DECL extern
+#endif
+
+IP_AGENT_EXPORT_VAR_DECL int tracing;
+
extern int disconnected_tracing;
void tracepoint_look_up_symbols (void);
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,
CORE_ADDR adjusted_insn_addr_end;
};
-int fast_tracepoint_collecting (CORE_ADDR thread_area,
- CORE_ADDR stop_pc,
- struct fast_tpoint_collect_status *status);
+/* The possible states a thread can be in, related to the collection of fast
+ tracepoint. */
+
+enum class fast_tpoint_collect_result
+{
+ /* Not collecting a fast tracepoint. */
+ not_collecting,
+
+ /* In the jump pad, but before the relocated instruction. */
+ before_insn,
+
+ /* In the jump pad, but at (or after) the relocated instruction. */
+ at_insn,
+};
+
+fast_tpoint_collect_result 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);
+const struct target_desc *get_ipa_tdesc (int idx);
void supply_fast_tracepoint_registers (struct regcache *regcache,
const unsigned char *regs);
void supply_static_tracepoint_registers (struct regcache *regcache,
CORE_ADDR pc);
void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
char *errmsg);
-
-extern const struct target_desc *ipa_tdesc;
-
+void *alloc_jump_pad_buffer (size_t size);
+#ifndef HAVE_GETAUXVAL
+unsigned long getauxval (unsigned long type);
+#endif
#else
void stop_tracing (void);
CORE_ADDR from,
ULONGEST len);
+/* The prototype the get_raw_reg function in the IPA. Each arch's
+ bytecode compiler emits calls to this function. */
+ULONGEST get_raw_reg (const unsigned char *raw_regs, int regnum);
+
/* 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_set_tsv_func_addr (void);
-#endif /* TRACEPOINT_H */
+#endif /* GDBSERVER_TRACEPOINT_H */