trace_kprobes: Don't output zero offset
authorLai Jiangshan <laijs@cn.fujitsu.com>
Wed, 25 Nov 2009 08:33:15 +0000 (16:33 +0800)
committerIngo Molnar <mingo@elte.hu>
Fri, 27 Nov 2009 05:43:05 +0000 (06:43 +0100)
"symbol_name+0" is not so friendly.
It makes the output longer.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4B0CEBCB.7080309@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace_kprobe.c

index 96e1944229be4d3332423c034cbfcb1247aadc26..72d0c65c8676b8bc048c6c865c202335aa492a89 100644 (file)
@@ -243,7 +243,11 @@ static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
                ret = snprintf(buf, n, "@0x%p", ff->data);
        else if (ff->func == fetch_symbol) {
                struct symbol_cache *sc = ff->data;
-               ret = snprintf(buf, n, "@%s%+ld", sc->symbol, sc->offset);
+               if (sc->offset)
+                       ret = snprintf(buf, n, "@%s%+ld", sc->symbol,
+                                       sc->offset);
+               else
+                       ret = snprintf(buf, n, "@%s", sc->symbol);
        } else if (ff->func == fetch_retvalue)
                ret = snprintf(buf, n, "$retval");
        else if (ff->func == fetch_stack_address)
@@ -762,10 +766,12 @@ static int probes_seq_show(struct seq_file *m, void *v)
        seq_printf(m, "%c", probe_is_return(tp) ? 'r' : 'p');
        seq_printf(m, ":%s/%s", tp->call.system, tp->call.name);
 
-       if (tp->symbol)
+       if (!tp->symbol)
+               seq_printf(m, " 0x%p", tp->rp.kp.addr);
+       else if (tp->rp.kp.offset)
                seq_printf(m, " %s+%u", probe_symbol(tp), tp->rp.kp.offset);
        else
-               seq_printf(m, " 0x%p", tp->rp.kp.addr);
+               seq_printf(m, " %s", probe_symbol(tp));
 
        for (i = 0; i < tp->nr_args; i++) {
                ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i].fetch);