+2013-12-06 Tom Tromey <tromey@redhat.com>
+
+ * break-catch-throw.c (fetch_probe_arguments): Use
+ get_probe_argument_count and evaluate_probe_argument.
+ * elfread.c (elf_get_probe_argument_count)
+ (elf_can_evaluate_probe_arguments, elf_evaluate_probe_argument)
+ (elf_compile_to_ax): Remove.
+ (elf_probe_fns): Update.
+ * probe.c (get_probe_argument_count, can_evaluate_probe_arguments)
+ (evaluate_probe_argument): Call method on probe, not via sym
+ functions.
+ * stap-probe.c (compute_probe_arg): Use get_probe_argument_count,
+ evaluate_probe_argument.
+ (compile_probe_arg): Use get_probe_argument_count. Call method on
+ probe, not via sym functions.
+ * symfile-debug.c (debug_sym_get_probe_argument_count)
+ (debug_can_evaluate_probe_arguments)
+ (debug_sym_evaluate_probe_argument, debug_sym_compile_to_ax):
+ Remove.
+ (debug_sym_probe_fns): Remove.
+ * symfile.h (struct sym_probe_fns) <sym_get_probe_argument_count,
+ can_evaluate_probe_arguments, sym_evaluate_probe_argument,
+ sym_compile_to_ax>: Remove fields.
+
2013-12-06 Pierre Muller <muller@sourceware.org>
Fix completion for pascal language.
&& strcmp (pc_probe->name, "rethrow") != 0))
error (_("not stopped at a C++ exception catchpoint"));
- gdb_assert (pc_probe->objfile != NULL);
- gdb_assert (pc_probe->objfile->sf != NULL);
- gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
-
- pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
- n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
+ n_args = get_probe_argument_count (pc_probe);
if (n_args < 2)
error (_("C++ exception catchpoint has too few arguments"));
if (arg0 != NULL)
- *arg0 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 0);
- *arg1 = pc_probe_fns->sym_evaluate_probe_argument (pc_probe, 1);
+ *arg0 = evaluate_probe_argument (pc_probe, 0);
+ *arg1 = evaluate_probe_argument (pc_probe, 1);
if ((arg0 != NULL && *arg0 == NULL) || *arg1 == NULL)
error (_("error computing probe argument at c++ exception catchpoint"));
return probes_per_objfile;
}
-/* Implementation of `sym_get_probe_argument_count', as documented in
- symfile.h. */
-
-static unsigned
-elf_get_probe_argument_count (struct probe *probe)
-{
- return probe->pops->get_probe_argument_count (probe);
-}
-
-/* Implementation of `sym_can_evaluate_probe_arguments', as documented in
- symfile.h. */
-
-static int
-elf_can_evaluate_probe_arguments (struct probe *probe)
-{
- return probe->pops->can_evaluate_probe_arguments (probe);
-}
-
-/* Implementation of `sym_evaluate_probe_argument', as documented in
- symfile.h. */
-
-static struct value *
-elf_evaluate_probe_argument (struct probe *probe, unsigned n)
-{
- return probe->pops->evaluate_probe_argument (probe, n);
-}
-
-/* Implementation of `sym_compile_to_ax', as documented in symfile.h. */
-
-static void
-elf_compile_to_ax (struct probe *probe,
- struct agent_expr *expr,
- struct axs_value *value,
- unsigned n)
-{
- probe->pops->compile_to_ax (probe, expr, value, n);
-}
-
/* Implementation of `sym_relocate_probe', as documented in symfile.h. */
static void
static const struct sym_probe_fns elf_probe_fns =
{
elf_get_probes, /* sym_get_probes */
- elf_get_probe_argument_count, /* sym_get_probe_argument_count */
- elf_can_evaluate_probe_arguments, /* sym_can_evaluate_probe_arguments */
- elf_evaluate_probe_argument, /* sym_evaluate_probe_argument */
- elf_compile_to_ax, /* sym_compile_to_ax */
elf_symfile_relocate_probe, /* sym_relocate_probe */
};
unsigned
get_probe_argument_count (struct probe *probe)
{
- const struct sym_probe_fns *probe_fns;
-
- gdb_assert (probe->objfile != NULL);
- gdb_assert (probe->objfile->sf != NULL);
-
- probe_fns = probe->objfile->sf->sym_probe_fns;
-
- gdb_assert (probe_fns != NULL);
-
- return probe_fns->sym_get_probe_argument_count (probe);
+ return probe->pops->get_probe_argument_count (probe);
}
/* See comments in probe.h. */
int
can_evaluate_probe_arguments (struct probe *probe)
{
- const struct sym_probe_fns *probe_fns;
-
- gdb_assert (probe->objfile != NULL);
- gdb_assert (probe->objfile->sf != NULL);
-
- probe_fns = probe->objfile->sf->sym_probe_fns;
-
- gdb_assert (probe_fns != NULL);
-
- return probe_fns->can_evaluate_probe_arguments (probe);
+ return probe->pops->can_evaluate_probe_arguments (probe);
}
/* See comments in probe.h. */
struct value *
evaluate_probe_argument (struct probe *probe, unsigned n)
{
- const struct sym_probe_fns *probe_fns;
-
- gdb_assert (probe->objfile != NULL);
- gdb_assert (probe->objfile->sf != NULL);
-
- probe_fns = probe->objfile->sf->sym_probe_fns;
-
- gdb_assert (probe_fns != NULL);
-
- return probe_fns->sym_evaluate_probe_argument (probe, n);
+ return probe->pops->evaluate_probe_argument (probe, n);
}
/* See comments in probe.h. */
if (pc_probe == NULL)
error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
- gdb_assert (pc_probe->objfile != NULL);
- gdb_assert (pc_probe->objfile->sf != NULL);
- gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
-
- pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
-
- n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
+ n_args = get_probe_argument_count (pc_probe);
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 pc_probe_fns->sym_evaluate_probe_argument (pc_probe, sel);
+ return evaluate_probe_argument (pc_probe, sel);
}
/* This is called to compile one of the $_probe_arg* convenience
if (pc_probe == NULL)
error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
- gdb_assert (pc_probe->objfile != NULL);
- gdb_assert (pc_probe->objfile->sf != NULL);
- gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
-
- pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
-
- n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
+ n_args = get_probe_argument_count (pc_probe);
if (sel == -1)
{
error (_("Invalid probe argument %d -- probe has %d arguments available"),
sel, n_args);
- pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel);
+ pc_probe->pops->compile_to_ax (pc_probe, expr, value, sel);
}
\f
return retval;
}
-static unsigned
-debug_sym_get_probe_argument_count (struct probe *probe)
-{
- struct objfile *objfile = probe->objfile;
- const struct debug_sym_fns_data *debug_data =
- objfile_data (objfile, symfile_debug_objfile_data_key);
- unsigned retval;
-
- retval = debug_data->real_sf->sym_probe_fns->sym_get_probe_argument_count
- (probe);
-
- fprintf_filtered (gdb_stdlog,
- "probes->sym_get_probe_argument_count (%s) = %u\n",
- host_address_to_string (probe), retval);
-
- return retval;
-}
-
-static int
-debug_can_evaluate_probe_arguments (struct probe *probe)
-{
- struct objfile *objfile = probe->objfile;
- const struct debug_sym_fns_data *debug_data =
- objfile_data (objfile, symfile_debug_objfile_data_key);
- int retval;
-
- retval = debug_data->real_sf->sym_probe_fns->can_evaluate_probe_arguments
- (probe);
-
- fprintf_filtered (gdb_stdlog,
- "probes->can_evaluate_probe_arguments (%s) = %d\n",
- host_address_to_string (probe), retval);
-
- return retval;
-}
-
-static struct value *
-debug_sym_evaluate_probe_argument (struct probe *probe, unsigned n)
-{
- struct objfile *objfile = probe->objfile;
- const struct debug_sym_fns_data *debug_data =
- objfile_data (objfile, symfile_debug_objfile_data_key);
- struct value *retval;
-
- fprintf_filtered (gdb_stdlog,
- "probes->sym_evaluate_probe_argument (%s, %u)\n",
- host_address_to_string (probe), n);
-
- retval = debug_data->real_sf->sym_probe_fns->sym_evaluate_probe_argument
- (probe, n);
-
- fprintf_filtered (gdb_stdlog,
- "probes->sym_evaluate_probe_argument (...) = %s\n",
- host_address_to_string (retval));
-
- return retval;
-}
-
-static void
-debug_sym_compile_to_ax (struct probe *probe, struct agent_expr *expr,
- struct axs_value *value, unsigned n)
-{
- struct objfile *objfile = probe->objfile;
- const struct debug_sym_fns_data *debug_data =
- objfile_data (objfile, symfile_debug_objfile_data_key);
-
- fprintf_filtered (gdb_stdlog,
- "probes->sym_compile_to_ax (%s, %s, %s, %u)\n",
- host_address_to_string (probe),
- host_address_to_string (expr),
- host_address_to_string (value), n);
-
- debug_data->real_sf->sym_probe_fns->sym_compile_to_ax
- (probe, expr, value, n);
-}
-
static void
debug_sym_relocate_probe (struct objfile *objfile,
const struct section_offsets *new_offsets,
static const struct sym_probe_fns debug_sym_probe_fns =
{
debug_sym_get_probes,
- debug_sym_get_probe_argument_count,
- debug_can_evaluate_probe_arguments,
- debug_sym_evaluate_probe_argument,
- debug_sym_compile_to_ax,
debug_sym_relocate_probe
};
\f
OBJFILE. */
VEC (probe_p) *(*sym_get_probes) (struct objfile *);
- /* Return the number of arguments available to PROBE. PROBE will
- have come from a call to this objfile's sym_get_probes method.
- If you provide an implementation of sym_get_probes, you must
- implement this method as well. */
- unsigned (*sym_get_probe_argument_count) (struct probe *probe);
-
- /* Return 1 if the probe interface can evaluate the arguments of probe
- PROBE, zero otherwise. This function can be probe-specific, informing
- whether only the arguments of PROBE can be evaluated, of generic,
- informing whether the probe interface is able to evaluate any kind of
- argument. If you provide an implementation of sym_get_probes, you must
- implement this method as well. */
- int (*can_evaluate_probe_arguments) (struct probe *probe);
-
- /* Evaluate the Nth argument available to PROBE. PROBE will have
- come from a call to this objfile's sym_get_probes method. N will
- be between 0 and the number of arguments available to this probe.
- FRAME is the frame in which the evaluation is done; the frame's
- PC will match the address of the probe. If you provide an
- implementation of sym_get_probes, you must implement this method
- as well. */
- struct value *(*sym_evaluate_probe_argument) (struct probe *probe,
- unsigned n);
-
- /* Compile the Nth probe argument to an agent expression. PROBE
- will have come from a call to this objfile's sym_get_probes
- method. N will be between 0 and the number of arguments
- available to this probe. EXPR and VALUE are the agent expression
- that is being updated. */
- void (*sym_compile_to_ax) (struct probe *probe,
- struct agent_expr *expr,
- struct axs_value *value,
- unsigned n);
-
/* Relocate the probe section of OBJFILE. */
void (*sym_relocate_probe) (struct objfile *objfile,
const struct section_offsets *new_offsets,