110 for (i = n - 1; i >= 0; i--)
112 x->
buf[x->
len + i] = val & 0xff;
129 error (
_(
"GDB bug: ax-general.c (read_const): incomplete constant"));
131 for (i = 0; i < n; i++)
132 accum = (accum << 8) | x->
buf[o + i];
152 if (depth < 0 || depth > 255)
153 error (
_(
"GDB bug: ax-general.c (ax_pick): stack depth out of range"));
165 if (n < 0 || n > 255)
166 error (
_(
"GDB bug: ax-general.c (generic_ext): bit count out of range"));
168 if (
sizeof (
LONGEST) * 8 > 255)
169 error (
_(
"GDB bug: ax-general.c (generic_ext): "
170 "opcode has inadequate range"));
199 if (n < 0 || n > 255)
200 error (
_(
"GDB bug: ax-general.c (ax_trace_quick): "
201 "size out of range for trace_quick"));
204 x->
buf[x->
len++] = aop_trace_quick;
220 x->
buf[x->
len + 1] = 0xff;
221 x->
buf[x->
len + 2] = 0xff;
235 if (target < 0 || target >= 0xffff)
236 error (
_(
"GDB bug: ax-general.c (ax_label): label target out of range"));
238 x->
buf[patch] = (target >> 8) & 0xff;
239 x->
buf[patch + 1] = target & 0xff;
249 {aop_const8, aop_const16, aop_const32, aop_const64};
257 for (op = 0, size = 8; size < 64; size *= 2, op++)
261 if (-lim <= l && l <= lim - 1)
273 if (l < 0 && size < 64)
282 error (
_(
"GDB bug: ax-general.c (ax_const_d): "
283 "floating point not supported yet"));
296 error (
_(
"'%s' is a pseudo-register; "
297 "GDB cannot yet trace its contents."),
300 error (
_(
"Trace '%s' failed."),
307 error (
_(
"GDB bug: ax-general.c (ax_reg): "
308 "register number out of range"));
311 x->
buf[x->
len + 1] = (reg >> 8) & 0xff;
312 x->
buf[x->
len + 2] = (reg) & 0xff;
323 if (num < 0 || num > 0xffff)
325 _(
"ax-general.c (ax_tsv): variable "
326 "number is %d, out of range"), num);
330 x->
buf[x->
len + 1] = (num >> 8) & 0xff;
331 x->
buf[x->
len + 2] = (num) & 0xff;
346 if (slen < 0 || slen > 0xffff)
348 _(
"ax-general.c (ax_string): string "
349 "length is %d, out of allowed range"), slen);
352 x->
buf[x->
len++] = ((slen + 1) >> 8) & 0xff;
353 x->
buf[x->
len++] = (slen + 1) & 0xff;
354 for (i = 0; i < slen; ++i)
355 x->
buf[x->
len++] = str[i];
364 struct aop_map aop_map[] =
367 #define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
368 , { # NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED }
388 if ((
sizeof (aop_map) /
sizeof (aop_map[0]))
390 error (
_(
"GDB bug: ax-general.c (ax_print): opcode map out of sync"));
392 for (i = 0; i < x->
len;)
396 if (op >= (
sizeof (aop_map) /
sizeof (aop_map[0]))
397 || !aop_map[op].
name)
406 i, aop_map[op].name);
419 else if (op == aop_printf)
426 slen = slen * 256 + x->
buf[i++];
428 &(x->
buf[i]), nargs);
444 error (
_(
"'%s' is a pseudo-register; "
445 "GDB cannot yet trace its contents."),
448 error (
_(
"Trace '%s' failed."),
460 int new_len = byte + 1;
470 ax->
reg_mask[byte] |= 1 << (reg % 8);
484 char *targets = (
char *) alloca (ax->
len * sizeof (targets[0]));
488 char *boundary = (
char *) alloca (ax->
len * sizeof (boundary[0]));
493 int *heights = (
int *) alloca (ax->
len * sizeof (heights[0]));
498 memset (targets, 0, ax->
len * sizeof (targets[0]));
499 memset (boundary, 0, ax->
len * sizeof (boundary[0]));
505 for (i = 0; i < ax->
len; i += 1 + op->
op_size)
507 if (ax->
buf[i] > (sizeof (aop_map) /
sizeof (aop_map[0])))
513 op = &aop_map[ax->
buf[i]];
530 if (targets[i] && (heights[i] != height))
540 if (height < ax->min_height)
552 if (aop_goto == op - aop_map
553 || aop_if_goto == op - aop_map)
556 if (target < 0 || target >= ax->
len)
564 if (targets[target] || boundary[target])
566 if (heights[target] != height)
575 heights[target] = height;
580 if (aop_goto == op - aop_map
589 height = heights[i + 3];
593 if (aop_reg == op - aop_map)
602 for (i = 0; i < ax->
len; i++)
603 if (targets[i] && !boundary[i])
void free_agent_expr(struct agent_expr *x)
const char * user_reg_map_regnum_to_name(struct gdbarch *gdbarch, int regnum)
struct cleanup * make_cleanup_free_agent_expr(struct agent_expr *x)
int ax_goto(struct agent_expr *x, enum agent_op op)
void ax_reqs(struct agent_expr *ax)
void ax_reg_mask(struct agent_expr *ax, int reg)
void internal_error(const char *file, int line, const char *fmt,...)
void ax_const_d(struct agent_expr *x, LONGEST d)
static void generic_ext(struct agent_expr *x, enum agent_op op, int n)
void ax_reg(struct agent_expr *x, int reg)
int gdbarch_num_regs(struct gdbarch *gdbarch)
void ax_tsv(struct agent_expr *x, enum agent_op op, int num)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
static void do_free_agent_expr_cleanup(void *x)
static LONGEST read_const(struct agent_expr *x, int o, int n)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static void grow_expr(struct agent_expr *x, int n)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
void ax_ext(struct agent_expr *x, int n)
void ax_string(struct agent_expr *x, const char *str, int slen)
void ax_label(struct agent_expr *x, int patch, int target)
void ax_simple(struct agent_expr *x, enum agent_op op)
int gdbarch_ax_pseudo_register_push_stack_p(struct gdbarch *gdbarch)
PTR xrealloc(PTR ptr, size_t size)
void ax_print(struct ui_file *f, struct agent_expr *x)
void print_longest(struct ui_file *stream, int format, int use_c_format, LONGEST val_long)
int gdbarch_ax_pseudo_register_push_stack(struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
struct agent_expr * new_agent_expr(struct gdbarch *gdbarch, CORE_ADDR scope)
static void append_const(struct agent_expr *x, LONGEST val, int n)
void ax_trace_quick(struct agent_expr *x, int n)
void ax_const_l(struct agent_expr *x, LONGEST l)
void ax_pick(struct agent_expr *x, int depth)
int gdbarch_ax_pseudo_register_collect_p(struct gdbarch *gdbarch)
void ax_zero_ext(struct agent_expr *x, int n)
int gdbarch_ax_pseudo_register_collect(struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
void error(const char *fmt,...)