probe-event.c (c82ec0a2bd7725a2d2ac3065d8cde13e1f717d3c) probe-event.c (fb8c5a56c7ddbc2b0d2ee7a8da60fe1355f75141)
1/*
2 * probe-event.c : perf-probe definition to probe_events format converter
3 *
4 * Written by Masami Hiramatsu <mhiramat@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 365 unchanged lines hidden (view full) ---

374 while (l <= lr->end && !feof(fp) && ret >= 0)
375 ret = show_one_line(fp, (l++) - lr->offset, false, false);
376end:
377 fclose(fp);
378 return ret;
379}
380
381static int show_available_vars_at(int fd, struct perf_probe_event *pev,
1/*
2 * probe-event.c : perf-probe definition to probe_events format converter
3 *
4 * Written by Masami Hiramatsu <mhiramat@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 365 unchanged lines hidden (view full) ---

374 while (l <= lr->end && !feof(fp) && ret >= 0)
375 ret = show_one_line(fp, (l++) - lr->offset, false, false);
376end:
377 fclose(fp);
378 return ret;
379}
380
381static int show_available_vars_at(int fd, struct perf_probe_event *pev,
382 int max_vls)
382 int max_vls, bool externs)
383{
384 char *buf;
385 int ret, i;
386 struct str_node *node;
387 struct variable_list *vls = NULL, *vl;
388
389 buf = synthesize_perf_probe_point(&pev->point);
390 if (!buf)
391 return -EINVAL;
392 pr_debug("Searching variables at %s\n", buf);
393
383{
384 char *buf;
385 int ret, i;
386 struct str_node *node;
387 struct variable_list *vls = NULL, *vl;
388
389 buf = synthesize_perf_probe_point(&pev->point);
390 if (!buf)
391 return -EINVAL;
392 pr_debug("Searching variables at %s\n", buf);
393
394 ret = find_available_vars_at(fd, pev, &vls, max_vls);
394 ret = find_available_vars_at(fd, pev, &vls, max_vls, externs);
395 if (ret > 0) {
396 /* Some variables were found */
397 fprintf(stdout, "Available variables at %s\n", buf);
398 for (i = 0; i < ret; i++) {
399 vl = &vls[i];
400 /*
401 * A probe point might be converted to
402 * several trace points.

--- 13 unchanged lines hidden (view full) ---

416 pr_err("Failed to find variables at %s (%d)\n", buf, ret);
417
418 free(buf);
419 return ret;
420}
421
422/* Show available variables on given probe point */
423int show_available_vars(struct perf_probe_event *pevs, int npevs,
395 if (ret > 0) {
396 /* Some variables were found */
397 fprintf(stdout, "Available variables at %s\n", buf);
398 for (i = 0; i < ret; i++) {
399 vl = &vls[i];
400 /*
401 * A probe point might be converted to
402 * several trace points.

--- 13 unchanged lines hidden (view full) ---

416 pr_err("Failed to find variables at %s (%d)\n", buf, ret);
417
418 free(buf);
419 return ret;
420}
421
422/* Show available variables on given probe point */
423int show_available_vars(struct perf_probe_event *pevs, int npevs,
424 int max_vls)
424 int max_vls, bool externs)
425{
426 int i, fd, ret = 0;
427
428 ret = init_vmlinux();
429 if (ret < 0)
430 return ret;
431
432 fd = open_vmlinux();
433 if (fd < 0) {
434 pr_warning("Failed to open debuginfo file.\n");
435 return fd;
436 }
437
438 setup_pager();
439
440 for (i = 0; i < npevs && ret >= 0; i++)
425{
426 int i, fd, ret = 0;
427
428 ret = init_vmlinux();
429 if (ret < 0)
430 return ret;
431
432 fd = open_vmlinux();
433 if (fd < 0) {
434 pr_warning("Failed to open debuginfo file.\n");
435 return fd;
436 }
437
438 setup_pager();
439
440 for (i = 0; i < npevs && ret >= 0; i++)
441 ret = show_available_vars_at(fd, &pevs[i], max_vls);
441 ret = show_available_vars_at(fd, &pevs[i], max_vls, externs);
442
443 close(fd);
444 return ret;
445}
446
447#else /* !DWARF_SUPPORT */
448
449static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,

--- 1378 unchanged lines hidden ---
442
443 close(fd);
444 return ret;
445}
446
447#else /* !DWARF_SUPPORT */
448
449static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,

--- 1378 unchanged lines hidden ---