]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-dlopen-stap-probe-1of7.patch
- typo
[packages/gdb.git] / gdb-dlopen-stap-probe-1of7.patch
1 http://sourceware.org/ml/gdb-cvs/2012-07/msg00123.html
2
3 ### src/gdb/ChangeLog   2012/07/18 04:36:15     1.14473
4 ### src/gdb/ChangeLog   2012/07/18 16:12:15     1.14474
5 ## -1,3 +1,37 @@
6 +2012-07-18  Sergio Durigan Junior  <sergiodj@redhat.com>
7 +
8 +       * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument.
9 +       (elf_compile_to_ax): Likewise.
10 +       * infrun.c (insert_exception_resume_from_probe): Likewise.
11 +       (check_exception_resume): Remove `objfile' variable.
12 +       * probe.c (find_probe_by_pc): Remove `objfile' argument.
13 +       (struct probe_and_objfile, probe_and_objfile_s): Delete.
14 +       (collect_probes): Adjust return value to `VEC (probe_p) *'.
15 +       (compare_entries): Rename to...
16 +       (compare_probes): ...this.  Adjust function to work with
17 +       `struct probe *'.  Rename variables `ea' and `eb' to `pa' and `pb'
18 +       respectively.
19 +       (gen_ui_out_table_header_info): Adjust `probes' argument to be
20 +       `VEC (probe_p) *'.
21 +       (print_ui_out_info): Adjust argument to be `struct probe *'.
22 +       (info_probes_for_ops): Adjust internal computations to use
23 +       `VEC (probe_p) *'.
24 +       (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore.
25 +       * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax,
26 +       gen_info_probes_table_values>: Remove `objfile' argument.
27 +       (struct probe) <objfile>: New field.
28 +       (find_probe_by_pc): Remove `objfile' argument.
29 +       * stap-probe.c (stap_parse_probe_arguments): Likewise.
30 +       (stap_get_probe_argument_count): Likewise.
31 +       (stap_get_arg): Likewise.
32 +       (stap_evaluate_probe_argument): Likewise.
33 +       (stap_compile_to_ax): Likewise.
34 +       (compile_probe_arg): Refactor not to pass `objfile' anymore.
35 +       (handle_stap_probe): Fill `objfile' field from `struct probe'.
36 +       (stap_gen_info_probes_table_header): Remove `objfile' argument.
37 +       * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument,
38 +       sym_compile_to_ax>: Likewise.
39 +
40  2012-07-18  Terry Guo  <terry.guo@arm.com>
41  
42         PR 14329
43 --- src/gdb/elfread.c   2012/06/26 20:14:01     1.133
44 +++ src/gdb/elfread.c   2012/07/18 16:12:15     1.134
45 @@ -1635,33 +1635,29 @@
46     symfile.h.  */
47  
48  static unsigned
49 -elf_get_probe_argument_count (struct objfile *objfile,
50 -                             struct probe *probe)
51 +elf_get_probe_argument_count (struct probe *probe)
52  {
53 -  return probe->pops->get_probe_argument_count (probe, objfile);
54 +  return probe->pops->get_probe_argument_count (probe);
55  }
56  
57  /* Implementation of `sym_evaluate_probe_argument', as documented in
58     symfile.h.  */
59  
60  static struct value *
61 -elf_evaluate_probe_argument (struct objfile *objfile,
62 -                            struct probe *probe,
63 -                            unsigned n)
64 +elf_evaluate_probe_argument (struct probe *probe, unsigned n)
65  {
66 -  return probe->pops->evaluate_probe_argument (probe, objfile, n);
67 +  return probe->pops->evaluate_probe_argument (probe, n);
68  }
69  
70  /* Implementation of `sym_compile_to_ax', as documented in symfile.h.  */
71  
72  static void
73 -elf_compile_to_ax (struct objfile *objfile,
74 -                  struct probe *probe,
75 +elf_compile_to_ax (struct probe *probe,
76                    struct agent_expr *expr,
77                    struct axs_value *value,
78                    unsigned n)
79  {
80 -  probe->pops->compile_to_ax (probe, objfile, expr, value, n);
81 +  probe->pops->compile_to_ax (probe, expr, value, n);
82  }
83  
84  /* Implementation of `sym_relocate_probe', as documented in symfile.h.  */
85 --- src/gdb/infrun.c    2012/07/01 10:37:04     1.549
86 +++ src/gdb/infrun.c    2012/07/18 16:12:16     1.550
87 @@ -5518,7 +5518,6 @@
88  static void
89  insert_exception_resume_from_probe (struct thread_info *tp,
90                                     const struct probe *probe,
91 -                                   struct objfile *objfile,
92                                     struct frame_info *frame)
93  {
94    struct value *arg_value;
95 @@ -5534,7 +5533,7 @@
96    if (debug_infrun)
97      fprintf_unfiltered (gdb_stdlog,
98                         "infrun: exception resume at %s\n",
99 -                       paddress (get_objfile_arch (objfile),
100 +                       paddress (get_objfile_arch (probe->objfile),
101                                   handler));
102  
103    bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
104 @@ -5552,7 +5551,6 @@
105                         struct frame_info *frame)
106  {
107    volatile struct gdb_exception e;
108 -  struct objfile *objfile;
109    const struct probe *probe;
110    struct symbol *func;
111  
112 @@ -5560,11 +5558,10 @@
113       SystemTap probe point.  If so, the probe has two arguments: the
114       CFA and the HANDLER.  We ignore the CFA, extract the handler, and
115       set a breakpoint there.  */
116 -  probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
117 +  probe = find_probe_by_pc (get_frame_pc (frame));
118    if (probe)
119      {
120 -      insert_exception_resume_from_probe (ecs->event_thread, probe,
121 -                                         objfile, frame);
122 +      insert_exception_resume_from_probe (ecs->event_thread, probe, frame);
123        return;
124      }
125  
126 --- src/gdb/probe.c     2012/05/08 01:35:34     1.3
127 +++ src/gdb/probe.c     2012/07/18 16:12:17     1.4
128 @@ -204,7 +204,7 @@
129  /* See definition in probe.h.  */
130  
131  struct probe *
132 -find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out)
133 +find_probe_by_pc (CORE_ADDR pc)
134  {
135    struct objfile *objfile;
136  
137 @@ -221,10 +221,7 @@
138      probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
139      for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
140        if (probe->address == pc)
141 -       {
142 -         *objfile_out = objfile;
143 -         return probe;
144 -       }
145 +       return probe;
146    }
147  
148    return NULL;
149 @@ -232,21 +229,6 @@
150  
151  \f
152  
153 -/* A utility structure.  A VEC of these is built when handling "info
154 -   probes".  */
155 -
156 -struct probe_and_objfile
157 -{
158 -  /* The probe.  */
159 -  struct probe *probe;
160 -
161 -  /* The probe's objfile.  */
162 -  struct objfile *objfile;
163 -};
164 -
165 -typedef struct probe_and_objfile probe_and_objfile_s;
166 -DEF_VEC_O (probe_and_objfile_s);
167 -
168  /* A helper function for collect_probes that compiles a regexp and
169     throws an exception on error.  This installs a cleanup to free the
170     resulting pattern on success.  If RX is NULL, this does nothing.  */
171 @@ -275,16 +257,16 @@
172     If POPS is not NULL, only probes of this certain probe_ops will match.
173     Each argument is a regexp, or NULL, which matches anything.  */
174  
175 -static VEC (probe_and_objfile_s) *
176 +static VEC (probe_p) *
177  collect_probes (char *objname, char *provider, char *probe_name,
178                 const struct probe_ops *pops)
179  {
180    struct objfile *objfile;
181 -  VEC (probe_and_objfile_s) *result = NULL;
182 +  VEC (probe_p) *result = NULL;
183    struct cleanup *cleanup, *cleanup_temps;
184    regex_t obj_pat, prov_pat, probe_pat;
185  
186 -  cleanup = make_cleanup (VEC_cleanup (probe_and_objfile_s), &result);
187 +  cleanup = make_cleanup (VEC_cleanup (probe_p), &result);
188  
189    cleanup_temps = make_cleanup (null_cleanup, NULL);
190    compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
191 @@ -310,8 +292,6 @@
192  
193        for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
194         {
195 -         probe_and_objfile_s entry;
196 -
197           if (pops != NULL && probe->pops != pops)
198             continue;
199  
200 @@ -323,9 +303,7 @@
201               && regexec (&probe_pat, probe->name, 0, NULL, 0) != 0)
202             continue;
203  
204 -         entry.probe = probe;
205 -         entry.objfile = objfile;
206 -         VEC_safe_push (probe_and_objfile_s, result, &entry);
207 +         VEC_safe_push (probe_p, result, probe);
208         }
209      }
210  
211 @@ -334,36 +312,36 @@
212    return result;
213  }
214  
215 -/* A qsort comparison function for probe_and_objfile_s objects.  */
216 +/* A qsort comparison function for probe_p objects.  */
217  
218  static int
219 -compare_entries (const void *a, const void *b)
220 +compare_probes (const void *a, const void *b)
221  {
222 -  const probe_and_objfile_s *ea = a;
223 -  const probe_and_objfile_s *eb = b;
224 +  const struct probe *pa = *((const struct probe **) a);
225 +  const struct probe *pb = *((const struct probe **) b);
226    int v;
227  
228 -  v = strcmp (ea->probe->provider, eb->probe->provider);
229 +  v = strcmp (pa->provider, pb->provider);
230    if (v)
231      return v;
232  
233 -  v = strcmp (ea->probe->name, eb->probe->name);
234 +  v = strcmp (pa->name, pb->name);
235    if (v)
236      return v;
237  
238 -  if (ea->probe->address < eb->probe->address)
239 +  if (pa->address < pb->address)
240      return -1;
241 -  if (ea->probe->address > eb->probe->address)
242 +  if (pa->address > pb->address)
243      return 1;
244  
245 -  return strcmp (ea->objfile->name, eb->objfile->name);
246 +  return strcmp (pa->objfile->name, pb->objfile->name);
247  }
248  
249  /* Helper function that generate entries in the ui_out table being
250     crafted by `info_probes_for_ops'.  */
251  
252  static void
253 -gen_ui_out_table_header_info (VEC (probe_and_objfile_s) *probes,
254 +gen_ui_out_table_header_info (VEC (probe_p) *probes,
255                               const struct probe_ops *p)
256  {
257    /* `headings' refers to the names of the columns when printing `info
258 @@ -392,11 +370,11 @@
259         VEC_iterate (info_probe_column_s, headings, ix, column);
260         ++ix)
261      {
262 -      probe_and_objfile_s *entry;
263 +      struct probe *probe;
264        int jx;
265        size_t size_max = strlen (column->print_name);
266  
267 -      for (jx = 0; VEC_iterate (probe_and_objfile_s, probes, jx, entry); ++jx)
268 +      for (jx = 0; VEC_iterate (probe_p, probes, jx, probe); ++jx)
269         {
270           /* `probe_fields' refers to the values of each new field that this
271              probe will display.  */
272 @@ -405,12 +383,11 @@
273           const char *val;
274           int kx;
275  
276 -         if (entry->probe->pops != p)
277 +         if (probe->pops != p)
278             continue;
279  
280           c2 = make_cleanup (VEC_cleanup (const_char_ptr), &probe_fields);
281 -         p->gen_info_probes_table_values (entry->probe, entry->objfile,
282 -                                          &probe_fields);
283 +         p->gen_info_probes_table_values (probe, &probe_fields);
284  
285           gdb_assert (VEC_length (const_char_ptr, probe_fields)
286                       == headings_size);
287 @@ -437,10 +414,10 @@
288  }
289  
290  /* Helper function to print extra information about a probe and an objfile
291 -   represented by ENTRY.  */
292 +   represented by PROBE.  */
293  
294  static void
295 -print_ui_out_info (probe_and_objfile_s *entry)
296 +print_ui_out_info (struct probe *probe)
297  {
298    int ix;
299    int j = 0;
300 @@ -451,23 +428,21 @@
301    info_probe_column_s *column;
302    struct cleanup *c;
303  
304 -  gdb_assert (entry != NULL);
305 -  gdb_assert (entry->probe != NULL);
306 -  gdb_assert (entry->probe->pops != NULL);
307 +  gdb_assert (probe != NULL);
308 +  gdb_assert (probe->pops != NULL);
309  
310 -  if (entry->probe->pops->gen_info_probes_table_header == NULL
311 -      && entry->probe->pops->gen_info_probes_table_values == NULL)
312 +  if (probe->pops->gen_info_probes_table_header == NULL
313 +      && probe->pops->gen_info_probes_table_values == NULL)
314      return;
315  
316 -  gdb_assert (entry->probe->pops->gen_info_probes_table_header != NULL
317 -             && entry->probe->pops->gen_info_probes_table_values != NULL);
318 +  gdb_assert (probe->pops->gen_info_probes_table_header != NULL
319 +             && probe->pops->gen_info_probes_table_values != NULL);
320  
321    c = make_cleanup (VEC_cleanup (info_probe_column_s), &headings);
322    make_cleanup (VEC_cleanup (const_char_ptr), &values);
323  
324 -  entry->probe->pops->gen_info_probes_table_header (&headings);
325 -  entry->probe->pops->gen_info_probes_table_values (entry->probe,
326 -                                                   entry->objfile, &values);
327 +  probe->pops->gen_info_probes_table_header (&headings);
328 +  probe->pops->gen_info_probes_table_values (probe, &values);
329  
330    gdb_assert (VEC_length (info_probe_column_s, headings)
331               == VEC_length (const_char_ptr, values));
332 @@ -515,16 +490,16 @@
333  void
334  info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops)
335  {
336 -  char *provider, *probe = NULL, *objname = NULL;
337 +  char *provider, *probe_name = NULL, *objname = NULL;
338    struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
339 -  VEC (probe_and_objfile_s) *items;
340 +  VEC (probe_p) *probes;
341    int i, any_found;
342    int ui_out_extra_fields = 0;
343    size_t size_addr;
344    size_t size_name = strlen ("Name");
345    size_t size_objname = strlen ("Object");
346    size_t size_provider = strlen ("Provider");
347 -  probe_and_objfile_s *entry;
348 +  struct probe *probe;
349    struct gdbarch *gdbarch = get_current_arch ();
350  
351    /* Do we have a `provider:probe:objfile' style of linespec?  */
352 @@ -533,10 +508,10 @@
353      {
354        make_cleanup (xfree, provider);
355  
356 -      probe = extract_arg (&arg);
357 -      if (probe)
358 +      probe_name = extract_arg (&arg);
359 +      if (probe_name)
360         {
361 -         make_cleanup (xfree, probe);
362 +         make_cleanup (xfree, probe_name);
363  
364           objname = extract_arg (&arg);
365           if (objname)
366 @@ -564,28 +539,27 @@
367    else
368      ui_out_extra_fields = get_number_extra_fields (pops);
369  
370 -  items = collect_probes (objname, provider, probe, pops);
371 -  make_cleanup (VEC_cleanup (probe_and_objfile_s), &items);
372 +  probes = collect_probes (objname, provider, probe_name, pops);
373 +  make_cleanup (VEC_cleanup (probe_p), &probes);
374    make_cleanup_ui_out_table_begin_end (current_uiout,
375                                        4 + ui_out_extra_fields,
376 -                                      VEC_length (probe_and_objfile_s, items),
377 +                                      VEC_length (probe_p, probes),
378                                        "StaticProbes");
379  
380 -  if (!VEC_empty (probe_and_objfile_s, items))
381 -    qsort (VEC_address (probe_and_objfile_s, items),
382 -          VEC_length (probe_and_objfile_s, items),
383 -          sizeof (probe_and_objfile_s), compare_entries);
384 +  if (!VEC_empty (probe_p, probes))
385 +    qsort (VEC_address (probe_p, probes), VEC_length (probe_p, probes),
386 +          sizeof (probe_p), compare_probes);
387  
388    /* What's the size of an address in our architecture?  */
389    size_addr = gdbarch_addr_bit (gdbarch) == 64 ? 18 : 10;
390  
391    /* Determining the maximum size of each field (`provider', `name' and
392       `objname').  */
393 -  for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i)
394 +  for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i)
395      {
396 -      size_name = max (strlen (entry->probe->name), size_name);
397 -      size_provider = max (strlen (entry->probe->provider), size_provider);
398 -      size_objname = max (strlen (entry->objfile->name), size_objname);
399 +      size_name = max (strlen (probe->name), size_name);
400 +      size_provider = max (strlen (probe->provider), size_provider);
401 +      size_objname = max (strlen (probe->objfile->name), size_objname);
402      }
403  
404    ui_out_table_header (current_uiout, size_provider, ui_left, "provider",
405 @@ -601,26 +575,26 @@
406        /* We have to generate the table header for each new probe type that we
407          will print.  */
408        for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po); ++ix)
409 -       gen_ui_out_table_header_info (items, po);
410 +       gen_ui_out_table_header_info (probes, po);
411      }
412    else
413 -    gen_ui_out_table_header_info (items, pops);
414 +    gen_ui_out_table_header_info (probes, pops);
415  
416    ui_out_table_header (current_uiout, size_objname, ui_left, "object",
417                        _("Object"));
418    ui_out_table_body (current_uiout);
419  
420 -  for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i)
421 +  for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i)
422      {
423        struct cleanup *inner;
424  
425        inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe");
426  
427 -      ui_out_field_string (current_uiout, "provider", entry->probe->provider);
428 -      ui_out_field_string (current_uiout, "name", entry->probe->name);
429 +      ui_out_field_string (current_uiout, "provider", probe->provider);
430 +      ui_out_field_string (current_uiout, "name", probe->name);
431        ui_out_field_core_addr (current_uiout, "addr",
432 -                             get_objfile_arch (entry->objfile),
433 -                             entry->probe->address);
434 +                             get_objfile_arch (probe->objfile),
435 +                             probe->address);
436  
437        if (pops == NULL)
438         {
439 @@ -629,19 +603,19 @@
440  
441           for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po);
442                ++ix)
443 -           if (entry->probe->pops == po)
444 -             print_ui_out_info (entry);
445 +           if (probe->pops == po)
446 +             print_ui_out_info (probe);
447         }
448        else
449 -       print_ui_out_info (entry);
450 +       print_ui_out_info (probe);
451  
452 -      ui_out_field_string (current_uiout, "object", entry->objfile->name);
453 +      ui_out_field_string (current_uiout, "object", probe->objfile->name);
454        ui_out_text (current_uiout, "\n");
455  
456        do_cleanups (inner);
457      }
458  
459 -  any_found = !VEC_empty (probe_and_objfile_s, items);
460 +  any_found = !VEC_empty (probe_p, probes);
461    do_cleanups (cleanup);
462  
463    if (!any_found)
464 @@ -662,23 +636,24 @@
465  probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
466  {
467    struct probe *probe;
468 -  struct objfile *objfile;
469 +  const struct sym_probe_fns *probe_fns;
470    unsigned n_probes;
471  
472 -  probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
473 +  probe = find_probe_by_pc (get_frame_pc (frame));
474    if (!probe)
475      return NULL;
476 -  gdb_assert (objfile->sf && objfile->sf->sym_probe_fns);
477  
478 -  n_probes
479 -    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
480 -                                                               probe);
481 +  gdb_assert (probe->objfile != NULL);
482 +  gdb_assert (probe->objfile->sf != NULL);
483 +  gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
484 +
485 +  probe_fns = probe->objfile->sf->sym_probe_fns;
486 +  n_probes = probe_fns->sym_get_probe_argument_count (probe);
487 +
488    if (n >= n_probes)
489      return NULL;
490  
491 -  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
492 -                                                                 probe,
493 -                                                                 n);
494 +  return probe_fns->sym_evaluate_probe_argument (probe, n);
495  }
496  
497  /* See comment in probe.h.  */
498 --- src/gdb/probe.h     2012/04/27 20:47:55     1.1
499 +++ src/gdb/probe.h     2012/07/18 16:12:17     1.2
500 @@ -66,21 +66,18 @@
501  
502      /* Return the number of arguments of PROBE.  */
503  
504 -    unsigned (*get_probe_argument_count) (struct probe *probe,
505 -                                         struct objfile *objfile);
506 +    unsigned (*get_probe_argument_count) (struct probe *probe);
507  
508      /* Evaluate the Nth argument from the PROBE, returning a value
509         corresponding to it.  The argument number is represented N.  */
510  
511      struct value *(*evaluate_probe_argument) (struct probe *probe,
512 -                                             struct objfile *objfile,
513                                               unsigned n);
514  
515      /* Compile the Nth argument of the PROBE to an agent expression.
516         The argument number is represented by N.  */
517  
518 -    void (*compile_to_ax) (struct probe *probe, struct objfile *objfile,
519 -                          struct agent_expr *aexpr,
520 +    void (*compile_to_ax) (struct probe *probe, struct agent_expr *aexpr,
521                            struct axs_value *axs_value, unsigned n);
522  
523      /* Set the semaphore associated with the PROBE.  This function only makes
524 @@ -108,8 +105,8 @@
525      void (*gen_info_probes_table_header) (VEC (info_probe_column_s) **heads);
526  
527      /* Function that will fill VALUES with the values of the extra fields
528 -       to be printed for PROBE  and OBJFILE.  If the backend implements
529 -       the `gen_ui_out_table_header' method, then it should implement
530 +       to be printed for PROBE.  If the backend implements the
531 +       `gen_ui_out_table_header' method, then it should implement
532         this method as well.  The backend should also guarantee that the
533         order and the number of values in the vector is exactly the same
534         as the order of the extra fields provided in the method
535 @@ -118,7 +115,6 @@
536         position in the vector.  */
537  
538      void (*gen_info_probes_table_values) (struct probe *probe,
539 -                                         struct objfile *objfile,
540                                           VEC (const_char_ptr) **values);
541    };
542  
543 @@ -157,6 +153,11 @@
544      /* The operations associated with this probe.  */
545      const struct probe_ops *pops;
546  
547 +    /* The objfile which contains this probe.  Even if the probe is also
548 +       present in a separate debug objfile, this variable always points to
549 +       the non-separate debug objfile.  */
550 +    struct objfile *objfile;
551 +
552      /* The name of the probe.  */
553      const char *name;
554  
555 @@ -181,11 +182,9 @@
556  extern void register_probe_ops (struct probe *probe);
557  
558  /* Given a PC, find an associated probe with type PTYPE.  If a probe is
559 -   found, set *OBJFILE_OUT to the probe's objfile, and return the
560 -   probe.  If no probe is found, return NULL.  */
561 +   found, return it.  If no probe is found, return NULL.  */
562  
563 -extern struct probe *find_probe_by_pc (CORE_ADDR pc,
564 -                                      struct objfile **objfile_out);
565 +extern struct probe *find_probe_by_pc (CORE_ADDR pc);
566  
567  /* Search OBJFILE for a probe with the given PROVIDER, NAME and PTYPE.
568     Return a VEC of all probes that were found.  If no matching probe
569 --- src/gdb/stap-probe.c        2012/05/08 01:35:35     1.4
570 +++ src/gdb/stap-probe.c        2012/07/18 16:12:17     1.5
571 @@ -903,10 +903,10 @@
572     this information.  */
573  
574  static void
575 -stap_parse_probe_arguments (struct stap_probe *probe, struct objfile *objfile)
576 +stap_parse_probe_arguments (struct stap_probe *probe)
577  {
578    const char *cur;
579 -  struct gdbarch *gdbarch = get_objfile_arch (objfile);
580 +  struct gdbarch *gdbarch = get_objfile_arch (probe->p.objfile);
581  
582    gdb_assert (!probe->args_parsed);
583    cur = probe->args_u.text;
584 @@ -991,15 +991,14 @@
585     argument string.  */
586  
587  static unsigned
588 -stap_get_probe_argument_count (struct probe *probe_generic,
589 -                              struct objfile *objfile)
590 +stap_get_probe_argument_count (struct probe *probe_generic)
591  {
592    struct stap_probe *probe = (struct stap_probe *) probe_generic;
593  
594    gdb_assert (probe_generic->pops == &stap_probe_ops);
595  
596    if (!probe->args_parsed)
597 -    stap_parse_probe_arguments (probe, objfile);
598 +    stap_parse_probe_arguments (probe);
599  
600    gdb_assert (probe->args_parsed);
601    return VEC_length (stap_probe_arg_s, probe->args_u.vec);
602 @@ -1042,10 +1041,10 @@
603  }
604  
605  static struct stap_probe_arg *
606 -stap_get_arg (struct stap_probe *probe, struct objfile *objfile, unsigned n)
607 +stap_get_arg (struct stap_probe *probe, unsigned n)
608  {
609    if (!probe->args_parsed)
610 -    stap_parse_probe_arguments (probe, objfile);
611 +    stap_parse_probe_arguments (probe);
612  
613    return VEC_index (stap_probe_arg_s, probe->args_u.vec, n);
614  }
615 @@ -1054,8 +1053,7 @@
616     corresponding to it.  Assertion is thrown if N does not exist.  */
617  
618  static struct value *
619 -stap_evaluate_probe_argument (struct probe *probe_generic,
620 -                             struct objfile *objfile, unsigned n)
621 +stap_evaluate_probe_argument (struct probe *probe_generic, unsigned n)
622  {
623    struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
624    struct stap_probe_arg *arg;
625 @@ -1063,7 +1061,7 @@
626  
627    gdb_assert (probe_generic->pops == &stap_probe_ops);
628  
629 -  arg = stap_get_arg (stap_probe, objfile, n);
630 +  arg = stap_get_arg (stap_probe, n);
631    return evaluate_subexp_standard (arg->atype, arg->aexpr, &pos, EVAL_NORMAL);
632  }
633  
634 @@ -1071,9 +1069,8 @@
635     Assertion is thrown if N does not exist.  */
636  
637  static void
638 -stap_compile_to_ax (struct probe *probe_generic, struct objfile *objfile,
639 -                   struct agent_expr *expr, struct axs_value *value,
640 -                   unsigned n)
641 +stap_compile_to_ax (struct probe *probe_generic, struct agent_expr *expr,
642 +                   struct axs_value *value, unsigned n)
643  {
644    struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
645    struct stap_probe_arg *arg;
646 @@ -1081,7 +1078,7 @@
647  
648    gdb_assert (probe_generic->pops == &stap_probe_ops);
649  
650 -  arg = stap_get_arg (stap_probe, objfile, n);
651 +  arg = stap_get_arg (stap_probe, n);
652  
653    pc = arg->aexpr->elts;
654    gen_expr (arg->aexpr, &pc, expr, value);
655 @@ -1124,20 +1121,24 @@
656    struct frame_info *frame = get_selected_frame (_("No frame selected"));
657    CORE_ADDR pc = get_frame_pc (frame);
658    int sel = (int) (uintptr_t) data;
659 -  struct objfile *objfile;
660    struct probe *pc_probe;
661 +  const struct sym_probe_fns *pc_probe_fns;
662    unsigned n_args;
663  
664    /* SEL == -1 means "_probe_argc".  */
665    gdb_assert (sel >= -1);
666  
667 -  pc_probe = find_probe_by_pc (pc, &objfile);
668 +  pc_probe = find_probe_by_pc (pc);
669    if (pc_probe == NULL)
670      error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
671  
672 -  n_args
673 -    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
674 -                                                               pc_probe);
675 +  gdb_assert (pc_probe->objfile != NULL);
676 +  gdb_assert (pc_probe->objfile->sf != NULL);
677 +  gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
678 +
679 +  pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
680 +
681 +  n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
682    if (sel == -1)
683      return value_from_longest (builtin_type (arch)->builtin_int, n_args);
684  
685 @@ -1145,9 +1146,7 @@
686      error (_("Invalid probe argument %d -- probe has %u arguments available"),
687            sel, n_args);
688  
689 -  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
690 -                                                                 pc_probe,
691 -                                                                 sel);
692 +  return pc_probe_fns->sym_evaluate_probe_argument (pc_probe, sel);
693  }
694  
695  /* This is called to compile one of the $_probe_arg* convenience
696 @@ -1159,20 +1158,25 @@
697  {
698    CORE_ADDR pc = expr->scope;
699    int sel = (int) (uintptr_t) data;
700 -  struct objfile *objfile;
701    struct probe *pc_probe;
702 +  const struct sym_probe_fns *pc_probe_fns;
703    int n_probes;
704  
705    /* SEL == -1 means "_probe_argc".  */
706    gdb_assert (sel >= -1);
707  
708 -  pc_probe = find_probe_by_pc (pc, &objfile);
709 +  pc_probe = find_probe_by_pc (pc);
710    if (pc_probe == NULL)
711      error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
712  
713 -  n_probes
714 -    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
715 -                                                               pc_probe);
716 +  gdb_assert (pc_probe->objfile != NULL);
717 +  gdb_assert (pc_probe->objfile->sf != NULL);
718 +  gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
719 +
720 +  pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
721 +
722 +  n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
723 +
724    if (sel == -1)
725      {
726        value->kind = axs_rvalue;
727 @@ -1186,8 +1190,7 @@
728      error (_("Invalid probe argument %d -- probe has %d arguments available"),
729            sel, n_probes);
730  
731 -  objfile->sf->sym_probe_fns->sym_compile_to_ax (objfile, pc_probe,
732 -                                                expr, value, sel);
733 +  pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel);
734  }
735  
736  \f
737 @@ -1297,6 +1300,7 @@
738  
739    ret = obstack_alloc (&objfile->objfile_obstack, sizeof (*ret));
740    ret->p.pops = &stap_probe_ops;
741 +  ret->p.objfile = objfile;
742  
743    /* Provider and the name of the probe.  */
744    ret->p.provider = &el->data[3 * size];
745 @@ -1481,15 +1485,16 @@
746  
747  static void
748  stap_gen_info_probes_table_values (struct probe *probe_generic,
749 -                                  struct objfile *objfile,
750                                    VEC (const_char_ptr) **ret)
751  {
752    struct stap_probe *probe = (struct stap_probe *) probe_generic;
753 -  struct gdbarch *gdbarch = get_objfile_arch (objfile);
754 +  struct gdbarch *gdbarch;
755    const char *val = NULL;
756  
757    gdb_assert (probe_generic->pops == &stap_probe_ops);
758  
759 +  gdbarch = get_objfile_arch (probe->p.objfile);
760 +
761    if (probe->sem_addr)
762      val = print_core_address (gdbarch, probe->sem_addr);
763  
764 --- src/gdb/symfile.h   2012/05/24 22:14:35     1.109
765 +++ src/gdb/symfile.h   2012/07/18 16:12:17     1.110
766 @@ -320,8 +320,7 @@
767       have come from a call to this objfile's sym_get_probes method.
768       If you provide an implementation of sym_get_probes, you must
769       implement this method as well.  */
770 -  unsigned (*sym_get_probe_argument_count) (struct objfile *objfile,
771 -                                           struct probe *probe);
772 +  unsigned (*sym_get_probe_argument_count) (struct probe *probe);
773  
774    /* Evaluate the Nth argument available to PROBE.  PROBE will have
775       come from a call to this objfile's sym_get_probes method.  N will
776 @@ -330,8 +329,7 @@
777       PC will match the address of the probe.  If you provide an
778       implementation of sym_get_probes, you must implement this method
779       as well.  */
780 -  struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile,
781 -                                               struct probe *probe,
782 +  struct value *(*sym_evaluate_probe_argument) (struct probe *probe,
783                                                 unsigned n);
784  
785    /* Compile the Nth probe argument to an agent expression.  PROBE
786 @@ -339,8 +337,7 @@
787       method.  N will be between 0 and the number of arguments
788       available to this probe.  EXPR and VALUE are the agent expression
789       that is being updated.  */
790 -  void (*sym_compile_to_ax) (struct objfile *objfile,
791 -                            struct probe *probe,
792 +  void (*sym_compile_to_ax) (struct probe *probe,
793                              struct agent_expr *expr,
794                              struct axs_value *value,
795                              unsigned n);
This page took 0.167533 seconds and 3 git commands to generate.