summaryrefslogtreecommitdiff
path: root/gdb/ax-gdb.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@apple.com>2010-04-23 23:51:03 +0000
committerStan Shebs <shebs@apple.com>2010-04-23 23:51:03 +0000
commit962ef09016ec455e5ef6cc64a679b1b952e69cf8 (patch)
tree37e2e7fea3fbb31f588658a065745c91575883b0 /gdb/ax-gdb.c
parentf8569191b8297ea4ebcc6f4c57fa7a805ed2cdc0 (diff)
downloadgdb-962ef09016ec455e5ef6cc64a679b1b952e69cf8.tar.gz
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.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 1d4ec512941..ce33d1b9eaa 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -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