Skip to content

Commit

Permalink
tracing: Move mcount section search to front of loop in recordmcount.pl
Browse files Browse the repository at this point in the history
Move the mcount section check to the beginning of the objdump read loop.
This makes the code easier to follow since the search for the mcount
section is performed first before the mcount callers are processed.

Signed-off-by: Li Hong <[email protected]>
LKML-Reference: <20091028050523.GE30758@uhli>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
swanli authored and rostedt committed Oct 29, 2009
1 parent 7b7edc2 commit db24c7d
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions scripts/recordmcount.pl
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,27 @@ sub update_funcs

my $text;


# read headers first
my $read_headers = 1;

while (<IN>) {

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;
Expand Down Expand Up @@ -434,21 +452,7 @@ sub update_funcs
$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;
Expand Down

0 comments on commit db24c7d

Please sign in to comment.