static struct value *const_expr (union exp_element **pc);
static struct value *maybe_const_expr (union exp_element **pc);
-static void gen_traced_pop (struct gdbarch *, struct agent_expr *,
- struct axs_value *);
+static void gen_traced_pop (struct agent_expr *, struct axs_value *);
static void gen_sign_extend (struct agent_expr *, struct type *);
static void gen_extend (struct agent_expr *, struct type *);
static void gen_left_shift (struct agent_expr *, int);
-static void gen_frame_args_address (struct gdbarch *, struct agent_expr *);
-static void gen_frame_locals_address (struct gdbarch *, struct agent_expr *);
+static void gen_frame_args_address (struct agent_expr *);
+static void gen_frame_locals_address (struct agent_expr *);
static void gen_offset (struct agent_expr *ax, int offset);
static void gen_sym_offset (struct agent_expr *, struct symbol *);
-static void gen_var_ref (struct gdbarch *, struct agent_expr *ax,
- struct axs_value *value, struct symbol *var);
+static void gen_var_ref (struct agent_expr *ax, struct axs_value *value,
+ struct symbol *var);
static void gen_int_literal (struct agent_expr *ax,
const char *field,
const char *operator_name,
const char *operand_name);
-static void gen_static_field (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
+static void gen_static_field (struct agent_expr *ax, struct axs_value *value,
struct type *type, int fieldno);
static void gen_repeat (struct expression *exp, union exp_element **pc,
struct agent_expr *ax, struct axs_value *value);
classes, and generate tracing bytecodes for each. */
static void
-gen_trace_static_fields (struct gdbarch *gdbarch,
- struct agent_expr *ax,
+gen_trace_static_fields (struct agent_expr *ax,
struct type *type)
{
int i, nbases = TYPE_N_BASECLASSES (type);
{
if (field_is_static (&TYPE_FIELD (type, i)))
{
- gen_static_field (gdbarch, ax, &value, type, i);
+ gen_static_field (ax, &value, type, i);
if (value.optimized_out)
continue;
switch (value.kind)
{
struct type *basetype = check_typedef (TYPE_BASECLASS (type, i));
- gen_trace_static_fields (gdbarch, ax, basetype);
+ gen_trace_static_fields (ax, basetype);
}
}
the value. Useful on the left side of a comma, and at the end of
an expression being used for tracing. */
static void
-gen_traced_pop (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value)
+gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
{
int string_trace = 0;
if (ax->trace_string
if (ax->tracing
&& (TYPE_CODE (value->type) == TYPE_CODE_STRUCT
|| TYPE_CODE (value->type) == TYPE_CODE_UNION))
- gen_trace_static_fields (gdbarch, ax, value->type);
+ gen_trace_static_fields (ax, value->type);
}
\f
/* Generate code to push the base address of the argument portion of
the top stack frame. */
static void
-gen_frame_args_address (struct gdbarch *gdbarch, struct agent_expr *ax)
+gen_frame_args_address (struct agent_expr *ax)
{
int frame_reg;
LONGEST frame_offset;
- gdbarch_virtual_frame_pointer (gdbarch,
+ gdbarch_virtual_frame_pointer (ax->gdbarch,
ax->scope, &frame_reg, &frame_offset);
ax_reg (ax, frame_reg);
gen_offset (ax, frame_offset);
/* Generate code to push the base address of the locals portion of the
top stack frame. */
static void
-gen_frame_locals_address (struct gdbarch *gdbarch, struct agent_expr *ax)
+gen_frame_locals_address (struct agent_expr *ax)
{
int frame_reg;
LONGEST frame_offset;
- gdbarch_virtual_frame_pointer (gdbarch,
+ gdbarch_virtual_frame_pointer (ax->gdbarch,
ax->scope, &frame_reg, &frame_offset);
ax_reg (ax, frame_reg);
gen_offset (ax, frame_offset);
symbol VAR. Set VALUE to describe the result. */
static void
-gen_var_ref (struct gdbarch *gdbarch, struct agent_expr *ax,
- struct axs_value *value, struct symbol *var)
+gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
{
/* Dereference any typedefs. */
value->type = check_typedef (SYMBOL_TYPE (var));
if (SYMBOL_COMPUTED_OPS (var) != NULL)
{
- SYMBOL_COMPUTED_OPS (var)->tracepoint_var_ref (var, gdbarch, ax, value);
+ SYMBOL_COMPUTED_OPS (var)->tracepoint_var_ref (var, ax, value);
return;
}
break;
case LOC_ARG: /* var lives in argument area of frame */
- gen_frame_args_address (gdbarch, ax);
+ gen_frame_args_address (ax);
gen_sym_offset (ax, var);
value->kind = axs_lvalue_memory;
break;
case LOC_REF_ARG: /* As above, but the frame slot really
holds the address of the variable. */
- gen_frame_args_address (gdbarch, ax);
+ gen_frame_args_address (ax);
gen_sym_offset (ax, var);
/* Don't assume any particular pointer size. */
- gen_fetch (ax, builtin_type (gdbarch)->builtin_data_ptr);
+ gen_fetch (ax, builtin_type (ax->gdbarch)->builtin_data_ptr);
value->kind = axs_lvalue_memory;
break;
case LOC_LOCAL: /* var lives in locals area of frame */
- gen_frame_locals_address (gdbarch, ax);
+ gen_frame_locals_address (ax);
gen_sym_offset (ax, var);
value->kind = axs_lvalue_memory;
break;
this as an lvalue or rvalue, the caller will generate the
right code. */
value->kind = axs_lvalue_register;
- value->u.reg = SYMBOL_REGISTER_OPS (var)->register_number (var, gdbarch);
+ value->u.reg
+ = SYMBOL_REGISTER_OPS (var)->register_number (var, ax->gdbarch);
break;
/* A lot like LOC_REF_ARG, but the pointer lives directly in a
because it's just like any other case where the thing
has a real address. */
case LOC_REGPARM_ADDR:
- ax_reg (ax, SYMBOL_REGISTER_OPS (var)->register_number (var, gdbarch));
+ ax_reg (ax,
+ SYMBOL_REGISTER_OPS (var)->register_number (var, ax->gdbarch));
value->kind = axs_lvalue_memory;
break;
being handled as a global. */
if (field_is_static (&TYPE_FIELD (type, i)))
{
- gen_static_field (ax->gdbarch, ax, value, type, i);
+ gen_static_field (ax, value, type, i);
if (value->optimized_out)
error (_("static field `%s' has been "
"optimized out, cannot use"),
const struct type *curtype, char *name);
static void
-gen_static_field (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
+gen_static_field (struct agent_expr *ax, struct axs_value *value,
struct type *type, int fieldno)
{
if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
if (sym)
{
- gen_var_ref (gdbarch, ax, value, sym);
+ gen_var_ref (ax, value, sym);
/* Don't error if the value was optimized out, we may be
scanning all static fields and just want to pass over this
{
if (field_is_static (&TYPE_FIELD (t, i)))
{
- gen_static_field (ax->gdbarch, ax, value, t, i);
+ gen_static_field (ax, value, t, i);
if (value->optimized_out)
error (_("static field `%s' has been "
"optimized out, cannot use"),
if (sym.symbol == NULL)
return 0;
- gen_var_ref (ax->gdbarch, ax, value, sym.symbol);
+ gen_var_ref (ax, value, sym.symbol);
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
/* Don't just dispose of the left operand. We might be tracing,
in which case we want to emit code to trace it if it's an
lvalue. */
- gen_traced_pop (ax->gdbarch, ax, &value1);
+ gen_traced_pop (ax, &value1);
gen_expr (exp, pc, ax, value);
/* It's the consumer's responsibility to trace the right operand. */
break;
break;
case OP_VAR_VALUE:
- gen_var_ref (ax->gdbarch, ax, value, (*pc)[2].symbol);
+ gen_var_ref (ax, value, (*pc)[2].symbol);
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
if (!sym)
error (_("no `%s' found"), lang->la_name_of_this);
- gen_var_ref (ax->gdbarch, ax, value, sym);
+ gen_var_ref (ax, value, sym);
if (value->optimized_out)
error (_("`%s' has been optimized out, cannot use"),
ax->tracing = 1;
ax->trace_string = trace_string;
- gen_var_ref (gdbarch, ax.get (), &value, var);
+ gen_var_ref (ax.get (), &value, var);
/* If there is no actual variable to trace, flag it by returning
an empty agent expression. */
return agent_expr_up ();
/* Make sure we record the final object, and get rid of it. */
- gen_traced_pop (gdbarch, ax.get (), &value);
+ gen_traced_pop (ax.get (), &value);
/* Oh, and terminate. */
ax_simple (ax.get (), aop_end);
gen_expr (expr, &pc, ax.get (), &value);
/* Make sure we record the final object, and get rid of it. */
- gen_traced_pop (expr->gdbarch, ax.get (), &value);
+ gen_traced_pop (ax.get (), &value);
/* Oh, and terminate. */
ax_simple (ax.get (), aop_end);
gdbarch_gen_return_address (gdbarch, ax.get (), &value, scope);
/* Make sure we record the final object, and get rid of it. */
- gen_traced_pop (gdbarch, ax.get (), &value);
+ gen_traced_pop (ax.get (), &value);
/* Oh, and terminate. */
ax_simple (ax.get (), aop_end);
void
dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
- struct gdbarch *arch, unsigned int addr_size,
- const gdb_byte *op_ptr, const gdb_byte *op_end,
+ unsigned int addr_size, const gdb_byte *op_ptr,
+ const gdb_byte *op_end,
struct dwarf2_per_cu_data *per_cu)
{
+ gdbarch *arch = expr->gdbarch;
int i;
std::vector<int> dw_labels, patches;
const gdb_byte * const base = op_ptr;
&datastart, &datalen);
op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
- dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart,
+ dwarf2_compile_expr_to_ax (expr, loc, addr_size, datastart,
datastart + datalen, per_cu);
if (loc->kind == axs_lvalue_register)
require_rvalue (expr, loc);
{
/* Another expression. */
ax_const_l (expr, text_offset);
- dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size,
- cfa_start, cfa_end, per_cu);
+ dwarf2_compile_expr_to_ax (expr, loc, addr_size, cfa_start,
+ cfa_end, per_cu);
}
loc->kind = axs_lvalue_memory;
/* DW_OP_call_ref is currently not supported. */
gdb_assert (block.per_cu == per_cu);
- dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size,
- block.data, block.data + block.size,
- per_cu);
+ dwarf2_compile_expr_to_ax (expr, loc, addr_size, block.data,
+ block.data + block.size, per_cu);
}
break;
any necessary bytecode in AX. */
static void
-locexpr_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value)
+locexpr_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
+ struct axs_value *value)
{
struct dwarf2_locexpr_baton *dlbaton
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol);
if (dlbaton->size == 0)
value->optimized_out = 1;
else
- dwarf2_compile_expr_to_ax (ax, value, gdbarch, addr_size,
- dlbaton->data, dlbaton->data + dlbaton->size,
- dlbaton->per_cu);
+ dwarf2_compile_expr_to_ax (ax, value, addr_size, dlbaton->data,
+ dlbaton->data + dlbaton->size, dlbaton->per_cu);
}
/* symbol_computed_ops 'generate_c_location' method. */
/* Describe the location of SYMBOL as an agent value in VALUE, generating
any necessary bytecode in AX. */
static void
-loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value)
+loclist_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
+ struct axs_value *value)
{
struct dwarf2_loclist_baton *dlbaton
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (symbol);
if (size == 0)
value->optimized_out = 1;
else
- dwarf2_compile_expr_to_ax (ax, value, gdbarch, addr_size, data, data + size,
+ dwarf2_compile_expr_to_ax (ax, value, addr_size, data, data + size,
dlbaton->per_cu);
}