2010-04-23 Stan Shebs <stan@codesourcery.com>

* ax.h (struct agent_expr): Merge in agent_reqs fields, add some
	comments.
	(struct agent_reqs): Remove.
	(ax_reg_mask): Declare.
	* ax-general.c (new_agent_expr): Add gdbarch argument, set new fields.
	(free_agent_expr): Free reg_mask.
	(ax_print): Add scope and register mask info.
	(ax_reqs): Remove agent_reqs argument, use agent expression
	fields, and move part of register mask computation to...
	(ax_reg_mask): New function.
	* ax-gdb.c (gen_trace_static_fields): Call it.
	(gen_traced_pop): Ditto.
	(is_nontrivial_conversion): Add dummy gdbarch to new_agent_expr.
	(gen_trace_for_var): Pass gdbarch to new_agent_expr.
	(gen_trace_for_expr): Ditto, and clear optimized_out flag.
	(gen_eval_for_expr): Ditto, and require an rvalue.
	(agent_command): Call ax_reqs.
	(agent_eval_command): Ditto.
	* tracepoint.c (report_agent_reqs_errors): Use agent expression fields.
	(validate_action_line): Ditto.
	(collect_symbol): Ditto.
	(encode_actions_1): Ditto.
This commit is contained in:
Stan Shebs 2010-04-23 23:51:05 +00:00
parent 492928e407
commit 35c9c7ba77
5 changed files with 206 additions and 168 deletions

View file

@ -363,10 +363,9 @@ gen_trace_static_fields (struct gdbarch *gdbarch,
break;
case axs_lvalue_register:
/* We need to mention the register somewhere in the bytecode,
so ax_reqs will pick it up and add it to the mask of
registers used. */
ax_reg (ax, value.u.reg);
/* We don't actually need the register's value to be pushed,
just note that we need it to be collected. */
ax_reg_mask (ax, value.u.reg);
default:
break;
@ -414,11 +413,11 @@ gen_traced_pop (struct gdbarch *gdbarch,
break;
case axs_lvalue_register:
/* We need to mention the register somewhere in the bytecode,
so ax_reqs will pick it up and add it to the mask of
registers used. */
ax_reg (ax, value->u.reg);
ax_simple (ax, aop_pop);
/* We don't actually need the register's value to be on the
stack, and the target will get heartburn if the register is
larger than will fit in a stack, so just mark it for
collection and be done with it. */
ax_reg_mask (ax, value->u.reg);
break;
}
else
@ -898,7 +897,7 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
static int
is_nontrivial_conversion (struct type *from, struct type *to)
{
struct agent_expr *ax = new_agent_expr (0);
struct agent_expr *ax = new_agent_expr (NULL, 0);
int nontrivial;
/* Actually generate the code, and see if anything came out. At the
@ -2324,7 +2323,7 @@ gen_trace_for_var (CORE_ADDR scope, struct gdbarch *gdbarch,
struct symbol *var)
{
struct cleanup *old_chain = 0;
struct agent_expr *ax = new_agent_expr (scope);
struct agent_expr *ax = new_agent_expr (gdbarch, scope);
struct axs_value value;
old_chain = make_cleanup_free_agent_expr (ax);
@ -2364,7 +2363,7 @@ struct agent_expr *
gen_trace_for_expr (CORE_ADDR scope, struct expression *expr)
{
struct cleanup *old_chain = 0;
struct agent_expr *ax = new_agent_expr (scope);
struct agent_expr *ax = new_agent_expr (expr->gdbarch, scope);
union exp_element *pc;
struct axs_value value;
@ -2372,6 +2371,7 @@ gen_trace_for_expr (CORE_ADDR scope, struct expression *expr)
pc = expr->elts;
trace_kludge = 1;
value.optimized_out = 0;
gen_expr (expr, &pc, ax, &value);
/* Make sure we record the final object, and get rid of it. */
@ -2398,7 +2398,7 @@ struct agent_expr *
gen_eval_for_expr (CORE_ADDR scope, struct expression *expr)
{
struct cleanup *old_chain = 0;
struct agent_expr *ax = new_agent_expr (scope);
struct agent_expr *ax = new_agent_expr (expr->gdbarch, scope);
union exp_element *pc;
struct axs_value value;
@ -2406,8 +2406,11 @@ gen_eval_for_expr (CORE_ADDR scope, struct expression *expr)
pc = expr->elts;
trace_kludge = 0;
value.optimized_out = 0;
gen_expr (expr, &pc, ax, &value);
require_rvalue (ax, &value);
/* Oh, and terminate. */
ax_simple (ax, aop_end);
@ -2440,6 +2443,7 @@ agent_command (char *exp, int from_tty)
old_chain = make_cleanup (free_current_contents, &expr);
agent = gen_trace_for_expr (get_frame_pc (fi), expr);
make_cleanup_free_agent_expr (agent);
ax_reqs (agent);
ax_print (gdb_stdout, agent);
/* It would be nice to call ax_reqs here to gather some general info
@ -2475,6 +2479,7 @@ agent_eval_command (char *exp, int from_tty)
old_chain = make_cleanup (free_current_contents, &expr);
agent = gen_eval_for_expr (get_frame_pc (fi), expr);
make_cleanup_free_agent_expr (agent);
ax_reqs (agent);
ax_print (gdb_stdout, agent);
/* It would be nice to call ax_reqs here to gather some general info