+2013-12-11 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * break-catch-throw.c (fetch_probe_arguments): Pass selected frame
+ to get_probe_argument_count and evaluate_probe_argument.
+ * probe.c (get_probe_argument_count): Adjust declaration to accept
+ frame. Pass frame to probe_ops's get_probe_argument_count.
+ (evaluate_probe_argument): Likewise, for evaluate_probe_argument.
+ (probe_safe_evaluate_at_pc): Pass frame to
+ get_probe_argument_count and evaluate_probe_argument.
+ * probe.h (struct probe_ops) <get_probe_argument_count,
+ evaluate_probe_argument>: Adjust declarations to accept frame.
+ (get_probe_argument_count, evaluate_probe_argument): Likewise.
+ * solib-svr4.c (solib_event_probe_action): Get current frame.
+ Pass it to get_probe_argument_count.
+ (svr4_handle_solib_event): Get current frame. Pass it to
+ get_probe_argument_count and evaluate_probe_argument.
+ * stap-probe.c (stap_parse_probe_arguments): Adjust declaration to
+ accept gdbarch. Do not obtain it from the probe's objfile.
+ (stap_get_probe_argument_count): Adjust declaration to accept
+ frame. Obtain gdbarch from the frame. Call generic
+ can_evaluate_probe_arguments. Pass gdbarch to
+ stap_parse_probe_arguments.
+ (stap_get_arg): Adjust declaration to accept gdbarch. Pass it to
+ stap_parse_probe_arguments.
+ (stap_evaluate_probe_argument): Adjust declaration to accept
+ frame. Obtain gdbarch from the frame. Pass gdbarch to
+ stap_get_arg.
+ (stap_compile_to_ax): Pass agent_expr's gdbarch to stap_get_arg.
+ (compute_probe_arg): Obtain gdbarch from frame. Pass frame to
+ get_probe_argument_count and evaluate_probe_argument.
+
2013-12-10 Doug Evans <dje@google.com>
PR 16286
&& strcmp (pc_probe->name, "rethrow") != 0))
error (_("not stopped at a C++ exception catchpoint"));
- n_args = get_probe_argument_count (pc_probe);
+ n_args = get_probe_argument_count (pc_probe, frame);
if (n_args < 2)
error (_("C++ exception catchpoint has too few arguments"));
if (arg0 != NULL)
- *arg0 = evaluate_probe_argument (pc_probe, 0);
- *arg1 = evaluate_probe_argument (pc_probe, 1);
+ *arg0 = evaluate_probe_argument (pc_probe, 0, frame);
+ *arg1 = evaluate_probe_argument (pc_probe, 1, frame);
if ((arg0 != NULL && *arg0 == NULL) || *arg1 == NULL)
error (_("error computing probe argument at c++ exception catchpoint"));
/* See comments in probe.h. */
unsigned
-get_probe_argument_count (struct probe *probe)
+get_probe_argument_count (struct probe *probe, struct frame_info *frame)
{
- return probe->pops->get_probe_argument_count (probe);
+ return probe->pops->get_probe_argument_count (probe, frame);
}
/* See comments in probe.h. */
/* See comments in probe.h. */
struct value *
-evaluate_probe_argument (struct probe *probe, unsigned n)
+evaluate_probe_argument (struct probe *probe, unsigned n,
+ struct frame_info *frame)
{
- return probe->pops->evaluate_probe_argument (probe, n);
+ return probe->pops->evaluate_probe_argument (probe, n, frame);
}
/* See comments in probe.h. */
if (!probe)
return NULL;
- n_args = get_probe_argument_count (probe);
+ n_args = get_probe_argument_count (probe, frame);
if (n >= n_args)
return NULL;
- return evaluate_probe_argument (probe, n);
+ return evaluate_probe_argument (probe, n, frame);
}
/* See comment in probe.h. */
/* Return the number of arguments of PROBE. */
- unsigned (*get_probe_argument_count) (struct probe *probe);
+ unsigned (*get_probe_argument_count) (struct probe *probe,
+ struct frame_info *frame);
/* Return 1 if the probe interface can evaluate the arguments of probe
PROBE, zero otherwise. See the comments on
corresponding to it. The argument number is represented N. */
struct value *(*evaluate_probe_argument) (struct probe *probe,
- unsigned n);
+ unsigned n,
+ struct frame_info *frame);
/* Compile the Nth argument of the PROBE to an agent expression.
The argument number is represented by N. */
/* Return the argument count of the specified probe. */
-extern unsigned get_probe_argument_count (struct probe *probe);
+extern unsigned get_probe_argument_count (struct probe *probe,
+ struct frame_info *frame);
/* Return 1 if the probe interface associated with PROBE can evaluate
arguments, zero otherwise. See the comments on the definition of
inclusive and get_probe_argument_count exclusive. */
extern struct value *evaluate_probe_argument (struct probe *probe,
- unsigned n);
+ unsigned n,
+ struct frame_info *frame);
/* A convenience function that finds a probe at the PC in FRAME and
evaluates argument N, with 0 <= N < number_of_args. If there is no
{
enum probe_action action;
unsigned probe_argc;
+ struct frame_info *frame = get_current_frame ();
action = pa->action;
if (action == DO_NOTHING || action == PROBES_INTERFACE_FAILED)
arg0: Lmid_t lmid (mandatory)
arg1: struct r_debug *debug_base (mandatory)
arg2: struct link_map *new (optional, for incremental updates) */
- probe_argc = get_probe_argument_count (pa->probe);
+ probe_argc = get_probe_argument_count (pa->probe, frame);
if (probe_argc == 2)
action = FULL_RELOAD;
else if (probe_argc < 2)
struct value *val;
CORE_ADDR pc, debug_base, lm = 0;
int is_initial_ns;
+ struct frame_info *frame = get_current_frame ();
/* Do nothing if not using the probes interface. */
if (info->probes_table == NULL)
usm_chain = make_cleanup (resume_section_map_updates_cleanup,
current_program_space);
- val = evaluate_probe_argument (pa->probe, 1);
+ val = evaluate_probe_argument (pa->probe, 1, frame);
if (val == NULL)
{
do_cleanups (old_chain);
if (action == UPDATE_OR_RELOAD)
{
- val = evaluate_probe_argument (pa->probe, 2);
+ val = evaluate_probe_argument (pa->probe, 2, frame);
if (val != NULL)
lm = value_as_address (val);
this information. */
static void
-stap_parse_probe_arguments (struct stap_probe *probe)
+stap_parse_probe_arguments (struct stap_probe *probe, struct gdbarch *gdbarch)
{
const char *cur;
- struct gdbarch *gdbarch = get_objfile_arch (probe->p.objfile);
gdb_assert (!probe->args_parsed);
cur = probe->args_u.text;
argument string. */
static unsigned
-stap_get_probe_argument_count (struct probe *probe_generic)
+stap_get_probe_argument_count (struct probe *probe_generic,
+ struct frame_info *frame)
{
struct stap_probe *probe = (struct stap_probe *) probe_generic;
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_assert (probe_generic->pops == &stap_probe_ops);
if (!probe->args_parsed)
{
- if (probe_generic->pops->can_evaluate_probe_arguments (probe_generic))
- stap_parse_probe_arguments (probe);
+ if (can_evaluate_probe_arguments (probe_generic))
+ stap_parse_probe_arguments (probe, gdbarch);
else
{
static int have_warned_stap_incomplete = 0;
}
static struct stap_probe_arg *
-stap_get_arg (struct stap_probe *probe, unsigned n)
+stap_get_arg (struct stap_probe *probe, unsigned n, struct gdbarch *gdbarch)
{
if (!probe->args_parsed)
- stap_parse_probe_arguments (probe);
+ stap_parse_probe_arguments (probe, gdbarch);
return VEC_index (stap_probe_arg_s, probe->args_u.vec, n);
}
corresponding to it. Assertion is thrown if N does not exist. */
static struct value *
-stap_evaluate_probe_argument (struct probe *probe_generic, unsigned n)
+stap_evaluate_probe_argument (struct probe *probe_generic, unsigned n,
+ struct frame_info *frame)
{
struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
+ struct gdbarch *gdbarch = get_frame_arch (frame);
struct stap_probe_arg *arg;
int pos = 0;
gdb_assert (probe_generic->pops == &stap_probe_ops);
- arg = stap_get_arg (stap_probe, n);
+ arg = stap_get_arg (stap_probe, n, gdbarch);
return evaluate_subexp_standard (arg->atype, arg->aexpr, &pos, EVAL_NORMAL);
}
gdb_assert (probe_generic->pops == &stap_probe_ops);
- arg = stap_get_arg (stap_probe, n);
+ arg = stap_get_arg (stap_probe, n, expr->gdbarch);
pc = arg->aexpr->elts;
gen_expr (arg->aexpr, &pc, expr, value);
if (pc_probe == NULL)
error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
- n_args = get_probe_argument_count (pc_probe);
+ n_args = get_probe_argument_count (pc_probe, frame);
if (sel == -1)
return value_from_longest (builtin_type (arch)->builtin_int, n_args);
error (_("Invalid probe argument %d -- probe has %u arguments available"),
sel, n_args);
- return evaluate_probe_argument (pc_probe, sel);
+ return evaluate_probe_argument (pc_probe, sel, frame);
}
/* This is called to compile one of the $_probe_arg* convenience
struct probe *pc_probe;
const struct sym_probe_fns *pc_probe_fns;
int n_args;
+ struct frame_info *frame = get_selected_frame (NULL);
/* SEL == -1 means "_probe_argc". */
gdb_assert (sel >= -1);
if (pc_probe == NULL)
error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
- n_args = get_probe_argument_count (pc_probe);
+ n_args = get_probe_argument_count (pc_probe, frame);
if (sel == -1)
{