From: Steven Rostedt <rostedt@goodmis.org>
To: Li Hong <lihong.hi@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] tracing: recordmcount.pl Clarify the logic on mcount section check
Date: Tue, 27 Oct 2009 16:18:52 -0400 [thread overview]
Message-ID: <1256674732.26028.438.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20091027070113.GE22032@uhli>
On Tue, 2009-10-27 at 15:01 +0800, Li Hong wrote:
> >From eb8a2d53bc2484be223e4fa0df8804389e969b72 Mon Sep 17 00:00:00 2001
> From: Li Hong <lihong.hi@gmail.com>
> Date: Tue, 27 Oct 2009 12:53:52 +0800
> Subject: [PATCH] tracing: recordmcount.pl Clarify the logic on mcount section check
>
> Move the mcount section check to the beginning of the objdump read loop.
> It is clearer, because mcount section check uses headers dump part of objdump
> to identify a mcount section, which goes before the section parts.
>
> Signed-off-by: Li Hong <lihong.hi@gmail.com>
>
> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 970c6d6..a6585b6 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -384,9 +384,26 @@ open(IN, "$objdump -hdr $inputfile|") || die "error running $objdump";
>
> my $text;
>
> -my $read_headers = 1;
>
> while (<IN>) {
> + # read headers first
> + my $read_headers = 1;
> +
Please keep the $read_headers initialization outside of the while loop.
It makes it easier for C programers to understand. Otherwise it looks
like it gets reset every time.
-- Steve
> + if ($read_headers && /$mcount_section/) {
> + #
> + # Somehow the make process can execute this script on an
> + # object twice. If it does, we would duplicate the mcount
> + # section and it will cause the function tracer self test
> + # to fail. Check if the mcount section exists, and if it does,
> + # warn and exit.
> + #
> + print STDERR "ERROR: $mcount_section already in $inputfile\n" .
> + "\tThis may be an indication that your build is corrupted.\n" .
> + "\tDelete $inputfile and try again. If the same object file\n" .
> + "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n";
> + exit(-1);
> + }
> +
> # is it a section?
> if (/$section_regex/) {
> $read_headers = 0;
> @@ -427,21 +444,7 @@ while (<IN>) {
> $offset = hex $1;
> }
> }
> - } elsif ($read_headers && /$mcount_section/) {
> - #
> - # Somehow the make process can execute this script on an
> - # object twice. If it does, we would duplicate the mcount
> - # section and it will cause the function tracer self test
> - # to fail. Check if the mcount section exists, and if it does,
> - # warn and exit.
> - #
> - print STDERR "ERROR: $mcount_section already in $inputfile\n" .
> - "\tThis may be an indication that your build is corrupted.\n" .
> - "\tDelete $inputfile and try again. If the same object file\n" .
> - "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n";
> - exit(-1);
> - }
> -
> + }
> # is this a call site to mcount? If so, record it to print later
> if ($text_found && /$mcount_regex/) {
> $offsets[$#offsets + 1] = hex $1;
next prev parent reply other threads:[~2009-10-27 20:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 6:54 [PATCH 1/9] tracing: recordmcount.pl Amend the documentation according to the implementation Li Hong
2009-10-27 6:57 ` [PATCH 2/9] tracing: recordmcount.pl Correct the check on the number of parameters Li Hong
2009-10-30 16:19 ` [tip:tracing/core] tracing: Correct the check for number of arguments in recordmcount.pl tip-bot for Li Hong
2009-10-27 6:58 ` [PATCH 3/9] tracing: recordmcount.pl Support absolute path check on $inputfile Li Hong
2009-10-27 20:12 ` Steven Rostedt
2009-10-27 7:00 ` [PATCH 4/9] tracing: recordmcount.pl Objcopy check should disable local reference correctly Li Hong
2009-10-27 20:16 ` Steven Rostedt
2009-10-27 7:01 ` [PATCH 5/9] tracing: recordmcount.pl Clarify the logic on mcount section check Li Hong
2009-10-27 20:18 ` Steven Rostedt [this message]
2009-10-27 7:02 ` [PATCH 6/9] tracing: recordmcount.pl Exit early if no work to do Li Hong
2009-10-27 20:20 ` Steven Rostedt
2009-10-27 7:03 ` [PATCH 7/9] tracing: recordmcount.pl Combine the condition validation in update_funcs Li Hong
2009-10-27 20:22 ` Steven Rostedt
2009-10-27 7:04 ` [PATCH 8/9] tracing: recordmcount.pl We won't use weak function as reference, remove the check Li Hong
2009-10-27 20:25 ` Steven Rostedt
2009-10-27 7:05 ` [PATCH 9/9] tracing: recordmcount.pl Remove the redundant code Li Hong
2009-10-27 20:51 ` Steven Rostedt
2009-10-27 20:04 ` [PATCH 1/9] tracing: recordmcount.pl Amend the documentation according to the implementation 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=1256674732.26028.438.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=lihong.hi@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®