]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/gdbserver/tracepoint.h
Make functions and variables exported by the IPA be extern "C"
[thirdparty/binutils-gdb.git] / gdb / gdbserver / tracepoint.h
CommitLineData
270c6aea 1/* Tracepoint code for remote server for GDB.
32d0add0 2 Copyright (C) 1993-2015 Free Software Foundation, Inc.
270c6aea
PA
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#ifndef TRACEPOINT_H
20#define TRACEPOINT_H
21
22/* Size for a small buffer to report problems from the in-process
23 agent back to GDBserver. */
24#define IPA_BUFSIZ 100
25
26void initialize_tracepoint (void);
27
3c14e5a3
PA
28#if defined(__GNUC__)
29# define ATTR_USED __attribute__((used))
30# define ATTR_NOINLINE __attribute__((noinline))
31#else
32# define ATTR_USED
33# define ATTR_NOINLINE
34#endif
35
36/* How to make symbol public/exported. */
37
38#if defined _WIN32 || defined __CYGWIN__
39# define EXPORTED_SYMBOL __declspec (dllexport)
40#else
41# if __GNUC__ >= 4
42# define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
43# else
44# define EXPORTED_SYMBOL
45# endif
46#endif
47
48/* Use these to make sure the functions and variables the IPA needs to
49 export (symbols GDBserver needs to query GDB about) are visible and
50 have C linkage.
51
52 Tag exported functions with IP_AGENT_EXPORT_FUNC, tag the
53 definitions of exported variables with IP_AGENT_EXPORT_VAR, and
54 variable declarations with IP_AGENT_EXPORT_VAR_DECL. Variables
55 must also be exported with C linkage. As we can't both use extern
56 "C" and initialize a variable in the same statement, variables that
57 don't have a separate declaration must use
58 EXTERN_C_PUSH/EXTERN_C_POP around their definition. */
59
60#ifdef IN_PROCESS_AGENT
61# define IP_AGENT_EXPORT_FUNC EXTERN_C EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED
62# define IP_AGENT_EXPORT_VAR EXPORTED_SYMBOL ATTR_USED
63# define IP_AGENT_EXPORT_VAR_DECL EXTERN_C EXPORTED_SYMBOL
64#else
65# define IP_AGENT_EXPORT_FUNC
66# define IP_AGENT_EXPORT_VAR
67# define IP_AGENT_EXPORT_VAR_DECL extern
68#endif
69
70IP_AGENT_EXPORT_VAR_DECL int tracing;
71
270c6aea
PA
72extern int disconnected_tracing;
73
74void tracepoint_look_up_symbols (void);
75
76void stop_tracing (void);
77
78int handle_tracepoint_general_set (char *own_buf);
79int handle_tracepoint_query (char *own_buf);
80
81int tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc);
82int tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc);
83
84void release_while_stepping_state_list (struct thread_info *tinfo);
85
86extern int current_traceframe;
87
88int in_readonly_region (CORE_ADDR addr, ULONGEST length);
89int traceframe_read_mem (int tfnum, CORE_ADDR addr,
90 unsigned char *buf, ULONGEST length,
91 ULONGEST *nbytes);
92int fetch_traceframe_registers (int tfnum,
93 struct regcache *regcache,
94 int regnum);
95
96int traceframe_read_sdata (int tfnum, ULONGEST offset,
97 unsigned char *buf, ULONGEST length,
98 ULONGEST *nbytes);
99
100int traceframe_read_info (int tfnum, struct buffer *buffer);
101
102/* If a thread is determined to be collecting a fast tracepoint, this
103 structure holds the collect status. */
104
105struct fast_tpoint_collect_status
106{
107 /* The tracepoint that is presently being collected. */
108 int tpoint_num;
109 CORE_ADDR tpoint_addr;
110
111 /* The address range in the jump pad of where the original
112 instruction the tracepoint jump was inserted was relocated
113 to. */
114 CORE_ADDR adjusted_insn_addr;
115 CORE_ADDR adjusted_insn_addr_end;
116};
117
118int fast_tracepoint_collecting (CORE_ADDR thread_area,
119 CORE_ADDR stop_pc,
120 struct fast_tpoint_collect_status *status);
121void force_unlock_trace_buffer (void);
122
123int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
124
125#ifdef IN_PROCESS_AGENT
126void initialize_low_tracepoint (void);
127void supply_fast_tracepoint_registers (struct regcache *regcache,
128 const unsigned char *regs);
129void supply_static_tracepoint_registers (struct regcache *regcache,
130 const unsigned char *regs,
131 CORE_ADDR pc);
132void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
133 char *errmsg);
134
135extern const struct target_desc *ipa_tdesc;
136
137#else
138void stop_tracing (void);
139
140int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline);
141int have_fast_tracepoint_trampoline_buffer (char *msgbuf);
142void gdb_agent_about_to_close (int pid);
143#endif
144
145struct traceframe;
146struct eval_agent_expr_context;
147
148/* Do memory copies for bytecodes. */
149/* Do the recording of memory blocks for actions and bytecodes. */
150
151int agent_mem_read (struct eval_agent_expr_context *ctx,
152 unsigned char *to, CORE_ADDR from,
153 ULONGEST len);
154
155LONGEST agent_get_trace_state_variable_value (int num);
156void agent_set_trace_state_variable_value (int num, LONGEST val);
157
158/* Record the value of a trace state variable. */
159
160int agent_tsv_read (struct eval_agent_expr_context *ctx, int n);
161int agent_mem_read_string (struct eval_agent_expr_context *ctx,
162 unsigned char *to,
163 CORE_ADDR from,
164 ULONGEST len);
165
3c14e5a3
PA
166/* The prototype the get_raw_reg function in the IPA. Each arch's
167 bytecode compiler emits calls to this function. */
168IP_AGENT_EXPORT_FUNC ULONGEST gdb_agent_get_raw_reg
169 (const unsigned char *raw_regs, int regnum);
170
270c6aea
PA
171/* Returns the address of the get_raw_reg function in the IPA. */
172CORE_ADDR get_raw_reg_func_addr (void);
173/* Returns the address of the get_trace_state_variable_value
174 function in the IPA. */
175CORE_ADDR get_get_tsv_func_addr (void);
176/* Returns the address of the set_trace_state_variable_value
177 function in the IPA. */
178CORE_ADDR get_set_tsv_func_addr (void);
179
180#endif /* TRACEPOINT_H */