]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-dlopen-stap-probe-3of7.patch
- typo
[packages/gdb.git] / gdb-dlopen-stap-probe-3of7.patch
1 2012-07-19  Gary Benson  <gbenson@redhat.com>
2
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.
8
9 diff --git a/gdb/probe.h b/gdb/probe.h
10 index 8d44ca2..1d29b87 100644
11 --- a/gdb/probe.h
12 +++ b/gdb/probe.h
13 @@ -214,6 +214,16 @@ extern void info_probes_for_ops (char *arg, int from_tty,
14  
15  extern struct cmd_list_element **info_probes_cmdlist_get (void);
16  
17 +/* Return the argument count of the specified probe.  */
18 +
19 +extern unsigned get_probe_argument_count (struct probe *probe);
20 +
21 +/* Evaluate argument N of the specified probe.  N must be between 0
22 +   inclusive and get_probe_argument_count exclusive.  */
23 +
24 +extern struct value *evaluate_probe_argument (struct probe *probe,
25 +                                             unsigned n);
26 +
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
32 --- a/gdb/probe.c
33 +++ b/gdb/probe.c
34 @@ -632,28 +632,55 @@ info_probes_command (char *arg, int from_tty)
35  
36  /* See comments in probe.h.  */
37  
38 +unsigned
39 +get_probe_argument_count (struct probe *probe)
40 +{
41 +  const struct sym_probe_fns *probe_fns;
42 +
43 +  gdb_assert (probe->objfile != NULL);
44 +  gdb_assert (probe->objfile->sf != NULL);
45 +
46 +  probe_fns = probe->objfile->sf->sym_probe_fns;
47 +
48 +  gdb_assert (probe_fns != NULL);
49 +
50 +  return probe_fns->sym_get_probe_argument_count (probe);
51 +}
52 +
53 +/* See comments in probe.h.  */
54 +
55 +struct value *
56 +evaluate_probe_argument (struct probe *probe, unsigned n)
57 +{
58 +  const struct sym_probe_fns *probe_fns;
59 +
60 +  gdb_assert (probe->objfile != NULL);
61 +  gdb_assert (probe->objfile->sf != NULL);
62 +
63 +  probe_fns = probe->objfile->sf->sym_probe_fns;
64 +
65 +  gdb_assert (probe_fns != NULL);
66 +
67 +  return probe_fns->sym_evaluate_probe_argument (probe, n);
68 +}
69 +
70 +/* See comments in probe.h.  */
71 +
72  struct value *
73  probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
74  {
75    struct probe *probe;
76 -  const struct sym_probe_fns *probe_fns;
77    unsigned n_args;
78  
79    probe = find_probe_by_pc (get_frame_pc (frame));
80    if (!probe)
81      return NULL;
82  
83 -  gdb_assert (probe->objfile != NULL);
84 -  gdb_assert (probe->objfile->sf != NULL);
85 -  gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
86 -
87 -  probe_fns = probe->objfile->sf->sym_probe_fns;
88 -  n_args = probe_fns->sym_get_probe_argument_count (probe);
89 -
90 +  n_args = get_probe_argument_count (probe);
91    if (n >= n_args)
92      return NULL;
93  
94 -  return probe_fns->sym_evaluate_probe_argument (probe, n);
95 +  return evaluate_probe_argument (probe, n);
96  }
97  
98  /* See comment in probe.h.  */
This page took 0.04833 seconds and 3 git commands to generate.