124 struct type *result_type);
132 struct type *result_type);
138 struct type *
type,
int start,
int end);
151 char *operator_name,
char *operand_name);
159 struct type *size_type);
190 static struct value *
213 static struct value *
224 LONGEST k = (*pc)[2].longconst;
256 static struct value *
357 for (i = 0; i < nbases; i++)
372 int string_trace = 0;
521 _(
"gen_fetch: strange size"));
531 error (
_(
"gen_fetch: Unsupported type code `%s'."),
548 else if (distance < 0)
568 ax->
scope, &frame_reg, &frame_offset);
583 ax->
scope, &frame_reg, &frame_offset);
655 _(
"gen_var_ref: LOC_CONST_BYTES "
656 "symbols are not supported"));
687 error (
_(
"Cannot compute value of typedef `%s'."),
737 error (
_(
"Cannot find value of botched symbol `%s'."),
773 error (
_(
"Value not scalar: cannot be an rvalue."));
923 nontrivial = ax->
len > 0;
1012 error (
_(
"Invalid type cast: intended type must be scalar."));
1035 error (
_(
"Casts to requested type are not yet implemented."));
1096 struct type *result_type)
1104 First argument of `-' is a pointer, but second argument is neither\n\
1105 an integer nor a pointer of the same type."));
1109 value->
type = result_type;
1116 struct type *result_type)
1122 aop_equal, aop_equal, 0,
"equal");
1123 value->
type = result_type;
1130 struct type *result_type)
1136 aop_less_signed, aop_less_unsigned, 0,
"less than");
1137 value->
type = result_type;
1151 int may_carry,
char *
name)
1156 error (
_(
"Invalid combination of types in %s."), name);
1169 struct type *result_type)
1173 error (
_(
"Invalid type of operand to `!'."));
1176 value->
type = result_type;
1184 error (
_(
"Invalid type of operand to `~'."));
1202 _(
"gen_deref: expected a pointer"));
1211 error (
_(
"Attempt to dereference a generic pointer."));
1229 switch (value->
kind)
1232 error (
_(
"Operand of `&' is an rvalue, which has no address."));
1235 error (
_(
"Operand of `&' is in a register, and has no address."));
1255 = {aop_ref8, aop_ref16, aop_ref32, aop_ref64};
1256 static int num_ops = (
sizeof (ops) /
sizeof (ops[0]));
1305 if ((end - start) > ((1 << num_ops) * 8))
1307 _(
"gen_bitfield_ref: bitfield too wide"));
1311 offset = bound_start;
1313 for (op = num_ops - 1; op >= 0; op--)
1316 int op_size = 8 << op;
1322 if (offset + op_size <= bound_end)
1325 int last_frag = (offset + op_size == bound_end);
1392 while (fragment_count-- > 1)
1449 if (strcmp (field, this_name) == 0)
1459 error (
_(
"static field `%s' has been "
1460 "optimized out, cannot use"),
1469 if (this_name[0] ==
'\0')
1471 _(
"find_field: anonymous unions not supported"));
1477 for (i = 0; i < nbases; i++)
1501 char *operator_name,
char *operand_name)
1519 error (
_(
"The left operand of `%s' is not a %s."),
1520 operator_name, operand_name);
1525 error (
_(
"Structure does not live in memory."));
1531 error (
_(
"Couldn't find member named `%s' in struct/union/class `%s'"),
1538 const struct type *curtype,
char *
name);
1542 const struct type *curtype,
char *
name);
1581 struct type *
type,
char *fieldname)
1583 struct type *t =
type;
1589 _(
"non-aggregate type to gen_struct_elt_for_reference"));
1595 if (t_field_name && strcmp (t_field_name, fieldname) == 0)
1601 error (
_(
"static field `%s' has been "
1602 "optimized out, cannot use"),
1607 error (
_(
"pointers to bitfield members not allowed"));
1611 error (
_(
"Cannot reference non-static field \"%s\""), fieldname);
1627 const struct type *curtype,
char *
name)
1632 error (
_(
"No symbol \"%s\" in namespace \"%s\"."),
1647 const struct type *curtype,
char *
name)
1662 error (
_(
"`%s' has been optimized out, cannot use"),
1673 char *operator_name,
char *operand_name)
1686 _(
"non-aggregate type in gen_aggregate_elt_ref"));
1713 error (
_(
"Left operand of `@' must be an object in memory."));
1721 error (
_(
"Right operand of `@' must be a "
1722 "constant, in agent expressions."));
1724 error (
_(
"Right operand of `@' must be an integer."));
1727 error (
_(
"Right operand of `@' must be positive."));
1738 value->
type = array;
1750 struct type *size_type)
1757 int start = ax->
len;
1766 value->
type = size_type;
1780 struct axs_value value1, value2, value3;
1782 int if1, go1, if2, go2, end;
1809 case BINOP_SUBSCRIPT:
1810 case BINOP_BITWISE_AND:
1811 case BINOP_BITWISE_IOR:
1812 case BINOP_BITWISE_XOR:
1814 case BINOP_NOTEQUAL:
1825 case BINOP_LOGICAL_AND:
1830 if1 =
ax_goto (ax, aop_if_goto);
1835 if2 =
ax_goto (ax, aop_if_goto);
1845 value->
type = int_type;
1848 case BINOP_LOGICAL_OR:
1853 if1 =
ax_goto (ax, aop_if_goto);
1856 if2 =
ax_goto (ax, aop_if_goto);
1864 value->
type = int_type;
1876 if1 =
ax_goto (ax, aop_if_goto);
1891 if ((*pc)[0].opcode == OP_INTERNALVAR)
1906 error (
_(
"$%s is not a trace state variable, "
1907 "may not assign to it"), name);
1910 error (
_(
"May only assign to trace state variables"));
1913 case BINOP_ASSIGN_MODIFY:
1915 op2 = (*pc)[0].opcode;
1918 if ((*pc)[0].opcode == OP_INTERNALVAR)
1942 error (
_(
"$%s is not a trace state variable, "
1943 "may not assign to it"), name);
1946 error (
_(
"May only assign to trace state variables"));
1969 LONGEST k = (*pc)[2].longconst;
1980 error (
_(
"`%s' has been optimized out, cannot use"),
1988 const char *
name = &(*pc)[2].string;
1995 _(
"Register $%s not available"), name);
1999 error (
_(
"'%s' is a user-register; "
2000 "GDB cannot yet trace user-register contents."),
2008 case OP_INTERNALVAR:
2026 error (
_(
"$%s is not a trace state variable; GDB agent "
2027 "expressions cannot use convenience variables."), name);
2048 case UNOP_CAST_TYPE:
2055 offset = *pc - exp->
elts;
2083 case UNOP_MEMVAL_TYPE:
2090 offset = *pc - exp->
elts;
2124 gen_binop (ax, value, &value1, &value2, aop_sub, aop_sub, 1,
"negation");
2127 case UNOP_LOGICAL_NOT:
2134 case UNOP_COMPLEMENT:
2147 error (
_(
"Argument of unary `*' is not a pointer."));
2166 case STRUCTOP_STRUCT:
2169 int length = (*pc)[1].longconst;
2170 char *
name = &(*pc)[2].string;
2174 if (op == STRUCTOP_STRUCT)
2175 gen_struct_ref (exp, ax, value, name,
".",
"structure or union");
2176 else if (op == STRUCTOP_PTR)
2178 "pointer to a structure or union");
2183 _(
"gen_expr: unhandled struct case"));
2189 struct symbol *sym, *
func;
2190 const struct block *b;
2204 error (
_(
"`%s' has been optimized out, cannot use"),
2215 char *
name = &(*pc)[3].string;
2221 error (
_(
"There is no field named %s"), name);
2229 error (
_(
"Attempt to use a type name as an expression."));
2232 error (
_(
"Unsupported operator %s (%d) in expression."),
2267 aop_add, aop_add, 1,
"addition");
2280 aop_sub, aop_sub, 1,
"subtraction");
2284 aop_mul, aop_mul, 1,
"multiplication");
2288 aop_div_signed, aop_div_unsigned, 1,
"division");
2292 aop_rem_signed, aop_rem_unsigned, 1,
"remainder");
2296 aop_lsh, aop_lsh, 1,
"left shift");
2300 aop_rsh_signed, aop_rsh_unsigned, 1,
"right shift");
2302 case BINOP_SUBSCRIPT:
2308 error (
_(
"cannot subscript requested type: "
2309 "cannot call user defined functions"));
2321 error (
_(
"cannot subscript something of type `%s'"),
2324 error (
_(
"cannot subscript requested type"));
2329 error (
_(
"Argument to arithmetic operation "
2330 "not a number or boolean."));
2336 case BINOP_BITWISE_AND:
2338 aop_bit_and, aop_bit_and, 0,
"bitwise and");
2341 case BINOP_BITWISE_IOR:
2343 aop_bit_or, aop_bit_or, 0,
"bitwise or");
2346 case BINOP_BITWISE_XOR:
2348 aop_bit_xor, aop_bit_xor, 0,
"bitwise exclusive-or");
2352 gen_equal (ax, value, value1, value2, int_type);
2355 case BINOP_NOTEQUAL:
2356 gen_equal (ax, value, value1, value2, int_type);
2361 gen_less (ax, value, value1, value2, int_type);
2366 gen_less (ax, value, value1, value2, int_type);
2371 gen_less (ax, value, value1, value2, int_type);
2376 gen_less (ax, value, value1, value2, int_type);
2384 _(
"gen_expr: op case sets don't match"));
2398 struct cleanup *old_chain = 0;
2440 struct cleanup *old_chain = 0;
2476 struct cleanup *old_chain = 0;
2504 struct cleanup *old_chain = 0;
2535 const char *format,
int fmtlen,
2539 struct cleanup *old_chain = 0;
2552 for (tem = nargs - 1; tem >= 0; --tem)
2554 pc = exprs[tem]->
elts;
2556 gen_expr (exprs[tem], &pc, ax, &value);
2583 struct cleanup *old_chain = 0;
2596 if (!eval && strcmp (arg,
"$_ret") == 0)
2634 error (
_(
"GDB can't do agent expression translation with overlays."));
2649 (
struct symtab *) NULL, 0, &canonical,
2695 struct cleanup *old_chain = 0;
2700 const char *cmdrest;
2701 const char *format_start, *format_end;
2710 error (
_(
"GDB can't do agent expression translation with overlays."));
2719 if (*cmdrest++ !=
'"')
2720 error (
_(
"Must start with a format string."));
2722 format_start = cmdrest;
2728 format_end = cmdrest;
2730 if (*cmdrest++ !=
'"')
2731 error (
_(
"Bad format string, non-terminated '\"'."));
2735 if (*cmdrest !=
',' && *cmdrest != 0)
2736 error (
_(
"Invalid argument syntax"));
2738 if (*cmdrest ==
',')
2743 while (*cmdrest !=
'\0')
2749 argvec[nargs] = expr;
2752 if (*cmdrest ==
',')
2759 format_start, format_end - format_start,
2760 fpieces, nargs, argvec);
2781 Translate an expression into remote agent bytecode for tracing.\n\
2782 Usage: maint agent [-at location,] EXPRESSION\n\
2783 If -at is given, generate remote agent bytecode for this location.\n\
2784 If not, generate remote agent bytecode for current frame pc address."),
2789 Translate an expression into remote agent bytecode for evaluation.\n\
2790 Usage: maint agent-eval [-at location,] EXPRESSION\n\
2791 If -at is given, generate remote agent bytecode for this location.\n\
2792 If not, generate remote agent bytecode for current frame pc address."),
2796 _(
"Translate an expression into remote "
2797 "agent bytecode for evaluation and display the bytecodes."),
void error_no_arg(const char *why)
void free_agent_expr(struct agent_expr *x)
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n)
struct cleanup * make_cleanup_free_agent_expr(struct agent_expr *x)
static void gen_logical_not(struct agent_expr *ax, struct axs_value *value, struct type *result_type)
union exp_element elts[1]
static void gen_var_ref(struct gdbarch *, struct agent_expr *ax, struct axs_value *value, struct symbol *var)
static void gen_primitive_field(struct expression *exp, struct agent_expr *ax, struct axs_value *value, int offset, int fieldno, struct type *type)
static void gen_conversion(struct agent_expr *ax, struct type *from, struct type *to)
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
int ax_goto(struct agent_expr *x, enum agent_op op)
static void gen_extend(struct agent_expr *, struct type *)
static void agent_eval_command(char *exp, int from_tty)
CORE_ADDR get_frame_pc(struct frame_info *frame)
#define SYMBOL_PRINT_NAME(symbol)
struct frame_info * get_current_frame(void)
void ax_reqs(struct agent_expr *ax)
static void agent_command_1(char *exp, int eval)
#define TYPE_FIELD_NAME(thistype, n)
static void gen_ptradd(struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2)
struct type * builtin_unsigned_int
#define TYPE_N_BASECLASSES(thistype)
void ax_reg_mask(struct agent_expr *ax, int reg)
struct symbol * cp_lookup_symbol_namespace(const char *scope, const char *name, const struct block *block, const domain_enum domain)
int pointer_type(struct type *type)
LONGEST value_as_long(struct value *val)
static void gen_less(struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2, struct type *result_type)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
const char * decode_agent_options(const char *exp, int *trace_string)
#define TYPE_NAME(thistype)
int compile_internalvar_to_ax(struct internalvar *var, struct agent_expr *expr, struct axs_value *value)
struct ui_file * gdb_stdout
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
#define SYMBOL_CLASS(symbol)
void internal_error(const char *file, int line, const char *fmt,...)
int binop_types_user_defined_p(enum exp_opcode op, struct type *type1, struct type *type2)
static void gen_offset(struct agent_expr *ax, int offset)
const struct language_defn * language_def(enum language lang)
static void agent_eval_command_one(const char *exp, int eval, CORE_ADDR pc)
static void gen_sym_offset(struct agent_expr *, struct symbol *)
struct symbol * block_linkage_function(const struct block *bl)
static void agent_command(char *exp, int from_tty)
static void gen_frame_args_address(struct gdbarch *, struct agent_expr *)
static int gen_namespace_elt(struct expression *exp, struct agent_expr *ax, struct axs_value *value, const struct type *curtype, char *name)
static void gen_deref(struct agent_expr *, struct axs_value *)
void ax_reg(struct agent_expr *x, int reg)
int gdbarch_num_regs(struct gdbarch *gdbarch)
char * skip_spaces(char *chp)
static void gen_fetch(struct agent_expr *, struct type *)
#define TYPE_FIELD(thistype, n)
#define bits(obj, st, fn)
struct symtabs_and_lines sals
#define BYTES_TO_EXP_ELEM(bytes)
struct agent_expr * gen_trace_for_var(CORE_ADDR scope, struct gdbarch *gdbarch, struct symbol *var, int trace_string)
#define TYPE_FIELD_TYPE(thistype, n)
const struct block * block_for_pc(CORE_ADDR pc)
static void gen_trace_static_fields(struct gdbarch *gdbarch, struct agent_expr *ax, struct type *type)
void ax_tsv(struct agent_expr *x, enum agent_op op, int num)
int longest_to_int(LONGEST)
static struct value * maybe_const_expr(union exp_element **pc)
static void gen_struct_ref(struct expression *exp, struct agent_expr *ax, struct axs_value *value, char *field, char *operator_name, char *operand_name)
static void gen_ptrsub(struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2)
int gdbarch_num_pseudo_regs(struct gdbarch *gdbarch)
char * op_name(struct expression *exp, enum exp_opcode opcode)
int check_for_argument(char **str, char *arg, int arg_len)
#define VEC_iterate(T, V, I, P)
struct type * check_typedef(struct type *type)
#define SYMBOL_VALUE_ADDRESS(symbol)
static int is_nontrivial_conversion(struct type *from, struct type *to)
static int gen_struct_ref_recursive(struct expression *exp, struct agent_expr *ax, struct axs_value *value, char *field, int offset, struct type *type)
static void gen_equal(struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2, struct type *result_type)
static struct type * max_type(struct type *type1, struct type *type2)
int field_is_static(struct field *f)
struct symbol * lookup_language_this(const struct language_defn *lang, const struct block *block)
const char * skip_spaces_const(const char *chp)
void gdbarch_gen_return_address(struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope)
struct type * register_type(struct gdbarch *gdbarch, int regnum)
struct expression * parse_exp_1(const char **, CORE_ADDR pc, const struct block *, int)
#define gdb_assert_not_reached(message)
int is_integral_type(struct type *t)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
void free_current_contents(void *ptr)
#define SYMBOL_REGISTER_OPS(symbol)
#define SYMBOL_COMPUTED_OPS(symbol)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
void ax_ext(struct agent_expr *x, int n)
static void gen_scale(struct agent_expr *ax, enum agent_op op, struct type *type)
void init_linespec_result(struct linespec_result *lr)
static void gen_static_field(struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, struct type *type, int fieldno)
void decode_line_full(char **argptr, int flags, struct symtab *default_symtab, int default_line, struct linespec_result *canonical, const char *select_mode, const char *filter)
void ax_string(struct agent_expr *x, const char *str, int slen)
void ax_label(struct agent_expr *x, int patch, int target)
static struct value * const_var_ref(struct symbol *var)
struct cleanup * make_cleanup_destroy_linespec_result(struct linespec_result *ls)
struct gdbarch * get_current_arch(void)
char * internalvar_name(struct internalvar *var)
struct agent_expr * gen_printf(CORE_ADDR scope, struct gdbarch *gdbarch, CORE_ADDR function, LONGEST channel, const char *format, int fmtlen, struct format_piece *frags, int nargs, struct expression **exprs)
struct value * value_from_longest(struct type *type, LONGEST num)
#define SYMBOL_LINKAGE_NAME(symbol)
void ax_simple(struct agent_expr *x, enum agent_op op)
struct type * builtin_long
static void gen_usual_arithmetic(struct expression *exp, struct agent_expr *ax, struct axs_value *value1, struct axs_value *value2)
static void maint_agent_printf_command(char *exp, int from_tty)
struct agent_expr * gen_eval_for_expr(CORE_ADDR scope, struct expression *expr)
static void gen_left_shift(struct agent_expr *, int)
#define TYPE_BASECLASS(thistype, index)
#define TYPE_FIELD_PACKED(thistype, n)
static struct value * const_expr(union exp_element **pc)
int user_reg_map_name_to_regnum(struct gdbarch *gdbarch, const char *name, int len)
static const char * namespace_name(struct die_info *die, int *is_anonymous, struct dwarf2_cu *)
static void gen_usual_unary(struct expression *exp, struct agent_expr *ax, struct axs_value *value)
#define TYPE_FIELD_BITSIZE(thistype, n)
#define TYPE_FIELD_BITPOS(thistype, n)
static void gen_bitfield_ref(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *type, int start, int end)
void gen_expr(struct expression *exp, union exp_element **pc, struct agent_expr *ax, struct axs_value *value)
#define SYMBOL_VALUE(symbol)
static void gen_integral_promotions(struct expression *exp, struct agent_expr *ax, struct axs_value *value)
static void gen_complement(struct agent_expr *ax, struct axs_value *value)
void ax_print(struct ui_file *f, struct agent_expr *x)
static void gen_traced_pop(struct gdbarch *, struct agent_expr *, struct axs_value *)
static int gen_aggregate_elt_ref(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *type, char *field, char *operator_name, char *operand_name)
static void gen_sign_extend(struct agent_expr *, struct type *)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
void discard_cleanups(struct cleanup *old_chain)
#define TYPE_TARGET_TYPE(thistype)
struct value * value_neg(struct value *arg1)
static void gen_cast(struct agent_expr *ax, struct axs_value *value, struct type *type)
#define SYMBOL_BLOCK_VALUE(symbol)
#define TYPE_CODE(thistype)
void _initialize_ax_gdb(void)
struct minimal_symbol * minsym
struct agent_expr * new_agent_expr(struct gdbarch *gdbarch, CORE_ADDR scope)
struct symbol * lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
#define TYPE_NFIELDS(thistype)
struct value * evaluate_subexp(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
#define SYMBOL_LANGUAGE(symbol)
#define CHECK_TYPEDEF(TYPE)
void require_rvalue(struct agent_expr *ax, struct axs_value *value)
static void gen_int_literal(struct agent_expr *ax, struct axs_value *value, LONGEST k, struct type *type)
static int type_wider_than(struct type *type1, struct type *type2)
int c_textual_element_type(struct type *, char)
#define TYPE_TAG_NAME(type)
void ax_trace_quick(struct agent_expr *x, int n)
void ax_const_l(struct agent_expr *x, LONGEST l)
static int gen_struct_elt_for_reference(struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *type, char *fieldname)
enum overlay_debugging_state overlay_debugging
static void gen_ptrdiff(struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2, struct type *result_type)
struct type * builtin_long_long
static void gen_sizeof(struct expression *exp, union exp_element **pc, struct agent_expr *ax, struct axs_value *value, struct type *size_type)
struct trace_state_variable * find_trace_state_variable(const char *name)
struct type * value_type(const struct value *value)
#define SYMBOL_TYPE(symbol)
struct cmd_list_element * maintenancelist
static void gen_binop(struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2, enum agent_op op, enum agent_op op_unsigned, int may_carry, char *name)
static void gen_address_of(struct agent_expr *, struct axs_value *)
struct symtab_and_line * sals
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n)
void ax_zero_ext(struct agent_expr *x, int n)
#define TYPE_LENGTH(thistype)
#define TYPE_BASECLASS_BITPOS(thistype, index)
static int gen_maybe_namespace_elt(struct expression *exp, struct agent_expr *ax, struct axs_value *value, const struct type *curtype, char *name)
#define TYPE_FIELD_LOC_KIND(thistype, n)
static void gen_repeat(struct expression *exp, union exp_element **pc, struct agent_expr *ax, struct axs_value *value)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
enum axs_lvalue_kind kind
void gdbarch_virtual_frame_pointer(struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
static void gen_expr_binop_rest(struct expression *exp, enum exp_opcode op, union exp_element **pc, struct agent_expr *ax, struct axs_value *value, struct axs_value *value1, struct axs_value *value2)
void error(const char *fmt,...)
static void gen_frame_locals_address(struct gdbarch *, struct agent_expr *)
struct type * lookup_pointer_type(struct type *type)
struct agent_expr * gen_trace_for_return_address(CORE_ADDR scope, struct gdbarch *gdbarch, int trace_string)
void do_cleanups(struct cleanup *old_chain)
struct agent_expr * gen_trace_for_expr(CORE_ADDR scope, struct expression *expr, int trace_string)
struct type * builtin_int