1 http://sourceware.org/ml/gdb-cvs/2012-07/msg00123.html
3 ### src/gdb/ChangeLog 2012/07/18 04:36:15 1.14473
4 ### src/gdb/ChangeLog 2012/07/18 16:12:15 1.14474
6 +2012-07-18 Sergio Durigan Junior <sergiodj@redhat.com>
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'
19 + (gen_ui_out_table_header_info): Adjust `probes' argument to be
21 + (print_ui_out_info): Adjust argument to be `struct probe *'.
22 + (info_probes_for_ops): Adjust internal computations to use
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.
40 2012-07-18 Terry Guo <terry.guo@arm.com>
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 @@
49 -elf_get_probe_argument_count (struct objfile *objfile,
50 - struct probe *probe)
51 +elf_get_probe_argument_count (struct probe *probe)
53 - return probe->pops->get_probe_argument_count (probe, objfile);
54 + return probe->pops->get_probe_argument_count (probe);
57 /* Implementation of `sym_evaluate_probe_argument', as documented in
61 -elf_evaluate_probe_argument (struct objfile *objfile,
62 - struct probe *probe,
64 +elf_evaluate_probe_argument (struct probe *probe, unsigned n)
66 - return probe->pops->evaluate_probe_argument (probe, objfile, n);
67 + return probe->pops->evaluate_probe_argument (probe, n);
70 /* Implementation of `sym_compile_to_ax', as documented in symfile.h. */
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,
80 - probe->pops->compile_to_ax (probe, objfile, expr, value, n);
81 + probe->pops->compile_to_ax (probe, expr, value, n);
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
89 insert_exception_resume_from_probe (struct thread_info *tp,
90 const struct probe *probe,
91 - struct objfile *objfile,
92 struct frame_info *frame)
94 struct value *arg_value;
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),
103 bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
104 @@ -5552,7 +5551,6 @@
105 struct frame_info *frame)
107 volatile struct gdb_exception e;
108 - struct objfile *objfile;
109 const struct probe *probe;
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));
120 - insert_exception_resume_from_probe (ecs->event_thread, probe,
122 + insert_exception_resume_from_probe (ecs->event_thread, probe, frame);
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
129 /* See definition in probe.h. */
132 -find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out)
133 +find_probe_by_pc (CORE_ADDR pc)
135 struct objfile *objfile;
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)
142 - *objfile_out = objfile;
153 -/* A utility structure. A VEC of these is built when handling "info
156 -struct probe_and_objfile
159 - struct probe *probe;
161 - /* The probe's objfile. */
162 - struct objfile *objfile;
165 -typedef struct probe_and_objfile probe_and_objfile_s;
166 -DEF_VEC_O (probe_and_objfile_s);
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. */
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)
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;
186 - cleanup = make_cleanup (VEC_cleanup (probe_and_objfile_s), &result);
187 + cleanup = make_cleanup (VEC_cleanup (probe_p), &result);
189 cleanup_temps = make_cleanup (null_cleanup, NULL);
190 compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
193 for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
195 - probe_and_objfile_s entry;
197 if (pops != NULL && probe->pops != pops)
201 && regexec (&probe_pat, probe->name, 0, NULL, 0) != 0)
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);
211 @@ -334,36 +312,36 @@
215 -/* A qsort comparison function for probe_and_objfile_s objects. */
216 +/* A qsort comparison function for probe_p objects. */
219 -compare_entries (const void *a, const void *b)
220 +compare_probes (const void *a, const void *b)
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);
228 - v = strcmp (ea->probe->provider, eb->probe->provider);
229 + v = strcmp (pa->provider, pb->provider);
233 - v = strcmp (ea->probe->name, eb->probe->name);
234 + v = strcmp (pa->name, pb->name);
238 - if (ea->probe->address < eb->probe->address)
239 + if (pa->address < pb->address)
241 - if (ea->probe->address > eb->probe->address)
242 + if (pa->address > pb->address)
245 - return strcmp (ea->objfile->name, eb->objfile->name);
246 + return strcmp (pa->objfile->name, pb->objfile->name);
249 /* Helper function that generate entries in the ui_out table being
250 crafted by `info_probes_for_ops'. */
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)
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);
262 - probe_and_objfile_s *entry;
263 + struct probe *probe;
265 size_t size_max = strlen (column->print_name);
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)
270 /* `probe_fields' refers to the values of each new field that this
271 probe will display. */
272 @@ -405,12 +383,11 @@
276 - if (entry->probe->pops != p)
277 + if (probe->pops != p)
280 c2 = make_cleanup (VEC_cleanup (const_char_ptr), &probe_fields);
281 - p->gen_info_probes_table_values (entry->probe, entry->objfile,
283 + p->gen_info_probes_table_values (probe, &probe_fields);
285 gdb_assert (VEC_length (const_char_ptr, probe_fields)
287 @@ -437,10 +414,10 @@
290 /* Helper function to print extra information about a probe and an objfile
291 - represented by ENTRY. */
292 + represented by PROBE. */
295 -print_ui_out_info (probe_and_objfile_s *entry)
296 +print_ui_out_info (struct probe *probe)
300 @@ -451,23 +428,21 @@
301 info_probe_column_s *column;
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);
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)
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);
321 c = make_cleanup (VEC_cleanup (info_probe_column_s), &headings);
322 make_cleanup (VEC_cleanup (const_char_ptr), &values);
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);
330 gdb_assert (VEC_length (info_probe_column_s, headings)
331 == VEC_length (const_char_ptr, values));
332 @@ -515,16 +490,16 @@
334 info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops)
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;
342 int ui_out_extra_fields = 0;
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 ();
351 /* Do we have a `provider:probe:objfile' style of linespec? */
352 @@ -533,10 +508,10 @@
354 make_cleanup (xfree, provider);
356 - probe = extract_arg (&arg);
358 + probe_name = extract_arg (&arg);
361 - make_cleanup (xfree, probe);
362 + make_cleanup (xfree, probe_name);
364 objname = extract_arg (&arg);
366 @@ -564,28 +539,27 @@
368 ui_out_extra_fields = get_number_extra_fields (pops);
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),
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);
388 /* What's the size of an address in our architecture? */
389 size_addr = gdbarch_addr_bit (gdbarch) == 64 ? 18 : 10;
391 /* Determining the maximum size of each field (`provider', `name' and
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)
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);
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
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);
413 - gen_ui_out_table_header_info (items, pops);
414 + gen_ui_out_table_header_info (probes, pops);
416 ui_out_table_header (current_uiout, size_objname, ui_left, "object",
418 ui_out_table_body (current_uiout);
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)
423 struct cleanup *inner;
425 inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe");
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),
439 @@ -629,19 +603,19 @@
441 for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po);
443 - if (entry->probe->pops == po)
444 - print_ui_out_info (entry);
445 + if (probe->pops == po)
446 + print_ui_out_info (probe);
449 - print_ui_out_info (entry);
450 + print_ui_out_info (probe);
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");
459 - any_found = !VEC_empty (probe_and_objfile_s, items);
460 + any_found = !VEC_empty (probe_p, probes);
461 do_cleanups (cleanup);
464 @@ -662,23 +636,24 @@
465 probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
468 - struct objfile *objfile;
469 + const struct sym_probe_fns *probe_fns;
472 - probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
473 + probe = find_probe_by_pc (get_frame_pc (frame));
476 - gdb_assert (objfile->sf && objfile->sf->sym_probe_fns);
479 - = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
481 + gdb_assert (probe->objfile != NULL);
482 + gdb_assert (probe->objfile->sf != NULL);
483 + gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
485 + probe_fns = probe->objfile->sf->sym_probe_fns;
486 + n_probes = probe_fns->sym_get_probe_argument_count (probe);
491 - return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
494 + return probe_fns->sym_evaluate_probe_argument (probe, n);
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
502 /* Return the number of arguments of PROBE. */
504 - unsigned (*get_probe_argument_count) (struct probe *probe,
505 - struct objfile *objfile);
506 + unsigned (*get_probe_argument_count) (struct probe *probe);
508 /* Evaluate the Nth argument from the PROBE, returning a value
509 corresponding to it. The argument number is represented N. */
511 struct value *(*evaluate_probe_argument) (struct probe *probe,
512 - struct objfile *objfile,
515 /* Compile the Nth argument of the PROBE to an agent expression.
516 The argument number is represented by N. */
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);
523 /* Set the semaphore associated with the PROBE. This function only makes
525 void (*gen_info_probes_table_header) (VEC (info_probe_column_s) **heads);
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
536 position in the vector. */
538 void (*gen_info_probes_table_values) (struct probe *probe,
539 - struct objfile *objfile,
540 VEC (const_char_ptr) **values);
544 /* The operations associated with this probe. */
545 const struct probe_ops *pops;
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;
552 /* The name of the probe. */
556 extern void register_probe_ops (struct probe *probe);
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. */
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);
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 @@
575 -stap_parse_probe_arguments (struct stap_probe *probe, struct objfile *objfile)
576 +stap_parse_probe_arguments (struct stap_probe *probe)
579 - struct gdbarch *gdbarch = get_objfile_arch (objfile);
580 + struct gdbarch *gdbarch = get_objfile_arch (probe->p.objfile);
582 gdb_assert (!probe->args_parsed);
583 cur = probe->args_u.text;
584 @@ -991,15 +991,14 @@
588 -stap_get_probe_argument_count (struct probe *probe_generic,
589 - struct objfile *objfile)
590 +stap_get_probe_argument_count (struct probe *probe_generic)
592 struct stap_probe *probe = (struct stap_probe *) probe_generic;
594 gdb_assert (probe_generic->pops == &stap_probe_ops);
596 if (!probe->args_parsed)
597 - stap_parse_probe_arguments (probe, objfile);
598 + stap_parse_probe_arguments (probe);
600 gdb_assert (probe->args_parsed);
601 return VEC_length (stap_probe_arg_s, probe->args_u.vec);
602 @@ -1042,10 +1041,10 @@
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)
609 if (!probe->args_parsed)
610 - stap_parse_probe_arguments (probe, objfile);
611 + stap_parse_probe_arguments (probe);
613 return VEC_index (stap_probe_arg_s, probe->args_u.vec, n);
615 @@ -1054,8 +1053,7 @@
616 corresponding to it. Assertion is thrown if N does not exist. */
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)
623 struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
624 struct stap_probe_arg *arg;
625 @@ -1063,7 +1061,7 @@
627 gdb_assert (probe_generic->pops == &stap_probe_ops);
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);
634 @@ -1071,9 +1069,8 @@
635 Assertion is thrown if N does not exist. */
638 -stap_compile_to_ax (struct probe *probe_generic, struct objfile *objfile,
639 - struct agent_expr *expr, struct axs_value *value,
641 +stap_compile_to_ax (struct probe *probe_generic, struct agent_expr *expr,
642 + struct axs_value *value, unsigned n)
644 struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
645 struct stap_probe_arg *arg;
646 @@ -1081,7 +1078,7 @@
648 gdb_assert (probe_generic->pops == &stap_probe_ops);
650 - arg = stap_get_arg (stap_probe, objfile, n);
651 + arg = stap_get_arg (stap_probe, n);
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;
664 /* SEL == -1 means "_probe_argc". */
665 gdb_assert (sel >= -1);
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));
673 - = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
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);
679 + pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
681 + n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
683 return value_from_longest (builtin_type (arch)->builtin_int, n_args);
685 @@ -1145,9 +1146,7 @@
686 error (_("Invalid probe argument %d -- probe has %u arguments available"),
689 - return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
692 + return pc_probe_fns->sym_evaluate_probe_argument (pc_probe, sel);
695 /* This is called to compile one of the $_probe_arg* convenience
696 @@ -1159,20 +1158,25 @@
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;
705 /* SEL == -1 means "_probe_argc". */
706 gdb_assert (sel >= -1);
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));
714 - = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
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);
720 + pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
722 + n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
726 value->kind = axs_rvalue;
727 @@ -1186,8 +1190,7 @@
728 error (_("Invalid probe argument %d -- probe has %d arguments available"),
731 - objfile->sf->sym_probe_fns->sym_compile_to_ax (objfile, pc_probe,
733 + pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel);
737 @@ -1297,6 +1300,7 @@
739 ret = obstack_alloc (&objfile->objfile_obstack, sizeof (*ret));
740 ret->p.pops = &stap_probe_ops;
741 + ret->p.objfile = objfile;
743 /* Provider and the name of the probe. */
744 ret->p.provider = &el->data[3 * size];
745 @@ -1481,15 +1485,16 @@
748 stap_gen_info_probes_table_values (struct probe *probe_generic,
749 - struct objfile *objfile,
750 VEC (const_char_ptr) **ret)
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;
757 gdb_assert (probe_generic->pops == &stap_probe_ops);
759 + gdbarch = get_objfile_arch (probe->p.objfile);
762 val = print_core_address (gdbarch, probe->sem_addr);
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
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);
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
777 PC will match the address of the probe. If you provide an
778 implementation of sym_get_probes, you must implement this method
780 - struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile,
781 - struct probe *probe,
782 + struct value *(*sym_evaluate_probe_argument) (struct probe *probe,
785 /* Compile the Nth probe argument to an agent expression. PROBE
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,