88 for (i = n - 1; i >= 0; i--)
90 x->
buf[x->
len + i] = val & 0xff;
107 error (_(
"GDB bug: ax-general.c (read_const): incomplete constant"));
109 for (i = 0; i < n; i++)
110 accum = (accum << 8) | x->
buf[o + i];
137 if (depth < 0 || depth > 255)
138 error (_(
"GDB bug: ax-general.c (ax_pick): stack depth out of range"));
150 if (n < 0 || n > 255)
151 error (_(
"GDB bug: ax-general.c (generic_ext): bit count out of range"));
153 if (
sizeof (LONGEST) * 8 > 255)
154 error (_(
"GDB bug: ax-general.c (generic_ext): "
155 "opcode has inadequate range"));
184 if (n < 0 || n > 255)
185 error (_(
"GDB bug: ax-general.c (ax_trace_quick): "
186 "size out of range for trace_quick"));
189 x->
buf[x->
len++] = aop_trace_quick;
205 x->
buf[x->
len + 1] = 0xff;
206 x->
buf[x->
len + 2] = 0xff;
220 if (target < 0 || target >= 0xffff)
221 error (_(
"GDB bug: ax-general.c (ax_label): label target out of range"));
223 x->
buf[patch] = (target >> 8) & 0xff;
224 x->
buf[patch + 1] = target & 0xff;
234 {aop_const8, aop_const16, aop_const32, aop_const64};
244 LONGEST lim = ((LONGEST) 1) << (
size - 1);
246 if (-lim <= l && l <= lim - 1)
258 if (l < 0 &&
size < 64)
267 error (_(
"GDB bug: ax-general.c (ax_const_d): "
268 "floating point not supported yet"));
281 error (_(
"'%s' is a pseudo-register; "
282 "GDB cannot yet trace its contents."),
285 error (_(
"Trace '%s' failed."),
294 if (reg < 0 || reg > 0xffff)
295 error (_(
"GDB bug: ax-general.c (ax_reg): "
296 "register number out of range"));
299 x->
buf[x->
len + 1] = (reg >> 8) & 0xff;
300 x->
buf[x->
len + 2] = (reg) & 0xff;
311 if (num < 0 || num > 0xffff)
312 internal_error (_(
"ax-general.c (ax_tsv): variable "
313 "number is %d, out of range"), num);
317 x->
buf[x->
len + 1] = (num >> 8) & 0xff;
318 x->
buf[x->
len + 2] = (num) & 0xff;
333 if (slen < 0 || slen > 0xffff)
334 internal_error (_(
"ax-general.c (ax_string): string "
335 "length is %d, out of allowed range"), slen);
338 x->
buf[x->
len++] = ((slen + 1) >> 8) & 0xff;
339 x->
buf[x->
len++] = (slen + 1) & 0xff;
340 for (i = 0; i < slen; ++i)
341 x->
buf[x->
len++] = str[i];
353#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
354 , { # NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED }
355#include "gdbsupport/ax.def"
376 error (_(
"GDB bug: ax-general.c (ax_print): opcode map out of sync"));
378 for (i = 0; i < x->
len;)
385 gdb_printf (
f, _(
"%3d <bad opcode %02x>\n"), i, op);
405 else if (op == aop_printf)
412 slen = slen * 256 + x->
buf[i++];
414 &(x->
buf[i]), nargs);
430 error (_(
"'%s' is a pseudo-register; "
431 "GDB cannot yet trace its contents."),
434 error (_(
"Trace '%s' failed."),
450 int new_len =
byte + 1;
451 unsigned char *new_reg_mask
452 = XRESIZEVEC (
unsigned char, ax->
reg_mask, new_len);
460 ax->
reg_mask[byte] |= 1 << (reg % 8);
474 char *targets = (
char *) alloca (ax->
len * sizeof (targets[0]));
478 char *boundary = (
char *) alloca (ax->
len * sizeof (boundary[0]));
483 int *heights = (
int *) alloca (ax->
len * sizeof (heights[0]));
488 memset (targets, 0, ax->
len * sizeof (targets[0]));
489 memset (boundary, 0, ax->
len * sizeof (boundary[0]));
495 for (i = 0; i < ax->
len; i += 1 + op->
op_size)
520 if (targets[i] && (heights[i] != height))
530 if (height < ax->min_height)
543 || aop_if_goto == op -
aop_map)
546 if (target < 0 || target >= ax->
len)
554 if (targets[target] || boundary[target])
556 if (heights[target] != height)
565 heights[target] = height;
579 height = heights[i + 3];
592 for (i = 0; i < ax->
len; i++)
593 if (targets[i] && !boundary[i])
void * xrealloc(void *ptr, size_t size)
static void generic_ext(struct agent_expr *x, enum agent_op op, int n)
void ax_reqs(struct agent_expr *ax)
static void append_const(struct agent_expr *x, LONGEST val, int n)
void ax_label(struct agent_expr *x, int patch, int target)
void ax_zero_ext(struct agent_expr *x, int n)
void ax_print(struct ui_file *f, struct agent_expr *x)
void ax_string(struct agent_expr *x, const char *str, int slen)
void ax_reg_mask(struct agent_expr *ax, int reg)
void ax_simple(struct agent_expr *x, enum agent_op op)
void ax_raw_byte(struct agent_expr *x, gdb_byte byte)
void ax_const_d(struct agent_expr *x, LONGEST d)
void ax_pick(struct agent_expr *x, int depth)
void ax_const_l(struct agent_expr *x, LONGEST l)
void ax_ext(struct agent_expr *x, int n)
void ax_tsv(struct agent_expr *x, enum agent_op op, int num)
int ax_goto(struct agent_expr *x, enum agent_op op)
void ax_reg(struct agent_expr *x, int reg)
static LONGEST read_const(struct agent_expr *x, int o, int n)
static void grow_expr(struct agent_expr *x, int n)
void ax_trace_quick(struct agent_expr *x, int n)
@ agent_flaw_height_mismatch
@ agent_flaw_bad_instruction
@ agent_flaw_incomplete_instruction
bool gdbarch_ax_pseudo_register_push_stack_p(struct gdbarch *gdbarch)
int gdbarch_ax_pseudo_register_collect(struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
int gdbarch_num_regs(struct gdbarch *gdbarch)
int gdbarch_remote_register_number(struct gdbarch *gdbarch, int regno)
bool gdbarch_ax_pseudo_register_collect_p(struct gdbarch *gdbarch)
int gdbarch_ax_pseudo_register_push_stack(struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
agent_expr(struct gdbarch *gdbarch, CORE_ADDR scope)
const char * user_reg_map_regnum_to_name(struct gdbarch *gdbarch, int regnum)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
void print_longest(struct ui_file *stream, int format, int use_c_format, LONGEST val_long)