gdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's commands.
[deliverable/binutils-gdb.git] / gdb / gdbserver / ax.h
CommitLineData
9f14eebc 1/* Data structures and functions associated with agent expressions in GDB.
ecd75fc8 2 Copyright (C) 2009-2014 Free Software Foundation, Inc.
9f14eebc
LM
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#if !defined (AX_H)
20#define AX_H 1
21
22#include "server.h"
23#include "regcache.h"
24
25#ifdef IN_PROCESS_AGENT
26extern int debug_agent;
27#define debug_threads debug_agent
28#endif
29
30struct traceframe;
31
32/* Enumeration of the different kinds of things that can happen during
33 agent expression evaluation. */
34
35enum eval_result_type
36 {
37 expr_eval_no_error,
38 expr_eval_empty_expression,
39 expr_eval_empty_stack,
40 expr_eval_stack_overflow,
41 expr_eval_stack_underflow,
42 expr_eval_unhandled_opcode,
43 expr_eval_unrecognized_opcode,
44 expr_eval_divide_by_zero,
45 expr_eval_invalid_goto
46 };
47
48struct agent_expr
49{
50 int length;
51
52 unsigned char *bytes;
53};
54
55#ifndef IN_PROCESS_AGENT
56
57/* The packet form of an agent expression consists of an 'X', number
58 of bytes in expression, a comma, and then the bytes. */
59struct agent_expr *gdb_parse_agent_expr (char **actparm);
60
0a261ed8
PA
61/* Release an agent expression. */
62void gdb_free_agent_expr (struct agent_expr *aexpr);
63
9f14eebc
LM
64/* Convert the bytes of an agent expression back into hex digits, so
65 they can be printed or uploaded. This allocates the buffer,
66 callers should free when they are done with it. */
67char *gdb_unparse_agent_expr (struct agent_expr *aexpr);
68void emit_prologue (void);
69void emit_epilogue (void);
70enum eval_result_type compile_bytecodes (struct agent_expr *aexpr);
71#endif
72
5ae4861a
YQ
73/* The context when evaluating agent expression. */
74
75struct eval_agent_expr_context
76{
77 /* The registers when evaluating agent expression. */
78 struct regcache *regcache;
79 /* The traceframe, if any, when evaluating agent expression. */
80 struct traceframe *tframe;
81 /* The tracepoint, if any, when evaluating agent expression. */
82 struct tracepoint *tpoint;
83};
84
85enum eval_result_type
86 gdb_eval_agent_expr (struct eval_agent_expr_context *ctx,
87 struct agent_expr *aexpr,
88 ULONGEST *rslt);
f699aaba
PA
89
90/* Bytecode compilation function vector. */
91
92struct emit_ops
93{
94 void (*emit_prologue) (void);
95 void (*emit_epilogue) (void);
96 void (*emit_add) (void);
97 void (*emit_sub) (void);
98 void (*emit_mul) (void);
99 void (*emit_lsh) (void);
100 void (*emit_rsh_signed) (void);
101 void (*emit_rsh_unsigned) (void);
102 void (*emit_ext) (int arg);
103 void (*emit_log_not) (void);
104 void (*emit_bit_and) (void);
105 void (*emit_bit_or) (void);
106 void (*emit_bit_xor) (void);
107 void (*emit_bit_not) (void);
108 void (*emit_equal) (void);
109 void (*emit_less_signed) (void);
110 void (*emit_less_unsigned) (void);
111 void (*emit_ref) (int size);
112 void (*emit_if_goto) (int *offset_p, int *size_p);
113 void (*emit_goto) (int *offset_p, int *size_p);
114 void (*write_goto_address) (CORE_ADDR from, CORE_ADDR to, int size);
115 void (*emit_const) (LONGEST num);
116 void (*emit_call) (CORE_ADDR fn);
117 void (*emit_reg) (int reg);
118 void (*emit_pop) (void);
119 void (*emit_stack_flush) (void);
120 void (*emit_zero_ext) (int arg);
121 void (*emit_swap) (void);
122 void (*emit_stack_adjust) (int n);
123
124 /* Emit code for a generic function that takes one fixed integer
125 argument and returns a 64-bit int (for instance, tsv getter). */
126 void (*emit_int_call_1) (CORE_ADDR fn, int arg1);
127
128 /* Emit code for a generic function that takes one fixed integer
129 argument and a 64-bit int from the top of the stack, and returns
130 nothing (for instance, tsv setter). */
131 void (*emit_void_call_2) (CORE_ADDR fn, int arg1);
132
133 /* Emit code specialized for common combinations of compare followed
134 by a goto. */
135 void (*emit_eq_goto) (int *offset_p, int *size_p);
136 void (*emit_ne_goto) (int *offset_p, int *size_p);
137 void (*emit_lt_goto) (int *offset_p, int *size_p);
138 void (*emit_le_goto) (int *offset_p, int *size_p);
139 void (*emit_gt_goto) (int *offset_p, int *size_p);
140 void (*emit_ge_goto) (int *offset_p, int *size_p);
141};
142
143extern CORE_ADDR current_insn_ptr;
144extern int emit_error;
145
9f14eebc 146#endif /* AX_H */
This page took 0.221819 seconds and 4 git commands to generate.