diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:17:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:17:55 -0500 |
commit | e0d272429a34ff143bfa04ee8e29dd4eed2964c7 (patch) | |
tree | 5a719135b245811b5d61ed084d7b8c1bc2e87031 /scripts | |
parent | d25e8dbdab203ed8b4fd0a174bb5259e35ecd87c (diff) | |
parent | 480917427b0b6ff39de55ffc81391055472e6c26 (diff) |
Merge branch 'tracing-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (28 commits)
ftrace: Add function names to dangling } in function graph tracer
tracing: Simplify memory recycle of trace_define_field
tracing: Remove unnecessary variable in print_graph_return
tracing: Fix typo of info text in trace_kprobe.c
tracing: Fix typo in prof_sysexit_enable()
tracing: Remove CONFIG_TRACE_POWER from kernel config
tracing: Fix ftrace_event_call alignment for use with gcc 4.5
ftrace: Remove memory barriers from NMI code when not needed
tracing/kprobes: Add short documentation for HAVE_REGS_AND_STACK_ACCESS_API
s390: Add pt_regs register and stack access API
tracing/kprobes: Make Kconfig dependencies generic
tracing: Unify arch_syscall_addr() implementations
tracing: Add notrace to TRACE_EVENT implementation functions
ftrace: Allow to remove a single function from function graph filter
tracing: Add correct/incorrect to sort keys for branch annotation output
tracing: Simplify test for function_graph tracing start point
tracing: Drop the tr check from the graph tracing path
tracing: Add stack dump to trace_printk if stacktrace option is set
tracing: Use appropriate perl constructs in recordmcount.pl
tracing: optimize recordmcount.pl for offsets-handling
...
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/recordmcount.pl | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index ea6f6e3adaea..f3c9c0a90b98 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -136,13 +136,14 @@ my %text_sections = ( | |||
136 | ".text.unlikely" => 1, | 136 | ".text.unlikely" => 1, |
137 | ); | 137 | ); |
138 | 138 | ||
139 | $objdump = "objdump" if ((length $objdump) == 0); | 139 | # Note: we are nice to C-programmers here, thus we skip the '||='-idiom. |
140 | $objcopy = "objcopy" if ((length $objcopy) == 0); | 140 | $objdump = 'objdump' if (!$objdump); |
141 | $cc = "gcc" if ((length $cc) == 0); | 141 | $objcopy = 'objcopy' if (!$objcopy); |
142 | $ld = "ld" if ((length $ld) == 0); | 142 | $cc = 'gcc' if (!$cc); |
143 | $nm = "nm" if ((length $nm) == 0); | 143 | $ld = 'ld' if (!$ld); |
144 | $rm = "rm" if ((length $rm) == 0); | 144 | $nm = 'nm' if (!$nm); |
145 | $mv = "mv" if ((length $mv) == 0); | 145 | $rm = 'rm' if (!$rm); |
146 | $mv = 'mv' if (!$mv); | ||
146 | 147 | ||
147 | #print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " . | 148 | #print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " . |
148 | # "'$nm' '$rm' '$mv' '$inputfile'\n"; | 149 | # "'$nm' '$rm' '$mv' '$inputfile'\n"; |
@@ -432,14 +433,14 @@ sub update_funcs | |||
432 | 433 | ||
433 | # Loop through all the mcount caller offsets and print a reference | 434 | # Loop through all the mcount caller offsets and print a reference |
434 | # to the caller based from the ref_func. | 435 | # to the caller based from the ref_func. |
435 | for (my $i=0; $i <= $#offsets; $i++) { | 436 | if (!$opened) { |
436 | if (!$opened) { | 437 | open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; |
437 | open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; | 438 | $opened = 1; |
438 | $opened = 1; | 439 | print FILE "\t.section $mcount_section,\"a\",$section_type\n"; |
439 | print FILE "\t.section $mcount_section,\"a\",$section_type\n"; | 440 | print FILE "\t.align $alignment\n" if (defined($alignment)); |
440 | print FILE "\t.align $alignment\n" if (defined($alignment)); | 441 | } |
441 | } | 442 | foreach my $cur_offset (@offsets) { |
442 | printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; | 443 | printf FILE "\t%s %s + %d\n", $type, $ref_func, $cur_offset - $offset; |
443 | } | 444 | } |
444 | } | 445 | } |
445 | 446 | ||
@@ -476,11 +477,7 @@ while (<IN>) { | |||
476 | $read_headers = 0; | 477 | $read_headers = 0; |
477 | 478 | ||
478 | # Only record text sections that we know are safe | 479 | # Only record text sections that we know are safe |
479 | if (defined($text_sections{$1})) { | 480 | $read_function = defined($text_sections{$1}); |
480 | $read_function = 1; | ||
481 | } else { | ||
482 | $read_function = 0; | ||
483 | } | ||
484 | # print out any recorded offsets | 481 | # print out any recorded offsets |
485 | update_funcs(); | 482 | update_funcs(); |
486 | 483 | ||
@@ -514,7 +511,7 @@ while (<IN>) { | |||
514 | } | 511 | } |
515 | # is this a call site to mcount? If so, record it to print later | 512 | # is this a call site to mcount? If so, record it to print later |
516 | if ($text_found && /$mcount_regex/) { | 513 | if ($text_found && /$mcount_regex/) { |
517 | $offsets[$#offsets + 1] = hex $1; | 514 | push(@offsets, hex $1); |
518 | } | 515 | } |
519 | } | 516 | } |
520 | 517 | ||