All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhaolei <zhaolei@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 1/3] [PATCH 1/3] vsprintf: add %ps that is the same as %pS but is like %pf
Date: Thu, 17 Sep 2009 14:07:21 +0800	[thread overview]
Message-ID: <4AB1D219.8060009@cn.fujitsu.com> (raw)
In-Reply-To: <20090917042831.280497816@goodmis.org>

Steven Rostedt wrote:
> From: Steven Rostedt <srostedt@redhat.com>
> 
> On PowerPC64 function pointers do not point directly at the functions,
> but instead point to pointers to the functions. The output of %pF expects
> to point to a pointer to the function, whereas %pS will show the function
> itself.
> 
> mcount returns the direct pointer to the function and not the pointer to
> the pointer. Thus %pS must be used to show this. The function tracer
> requires printing of the functions without offsets and uses the %pf
> instead.
> 
>  %pF produces run_local_timers+0x4/0x1f
>  %pf produces just run_local_timers
> 
> For PowerPC64, we need to use the direct pointer, and we only have
> %pS which will produce .run_local_timers+0x4/0x1f
> 
> This patch creates a %ps that matches the %pf as %pS matches %pF.
> 
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  lib/vsprintf.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 756ccaf..c265e75 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -580,7 +580,7 @@ static char *symbol_string(char *buf, char *end, void *ptr,
>  	unsigned long value = (unsigned long) ptr;
>  #ifdef CONFIG_KALLSYMS
>  	char sym[KSYM_SYMBOL_LEN];
> -	if (ext != 'f')
> +	if (ext != 'f' && ext != 's')
>  		sprint_symbol(sym, value);
>  	else
>  		kallsyms_lookup(value, NULL, NULL, NULL, sym);
> @@ -721,6 +721,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  	case 'F':
>  	case 'f':
>  		ptr = dereference_function_descriptor(ptr);
> +	case 's':
>  		/* Fallthrough */
>  	case 'S':
>  		return symbol_string(buf, end, ptr, spec, *fmt);
> @@ -958,7 +959,8 @@ qualifier:
>   * @args: Arguments for the format string
>   *
>   * This function follows C99 vsnprintf, but has some extensions:
> - * %pS output the name of a text symbol
> + * %pS output the name of a text symbol with offset
> + * %ps output the name of a text symbol without offset

Comments of bstr_printf() also need to be updated.
or remove duplation and just say "refer to vsnprintf()" in bstr_printf()'s
comment.

Thanks
Zhaolei


  parent reply	other threads:[~2009-09-17  6:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-17  4:27 [PATCH 0/3] [GIT PULL] tracing: small fixes for v2.6.32 Steven Rostedt
2009-09-17  4:27 ` [PATCH 1/3] [PATCH 1/3] vsprintf: add %ps that is the same as %pS but is like %pf Steven Rostedt
2009-09-17  5:40   ` Benjamin Herrenschmidt
2009-09-17  6:07   ` Zhaolei [this message]
2009-09-17  4:27 ` [PATCH 2/3] [PATCH 2/3] tracing: switch function prints from %pf to %ps Steven Rostedt
2009-09-17  4:27 ` [PATCH 3/3] [PATCH 3/3] oprofile: fix oprofile regression: select RING_BUFFER_ALLOW_SWAP Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB1D219.8060009@cn.fujitsu.com \
    --to=zhaolei@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.