1 2012-07-19 Gary Benson <gbenson@redhat.com>
3 * probe.h (get_probe_argument_count): New declaration.
4 (evaluate_probe_argument): Likewise.
5 * probe.c (get_probe_argument_count): New function.
6 (evaluate_probe_argument): Likewise.
7 (probe_safe_evaluate_at_pc): Use the above new functions.
9 diff --git a/gdb/probe.h b/gdb/probe.h
10 index 8d44ca2..1d29b87 100644
13 @@ -214,6 +214,16 @@ extern void info_probes_for_ops (char *arg, int from_tty,
15 extern struct cmd_list_element **info_probes_cmdlist_get (void);
17 +/* Return the argument count of the specified probe. */
19 +extern unsigned get_probe_argument_count (struct probe *probe);
21 +/* Evaluate argument N of the specified probe. N must be between 0
22 + inclusive and get_probe_argument_count exclusive. */
24 +extern struct value *evaluate_probe_argument (struct probe *probe,
27 /* A convenience function that finds a probe at the PC in FRAME and
28 evaluates argument N, with 0 <= N < number_of_args. If there is no
29 probe at that location, or if the probe does not have enough arguments,
30 diff --git a/gdb/probe.c b/gdb/probe.c
31 index 77f3b13..a61f4ea 100644
34 @@ -632,28 +632,55 @@ info_probes_command (char *arg, int from_tty)
36 /* See comments in probe.h. */
39 +get_probe_argument_count (struct probe *probe)
41 + const struct sym_probe_fns *probe_fns;
43 + gdb_assert (probe->objfile != NULL);
44 + gdb_assert (probe->objfile->sf != NULL);
46 + probe_fns = probe->objfile->sf->sym_probe_fns;
48 + gdb_assert (probe_fns != NULL);
50 + return probe_fns->sym_get_probe_argument_count (probe);
53 +/* See comments in probe.h. */
56 +evaluate_probe_argument (struct probe *probe, unsigned n)
58 + const struct sym_probe_fns *probe_fns;
60 + gdb_assert (probe->objfile != NULL);
61 + gdb_assert (probe->objfile->sf != NULL);
63 + probe_fns = probe->objfile->sf->sym_probe_fns;
65 + gdb_assert (probe_fns != NULL);
67 + return probe_fns->sym_evaluate_probe_argument (probe, n);
70 +/* See comments in probe.h. */
73 probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
76 - const struct sym_probe_fns *probe_fns;
79 probe = find_probe_by_pc (get_frame_pc (frame));
83 - gdb_assert (probe->objfile != NULL);
84 - gdb_assert (probe->objfile->sf != NULL);
85 - gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
87 - probe_fns = probe->objfile->sf->sym_probe_fns;
88 - n_args = probe_fns->sym_get_probe_argument_count (probe);
90 + n_args = get_probe_argument_count (probe);
94 - return probe_fns->sym_evaluate_probe_argument (probe, n);
95 + return evaluate_probe_argument (probe, n);
98 /* See comment in probe.h. */