History

tracing/uprobes: Support perf-style return probe

Support perf-style return probe ("SYMBOL%return") for uprobe events as same as kprobe events does. Link: https://lkml.kernel.org/r/159972814601.428528.7641183316212425445.stgit@devnote2

Masami Hiramatsu committed 6 years ago

Commit 3dd3aae1 parent 4725cd82 files · +15 −2Browse files

Unified · Split

2 files
  1. kernel/trace/trace.c +1 −1
  2. kernel/trace/trace_uprobe.c +14 −1
kernel/trace/trace.c+1−1
@@ -5125,7 +5125,7 @@ static const char readme_msg[] = · 5124 unmodified lines
51255125 "place (kretprobe): [<module>:]<symbol>[+<offset>]%return|<memaddr>\n"
51265126 #endif
51275127 #ifdef CONFIG_UPROBE_EVENTS
5128− " place (uprobe): <path>:<offset>[(ref_ctr_offset)]\n"
5128+ " place (uprobe): <path>:<offset>[%return][(ref_ctr_offset)]\n"
51295129 #endif
51305130 "\t args: <name>=fetcharg[:type]\n"
51315131 "\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n"
kernel/trace/trace_uprobe.c+14−1
@@ -528,7 +528,7 @@ end: · 527 unmodified lines
528528
529529 /*
530530 * Argument syntax:
531− * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS]
531+ * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET[%return][(REF)] [FETCHARGS]
532532 */
533533 static int trace_uprobe_create(int argc, const char **argv)
534534 {
@@ -617,6 +617,19 @@ static int trace_uprobe_create(int argc, const char **argv) · 82 unmodified lines
617617 }
618618 }
619619
620+ /* Check if there is %return suffix */
621+ tmp = strchr(arg, '%');
622+ if (tmp) {
623+ if (!strcmp(tmp, "%return")) {
624+ *tmp = '\0';
625+ is_return = true;
626+ } else {
627+ trace_probe_log_err(tmp - filename, BAD_ADDR_SUFFIX);
628+ ret = -EINVAL;
629+ goto fail_address_parse;
630+ }
631+ }
632+
620633 /* Parse uprobe offset. */
621634 ret = kstrtoul(arg, 0, &offset);
622635 if (ret) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t