+\f
+
+/* A helper function that fetches exception probe arguments. This
+ fills in *ARG0 (if non-NULL) and *ARG1 (which must be non-NULL).
+ It will throw an exception on any kind of failure. */
+
+static void
+fetch_probe_arguments (struct value **arg0, struct value **arg1)
+{
+ struct frame_info *frame = get_selected_frame (_("No frame selected"));
+ CORE_ADDR pc = get_frame_pc (frame);
+ struct probe *pc_probe;
+ const struct sym_probe_fns *pc_probe_fns;
+ unsigned n_args;
+
+ pc_probe = find_probe_by_pc (pc);
+ if (pc_probe == NULL
+ || strcmp (pc_probe->provider, "libstdcxx") != 0
+ || (strcmp (pc_probe->name, "catch") != 0
+ && strcmp (pc_probe->name, "throw") != 0
+ && 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);
+ 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);
+
+ if ((arg0 != NULL && *arg0 == NULL) || *arg1 == NULL)
+ error (_("error computing probe argument at c++ exception catchpoint"));
+}
+
+\f
+