+/* Implementation of the `enable probes' command. */
+
+static void
+enable_probes_command (char *arg, int from_tty)
+{
+ char *provider, *probe_name = NULL, *objname = NULL;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
+ VEC (bound_probe_s) *probes;
+ struct bound_probe *probe;
+ int i;
+
+ parse_probe_linespec ((const char *) arg, &provider, &probe_name, &objname);
+ make_cleanup (xfree, provider);
+ make_cleanup (xfree, probe_name);
+ make_cleanup (xfree, objname);
+
+ probes = collect_probes (objname, provider, probe_name, NULL);
+ if (VEC_empty (bound_probe_s, probes))
+ {
+ ui_out_message (current_uiout, 0, _("No probes matched.\n"));
+ do_cleanups (cleanup);
+ return;
+ }
+
+ /* Enable the selected probes, provided their backends support the
+ notion of enabling a probe. */
+ for (i = 0; VEC_iterate (bound_probe_s, probes, i, probe); ++i)
+ {
+ const struct probe_ops *pops = probe->probe->pops;
+
+ if (pops->enable_probe != NULL)
+ {
+ pops->enable_probe (probe->probe);
+ ui_out_message (current_uiout, 0,
+ _("Probe %s:%s enabled.\n"),
+ probe->probe->provider, probe->probe->name);
+ }
+ else
+ ui_out_message (current_uiout, 0,
+ _("Probe %s:%s cannot be enabled.\n"),
+ probe->probe->provider, probe->probe->name);
+ }
+
+ do_cleanups (cleanup);
+}
+
+/* Implementation of the `disable probes' command. */
+
+static void
+disable_probes_command (char *arg, int from_tty)
+{
+ char *provider, *probe_name = NULL, *objname = NULL;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
+ VEC (bound_probe_s) *probes;
+ struct bound_probe *probe;
+ int i;
+
+ parse_probe_linespec ((const char *) arg, &provider, &probe_name, &objname);
+ make_cleanup (xfree, provider);
+ make_cleanup (xfree, probe_name);
+ make_cleanup (xfree, objname);
+
+ probes = collect_probes (objname, provider, probe_name, NULL /* pops */);
+ if (VEC_empty (bound_probe_s, probes))
+ {
+ ui_out_message (current_uiout, 0, _("No probes matched.\n"));
+ do_cleanups (cleanup);
+ return;
+ }
+
+ /* Disable the selected probes, provided their backends support the
+ notion of enabling a probe. */
+ for (i = 0; VEC_iterate (bound_probe_s, probes, i, probe); ++i)
+ {
+ const struct probe_ops *pops = probe->probe->pops;
+
+ if (pops->disable_probe != NULL)
+ {
+ pops->disable_probe (probe->probe);
+ ui_out_message (current_uiout, 0,
+ _("Probe %s:%s disabled.\n"),
+ probe->probe->provider, probe->probe->name);
+ }
+ else
+ ui_out_message (current_uiout, 0,
+ _("Probe %s:%s cannot be disabled.\n"),
+ probe->probe->provider, probe->probe->name);
+ }
+
+ do_cleanups (cleanup);
+}
+
+/* See comments in probe.h. */
+
+CORE_ADDR
+get_probe_address (struct probe *probe, struct objfile *objfile)
+{
+ return probe->pops->get_probe_address (probe, objfile);
+}
+
+/* See comments in probe.h. */
+
+unsigned
+get_probe_argument_count (struct probe *probe, struct frame_info *frame)
+{
+ return probe->pops->get_probe_argument_count (probe, frame);
+}
+
+/* See comments in probe.h. */
+
+int
+can_evaluate_probe_arguments (struct probe *probe)
+{
+ return probe->pops->can_evaluate_probe_arguments (probe);
+}
+
+/* See comments in probe.h. */
+
+struct value *
+evaluate_probe_argument (struct probe *probe, unsigned n,
+ struct frame_info *frame)
+{
+ return probe->pops->evaluate_probe_argument (probe, n, frame);
+}
+