aboutsummaryrefslogtreecommitdiff
path: root/gdb/ax-gdb.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2009-12-24 00:40:49 +0000
committerStan Shebs <shebs@codesourcery.com>2009-12-24 00:40:49 +0000
commit0936ad1d22457136c65383681c475e5a0e30db14 (patch)
treebad643a7c7c251133e0e149127bd8776ce9f281e /gdb/ax-gdb.c
parent81e9e6e6ea739f403dd0a845e3613b3edc091109 (diff)
downloadgdb-0936ad1d22457136c65383681c475e5a0e30db14.zip
gdb-0936ad1d22457136c65383681c475e5a0e30db14.tar.gz
gdb-0936ad1d22457136c65383681c475e5a0e30db14.tar.bz2
2009-12-23 Stan Shebs <stan@codesourcery.com>
* ax-gdb.h (gen_trace_for_var): Declare. * ax-gdb.c (gen_trace_for_var): New function. * dwarf2loc.c (dwarf_expr_frame_base_1): New function, split from... (dwarf_expr_frame_base): ...here. (dwarf2_tracepoint_var_ref): Add computed location case. * tracepoint.c (collect_symbol): Add scope arg and LOC_COMPUTED case. (add_local_symbols): Update call to collect_symbol. (encode_actions): Ditto.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 999b27c..4d3f3ac 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1768,6 +1768,35 @@ gen_expr (struct expression *exp, union exp_element **pc,
}
+/* Given a single variable and a scope, generate bytecodes to trace
+ its value. This is for use in situations where we have only a
+ variable's name, and no parsed expression; for instance, when the
+ name comes from a list of local variables of a function. */
+
+struct agent_expr *
+gen_trace_for_var (CORE_ADDR scope, struct symbol *var)
+{
+ struct cleanup *old_chain = 0;
+ struct agent_expr *ax = new_agent_expr (scope);
+ struct axs_value value;
+
+ old_chain = make_cleanup_free_agent_expr (ax);
+
+ trace_kludge = 1;
+ gen_var_ref (NULL, ax, &value, var);
+
+ /* Make sure we record the final object, and get rid of it. */
+ gen_traced_pop (ax, &value);
+
+ /* Oh, and terminate. */
+ ax_simple (ax, aop_end);
+
+ /* We have successfully built the agent expr, so cancel the cleanup
+ request. If we add more cleanups that we always want done, this
+ will have to get more complicated. */
+ discard_cleanups (old_chain);
+ return ax;
+}
/* Generating bytecode from GDB expressions: driver */