tracing: Move conditional into update_funcs() in recordmcount.pl

Move all the condition validations into the function update_funcs().
Also update_funcs should not die if $ref_func is undefined for there may be
more than one valid section in an object file.

Signed-off-by: Li Hong <lihong.hi@gmail.com>
LKML-Reference: <20091028050703.GG30758@uhli>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
Li Hong 2009-10-28 13:07:03 +08:00 committed by Steven Rostedt
parent 306dcf47d2
commit 6092858c60
1 changed files with 3 additions and 5 deletions

View File

@ -348,9 +348,7 @@ my $offset = 0; # offset of ref_func to section beginning
# #
sub update_funcs sub update_funcs
{ {
return if ($#offsets < 0); return unless ($ref_func and @offsets);
defined($ref_func) || die "No function to reference";
# A section only had a weak function, to represent it. # A section only had a weak function, to represent it.
# Unfortunately, a weak function may be overwritten by another # Unfortunately, a weak function may be overwritten by another
@ -425,7 +423,7 @@ while (<IN>) {
$read_function = 0; $read_function = 0;
} }
# print out any recorded offsets # print out any recorded offsets
update_funcs() if (defined($ref_func)); update_funcs();
# reset all markers and arrays # reset all markers and arrays
$text_found = 0; $text_found = 0;
@ -462,7 +460,7 @@ while (<IN>) {
} }
# dump out anymore offsets that may have been found # dump out anymore offsets that may have been found
update_funcs() if (defined($ref_func)); update_funcs();
# If we did not find any mcount callers, we are done (do nothing). # If we did not find any mcount callers, we are done (do nothing).
if (!$opened) { if (!$opened) {