From: Paulo Marques <pmarques@grupopie.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Sam Ravnborg <sam@ravnborg.org>,
Andrew Morton <akpm@osdl.org>,
Steven Rostedt <srostedt@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3] kallsyms, tracing: output more proper symbol name
Date: Fri, 13 Mar 2009 19:25:54 +0000 [thread overview]
Message-ID: <49BAB342.6040407@grupopie.com> (raw)
In-Reply-To: <49BA2704.9040404@cn.fujitsu.com>
Lai Jiangshan wrote:
> [...]
> [resend, previous v3 has some mistakes]
>
> Subject: kallsyms, tracing: output more proper symbol name
>
> Impact: bugfix, output reliable result
>
> Debug tools(dump_stack(), ftrace...) are like to print out symbols.
> But it is always print out the first aliased symbol.(Aliased symbols
> are symbols with the same address), and the first aliased symbol is
> sometime not proper.
> [...]
> Aliased symbols mostly come from linker script. The solution is
> guessing "is this symbol defined in linker script", the symbols
> defined in linker script will not become the first aliased symbol.
>
> And if symbols are found to be equal in this "linker script provided"
> criteria, symbols are sorted by the number of prefix underscores.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> [...]
> +static int prefix_underscores_count(const char *str)
> +{
> + const char *tail = str;
> +
> + while (*tail == '_')
> + tail++;
> +
> + return tail - str;
> +}
> +
> static int compare_symbols(const void *a, const void *b)
> {
> const struct sym_entry *sa;
> @@ -521,6 +566,18 @@ static int compare_symbols(const void *a, const void *b)
> if (wa != wb)
> return wa - wb;
>
> + /* sort by "linker script provide" type */
> + wa = may_be_linker_script_provide_symbol(sa);
> + wb = may_be_linker_script_provide_symbol(sb);
> + if (wa != wb)
> + return wa - wb;
> +
> + /* sort by the number of prefix underscores */
> + wa = prefix_underscores_count((const char *)sa->sym + 1);
> + wb = prefix_underscores_count((const char *)sb->sym + 1);
> + if (wa != wb)
> + return wa - wb;
> +
> /* sort by initial order, so that other symbols are left undisturbed */
> return sa->start_pos - sb->start_pos;
> }
The code seems fine. I have no time to compile and test it right now,
but there are no obvious problems as far as I can see.
Reviewed-by: Paulo Marques <pmarques@grupopie.com>
--
Paulo Marques - www.grupopie.com
"Measure with laser, mark with chalk, cut with chainsaw."
next prev parent reply other threads:[~2009-03-13 19:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 9:37 [PATCH] kallsyms, tracing: output more proper symbol name Lai Jiangshan
2009-03-11 9:46 ` Ingo Molnar
2009-03-11 10:29 ` Frederic Weisbecker
2009-03-11 13:05 ` Paulo Marques
2009-03-12 2:43 ` Lai Jiangshan
2009-03-12 15:32 ` Paulo Marques
2009-03-13 7:10 ` [PATCH V3] " Lai Jiangshan
2009-03-13 9:27 ` Lai Jiangshan
2009-03-13 19:25 ` Paulo Marques [this message]
2009-03-13 19:40 ` Sam Ravnborg
2009-03-13 20:07 ` Andrew Morton
2009-03-13 20:34 ` Paulo Marques
2009-03-14 8:54 ` Ingo Molnar
2009-03-14 8:57 ` [tip:tracing/ftrace] " Lai Jiangshan
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=49BAB342.6040407@grupopie.com \
--to=pmarques@grupopie.com \
--cc=akpm@osdl.org \
--cc=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sam@ravnborg.org \
--cc=srostedt@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox