/* To make sense of this file, you should read doc/agentexpr.texi.
Then look at the types and enums in ax-gdb.h. For the code itself,
/* To make sense of this file, you should read doc/agentexpr.texi.
Then look at the types and enums in ax-gdb.h. For the code itself,
{
gen_static_field (ax, &value, type, i);
if (value.optimized_out)
{
gen_static_field (ax, &value, type, i);
if (value.optimized_out)
type. Error out and give callers a chance to handle the failure
gracefully. */
error (_("gen_fetch: Unsupported type code `%s'."),
type. Error out and give callers a chance to handle the failure
gracefully. */
error (_("gen_fetch: Unsupported type code `%s'."),
/* Push the address of the variable. */
ax_const_l (ax, BMSYMBOL_VALUE_ADDRESS (msym));
/* Push the address of the variable. */
ax_const_l (ax, BMSYMBOL_VALUE_ADDRESS (msym));
/* Only deal with scalars, structs and such may be too large
to fit in a stack entry. */
value->type = check_typedef (value->type);
/* Only deal with scalars, structs and such may be too large
to fit in a stack entry. */
value->type = check_typedef (value->type);
- if (TYPE_CODE (value->type) == TYPE_CODE_ARRAY
- || TYPE_CODE (value->type) == TYPE_CODE_STRUCT
- || TYPE_CODE (value->type) == TYPE_CODE_UNION
- || TYPE_CODE (value->type) == TYPE_CODE_FUNC)
+ if (value->type->code () == TYPE_CODE_ARRAY
+ || value->type->code () == TYPE_CODE_STRUCT
+ || value->type->code () == TYPE_CODE_UNION
+ || value->type->code () == TYPE_CODE_FUNC)
{
/* The ANSI integral promotions seem to work this way: Order the
integer types by size, and then by signedness: an n-bit
{
/* The ANSI integral promotions seem to work this way: Order the
integer types by size, and then by signedness: an n-bit
struct axs_value *value1, struct axs_value *value2)
{
gdb_assert (pointer_type (value1->type));
struct axs_value *value1, struct axs_value *value2)
{
gdb_assert (pointer_type (value1->type));
struct axs_value *value1, struct axs_value *value2)
{
gdb_assert (pointer_type (value1->type));
struct axs_value *value1, struct axs_value *value2)
{
gdb_assert (pointer_type (value1->type));
int may_carry, const char *name)
{
/* We only handle INT op INT. */
int may_carry, const char *name)
{
/* We only handle INT op INT. */
gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type)
{
gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type)
{
error (_("Invalid type of operand to `!'."));
ax_simple (ax, aop_log_not);
error (_("Invalid type of operand to `!'."));
ax_simple (ax, aop_log_not);
error (_("Invalid type of operand to `~'."));
ax_simple (ax, aop_bit_not);
error (_("Invalid type of operand to `~'."));
ax_simple (ax, aop_bit_not);
T" to "T", and mark the value as an lvalue in memory. Leave it
to the consumer to actually dereference it. */
value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
T" to "T", and mark the value as an lvalue in memory. Leave it
to the consumer to actually dereference it. */
value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
/* Special case for taking the address of a function. The ANSI
standard describes this as a special case, too, so this
arrangement is not without motivation. */
/* Special case for taking the address of a function. The ANSI
standard describes this as a special case, too, so this
arrangement is not without motivation. */
/* The value's already an rvalue on the stack, so we just need to
change the type. */
value->type = lookup_pointer_type (value->type);
/* The value's already an rvalue on the stack, so we just need to
change the type. */
value->type = lookup_pointer_type (value->type);
{
/* Is this a bitfield? */
if (TYPE_FIELD_PACKED (type, fieldno))
{
/* Is this a bitfield? */
if (TYPE_FIELD_PACKED (type, fieldno))
- gen_bitfield_ref (ax, value, TYPE_FIELD_TYPE (type, fieldno),
+ gen_bitfield_ref (ax, value, type->field (fieldno).type (),
(offset * TARGET_CHAR_BIT
+ TYPE_FIELD_BITPOS (type, fieldno)),
(offset * TARGET_CHAR_BIT
(offset * TARGET_CHAR_BIT
+ TYPE_FIELD_BITPOS (type, fieldno)),
(offset * TARGET_CHAR_BIT
gen_offset (ax, offset
+ TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT);
value->kind = axs_lvalue_memory;
gen_offset (ax, offset
+ TYPE_FIELD_BITPOS (type, fieldno) / TARGET_CHAR_BIT);
value->kind = axs_lvalue_memory;
"this") will have been generated already, which will
be unnecessary but not harmful if the static field is
being handled as a global. */
"this") will have been generated already, which will
be unnecessary but not harmful if the static field is
being handled as a global. */
{
gen_static_field (ax, value, type, i);
if (value->optimized_out)
{
gen_static_field (ax, value, type, i);
if (value->optimized_out)
error (_("The left operand of `%s' is not a %s."),
operator_name, operand_name);
error (_("The left operand of `%s' is not a %s."),
operator_name, operand_name);
{
ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
value->kind = axs_lvalue_memory;
{
ax_const_l (ax, TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
value->kind = axs_lvalue_memory;
internal_error (__FILE__, __LINE__,
_("non-aggregate type to gen_struct_elt_for_reference"));
internal_error (__FILE__, __LINE__,
_("non-aggregate type to gen_struct_elt_for_reference"));
{
const char *t_field_name = TYPE_FIELD_NAME (t, i);
if (t_field_name && strcmp (t_field_name, fieldname) == 0)
{
{
const char *t_field_name = TYPE_FIELD_NAME (t, i);
if (t_field_name && strcmp (t_field_name, fieldname) == 0)
{
{
gen_static_field (ax, value, t, i);
if (value->optimized_out)
{
gen_static_field (ax, value, t, i);
if (value->optimized_out)
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
const struct type *curtype, char *name)
{
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
const struct type *curtype, char *name)
{
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
struct type *type, char *field)
{
gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
struct type *type, char *field)
{
if (!v)
error (_("Right operand of `@' must be a "
"constant, in agent expressions."));
if (!v)
error (_("Right operand of `@' must be a "
"constant, in agent expressions."));
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
}
else
gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
}
else
gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
gen_expr (exp, pc, ax, &value3);
gen_usual_unary (ax, &value3);
ax_label (ax, end, ax->len);
gen_expr (exp, pc, ax, &value3);
gen_usual_unary (ax, &value3);
ax_label (ax, end, ax->len);
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
- if (TYPE_CODE (value->type) == TYPE_CODE_ERROR)
- error_unknown_type (SYMBOL_PRINT_NAME ((*pc)[2].symbol));
+ if (value->type->code () == TYPE_CODE_ERROR)
+ error_unknown_type ((*pc)[2].symbol->print_name ());
case OP_VAR_MSYM_VALUE:
gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
case OP_VAR_MSYM_VALUE:
gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
- if (TYPE_CODE (value->type) == TYPE_CODE_ERROR)
- error_unknown_type (MSYMBOL_PRINT_NAME ((*pc)[2].msymbol));
+ if (value->type->code () == TYPE_CODE_ERROR)
+ error_unknown_type ((*pc)[2].msymbol->linkage_name ());
internal_error (__FILE__, __LINE__,
_("Register $%s not available"), name);
/* No support for tracing user registers yet. */
internal_error (__FILE__, __LINE__,
_("Register $%s not available"), name);
/* No support for tracing user registers yet. */
error (_("'%s' is a user-register; "
"GDB cannot yet trace user-register contents."),
name);
error (_("'%s' is a user-register; "
"GDB cannot yet trace user-register contents."),
name);
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
gen_ptradd (ax, value, value2, value1);
}
else if (pointer_type (value1->type)
gen_ptradd (ax, value, value2, value1);
}
else if (pointer_type (value1->type)
gen_ptradd (ax, value, value1, value2);
else
gen_binop (ax, value, value1, value2,
gen_ptradd (ax, value, value1, value2);
else
gen_binop (ax, value, value1, value2,
gen_ptrsub (ax,value, value1, value2);
else if (pointer_type (value1->type)
&& pointer_type (value2->type))
gen_ptrsub (ax,value, value1, value2);
else if (pointer_type (value1->type)
&& pointer_type (value2->type))
an array or pointer type (like a plain int variable for
example), then report this as an error. */
type = check_typedef (value1->type);
an array or pointer type (like a plain int variable for
example), then report this as an error. */
type = check_typedef (value1->type);
gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
CORE_ADDR function, LONGEST channel,
const char *format, int fmtlen,
gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
CORE_ADDR function, LONGEST channel,
const char *format, int fmtlen,
int nargs, struct expression **exprs)
{
agent_expr_up ax (new agent_expr (gdbarch, scope));
int nargs, struct expression **exprs)
{
agent_expr_up ax (new agent_expr (gdbarch, scope));
- exp = skip_spaces (exp);
-
- event_location_up location = new_linespec_location (&exp);
+ event_location_up location
+ = new_linespec_location (&exp, symbol_name_match_type::WILD);
decode_line_full (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
decode_line_full (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
struct frame_info *fi = get_current_frame (); /* need current scope */
const char *format_start, *format_end;
struct frame_info *fi = get_current_frame (); /* need current scope */
const char *format_start, *format_end;
/* We don't deal with overlay debugging at the moment. We need to
think more carefully about this. If you copy this code into
/* We don't deal with overlay debugging at the moment. We need to
think more carefully about this. If you copy this code into
while (*cmdrest != '\0')
{
const char *cmd1;
cmd1 = cmdrest;
expression_up expr = parse_exp_1 (&cmd1, 0, (struct block *) 0, 1);
while (*cmdrest != '\0')
{
const char *cmd1;
cmd1 = cmdrest;
expression_up expr = parse_exp_1 (&cmd1, 0, (struct block *) 0, 1);
agent_expr_up agent = gen_printf (get_frame_pc (fi), get_current_arch (),
0, 0,
format_start, format_end - format_start,
agent_expr_up agent = gen_printf (get_frame_pc (fi), get_current_arch (),
0, 0,
format_start, format_end - format_start,
ax_reqs (agent.get ());
ax_print (gdb_stdout, agent.get ());
/* It would be nice to call ax_reqs here to gather some general info
about the expression, and then print out the result. */
ax_reqs (agent.get ());
ax_print (gdb_stdout, agent.get ());
/* It would be nice to call ax_reqs here to gather some general info
about the expression, and then print out the result. */
{
add_cmd ("agent", class_maintenance, agent_command,
_("\
Translate an expression into remote agent bytecode for tracing.\n\
{
add_cmd ("agent", class_maintenance, agent_command,
_("\
Translate an expression into remote agent bytecode for tracing.\n\
If -at is given, generate remote agent bytecode for this location.\n\
If not, generate remote agent bytecode for current frame pc address."),
&maintenancelist);
If -at is given, generate remote agent bytecode for this location.\n\
If not, generate remote agent bytecode for current frame pc address."),
&maintenancelist);
add_cmd ("agent-eval", class_maintenance, agent_eval_command,
_("\
Translate an expression into remote agent bytecode for evaluation.\n\
add_cmd ("agent-eval", class_maintenance, agent_eval_command,
_("\
Translate an expression into remote agent bytecode for evaluation.\n\
If -at is given, generate remote agent bytecode for this location.\n\
If not, generate remote agent bytecode for current frame pc address."),
&maintenancelist);
If -at is given, generate remote agent bytecode for this location.\n\
If not, generate remote agent bytecode for current frame pc address."),
&maintenancelist);