Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169422
b: refs/heads/master
c: 6e9f23d
h: refs/heads/master
v: v3
  • Loading branch information
Masami Hiramatsu authored and Frederic Weisbecker committed Sep 11, 2009
1 parent cdb66d5 commit 4882bef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eca0d916f6429785bbc88db3ff66631cde62b432
refs/heads/master: 6e9f23d1619f7badaf9090dac09e86a22d6061d8
16 changes: 8 additions & 8 deletions trunk/Documentation/trace/kprobetrace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ format:
field: unsigned long flags; offset:48;tsize:8;
field: unsigned long mode; offset:56;tsize:8;

print fmt: "%lx: dfd=%lx filename=%lx flags=%lx mode=%lx", ip, REC->dfd, REC->filename, REC->flags, REC->mode
print fmt: "(%lx) dfd=%lx filename=%lx flags=%lx mode=%lx", REC->ip, REC->dfd, REC->filename, REC->flags, REC->mode


You can see that the event has 4 arguments as in the expressions you specified.
Expand All @@ -129,15 +129,15 @@ print fmt: "%lx: dfd=%lx filename=%lx flags=%lx mode=%lx", ip, REC->dfd, REC->fi
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
<...>-1447 [001] 1038282.286875: do_sys_open+0x0/0xd6: dfd=3 filename=7fffd1ec4440 flags=8000 mode=0
<...>-1447 [001] 1038282.286878: sys_openat+0xc/0xe <- do_sys_open: rv=fffffffffffffffe ra=ffffffff81367a3a
<...>-1447 [001] 1038282.286885: do_sys_open+0x0/0xd6: dfd=ffffff9c filename=40413c flags=8000 mode=1b6
<...>-1447 [001] 1038282.286915: sys_open+0x1b/0x1d <- do_sys_open: rv=3 ra=ffffffff81367a3a
<...>-1447 [001] 1038282.286969: do_sys_open+0x0/0xd6: dfd=ffffff9c filename=4041c6 flags=98800 mode=10
<...>-1447 [001] 1038282.286976: sys_open+0x1b/0x1d <- do_sys_open: rv=3 ra=ffffffff81367a3a
<...>-1447 [001] 1038282.286875: myprobe: (do_sys_open+0x0/0xd6) dfd=3 filename=7fffd1ec4440 flags=8000 mode=0
<...>-1447 [001] 1038282.286878: myretprobe: (sys_openat+0xc/0xe <- do_sys_open) rv=fffffffffffffffe ra=ffffffff81367a3a
<...>-1447 [001] 1038282.286885: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=40413c flags=8000 mode=1b6
<...>-1447 [001] 1038282.286915: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) rv=3 ra=ffffffff81367a3a
<...>-1447 [001] 1038282.286969: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=4041c6 flags=98800 mode=10
<...>-1447 [001] 1038282.286976: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) rv=3 ra=ffffffff81367a3a


Each line shows when the kernel hits a probe, and <- SYMBOL means kernel
Each line shows when the kernel hits an event, and <- SYMBOL means kernel
returns from SYMBOL(e.g. "sys_open+0x1b/0x1d <- do_sys_open" means kernel
returns from do_sys_open to sys_open+0x1b).

Expand Down
16 changes: 11 additions & 5 deletions trunk/kernel/trace/trace_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,13 @@ print_kprobe_event(struct trace_iterator *iter, int flags)
event = ftrace_find_event(field->ent.type);
tp = container_of(event, struct trace_probe, event);

if (!trace_seq_printf(s, "%s: (", tp->call.name))
goto partial;

if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
goto partial;

if (!trace_seq_puts(s, ":"))
if (!trace_seq_puts(s, ")"))
goto partial;

for (i = 0; i < field->nargs; i++)
Expand Down Expand Up @@ -934,6 +937,9 @@ print_kretprobe_event(struct trace_iterator *iter, int flags)
event = ftrace_find_event(field->ent.type);
tp = container_of(event, struct trace_probe, event);

if (!trace_seq_printf(s, "%s: (", tp->call.name))
goto partial;

if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET))
goto partial;

Expand All @@ -943,7 +949,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags)
if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET))
goto partial;

if (!trace_seq_puts(s, ":"))
if (!trace_seq_puts(s, ")"))
goto partial;

for (i = 0; i < field->nargs; i++)
Expand Down Expand Up @@ -1087,7 +1093,7 @@ static int kprobe_event_show_format(struct ftrace_event_call *call,
SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
trace_seq_puts(s, "\n");

return __probe_event_show_format(s, tp, "%lx:", "ip");
return __probe_event_show_format(s, tp, "(%lx)", "REC->ip");
}

static int kretprobe_event_show_format(struct ftrace_event_call *call,
Expand All @@ -1106,8 +1112,8 @@ static int kretprobe_event_show_format(struct ftrace_event_call *call,
SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
trace_seq_puts(s, "\n");

return __probe_event_show_format(s, tp, "%lx <- %lx:",
"func, ret_ip");
return __probe_event_show_format(s, tp, "(%lx <- %lx)",
"REC->func, REC->ret_ip");
}

#ifdef CONFIG_EVENT_PROFILE
Expand Down

0 comments on commit 4882bef

Please sign in to comment.