34a5a32e12c2f7f0a9a1cc8d7e9759a6c9aa1e86
[platform/upstream/gdb.git] / gdb / gdbserver / tracepoint.h
1 /* Tracepoint code for remote server for GDB.
2    Copyright (C) 1993-2014 Free Software Foundation, Inc.
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
26 void initialize_tracepoint (void);
27
28 extern int tracing;
29 extern int disconnected_tracing;
30
31 void tracepoint_look_up_symbols (void);
32
33 void stop_tracing (void);
34
35 int handle_tracepoint_general_set (char *own_buf);
36 int handle_tracepoint_query (char *own_buf);
37
38 int tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc);
39 int tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc);
40
41 void release_while_stepping_state_list (struct thread_info *tinfo);
42
43 extern int current_traceframe;
44
45 int in_readonly_region (CORE_ADDR addr, ULONGEST length);
46 int traceframe_read_mem (int tfnum, CORE_ADDR addr,
47                          unsigned char *buf, ULONGEST length,
48                          ULONGEST *nbytes);
49 int fetch_traceframe_registers (int tfnum,
50                                 struct regcache *regcache,
51                                 int regnum);
52
53 int traceframe_read_sdata (int tfnum, ULONGEST offset,
54                            unsigned char *buf, ULONGEST length,
55                            ULONGEST *nbytes);
56
57 int traceframe_read_info (int tfnum, struct buffer *buffer);
58
59 /* If a thread is determined to be collecting a fast tracepoint, this
60    structure holds the collect status.  */
61
62 struct fast_tpoint_collect_status
63 {
64   /* The tracepoint that is presently being collected.  */
65   int tpoint_num;
66   CORE_ADDR tpoint_addr;
67
68   /* The address range in the jump pad of where the original
69      instruction the tracepoint jump was inserted was relocated
70      to.  */
71   CORE_ADDR adjusted_insn_addr;
72   CORE_ADDR adjusted_insn_addr_end;
73 };
74
75 int fast_tracepoint_collecting (CORE_ADDR thread_area,
76                                 CORE_ADDR stop_pc,
77                                 struct fast_tpoint_collect_status *status);
78 void force_unlock_trace_buffer (void);
79
80 int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
81
82 #ifdef IN_PROCESS_AGENT
83 void initialize_low_tracepoint (void);
84 void supply_fast_tracepoint_registers (struct regcache *regcache,
85                                        const unsigned char *regs);
86 void supply_static_tracepoint_registers (struct regcache *regcache,
87                                          const unsigned char *regs,
88                                          CORE_ADDR pc);
89 void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
90                                   char *errmsg);
91
92 extern const struct target_desc *ipa_tdesc;
93
94 #else
95 void stop_tracing (void);
96
97 int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline);
98 int have_fast_tracepoint_trampoline_buffer (char *msgbuf);
99 void gdb_agent_about_to_close (int pid);
100 #endif
101
102 struct traceframe;
103 struct eval_agent_expr_context;
104
105 /* Do memory copies for bytecodes.  */
106 /* Do the recording of memory blocks for actions and bytecodes.  */
107
108 int agent_mem_read (struct eval_agent_expr_context *ctx,
109                     unsigned char *to, CORE_ADDR from,
110                     ULONGEST len);
111
112 LONGEST agent_get_trace_state_variable_value (int num);
113 void agent_set_trace_state_variable_value (int num, LONGEST val);
114
115 /* Record the value of a trace state variable.  */
116
117 int agent_tsv_read (struct eval_agent_expr_context *ctx, int n);
118 int agent_mem_read_string (struct eval_agent_expr_context *ctx,
119                            unsigned char *to,
120                            CORE_ADDR from,
121                            ULONGEST len);
122
123 /* Returns the address of the get_raw_reg function in the IPA.  */
124 CORE_ADDR get_raw_reg_func_addr (void);
125 /* Returns the address of the get_trace_state_variable_value
126    function in the IPA.  */
127 CORE_ADDR get_get_tsv_func_addr (void);
128 /* Returns the address of the set_trace_state_variable_value
129    function in the IPA.  */
130 CORE_ADDR get_set_tsv_func_addr (void);
131
132 #endif /* TRACEPOINT_H */