diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-28 12:52:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-28 12:52:25 -0400 |
commit | e946217e4fdaa67681bbabfa8e6b18641921f750 (patch) | |
tree | 057ad6cb5869e20db7b93f154319560b55cbc725 /scripts/recordmcount.pl | |
parent | a1865769254dd4eefbc1e857d17bc2a77d5f8580 (diff) | |
parent | 60063a66236c15f5613f91390631e06718689782 (diff) |
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (31 commits)
ftrace: fix current_tracer error return
tracing: fix a build error on alpha
ftrace: use a real variable for ftrace_nop in x86
tracing/ftrace: make boot tracer select the sched_switch tracer
tracepoint: check if the probe has been registered
asm-generic: define DIE_OOPS in asm-generic
trace: fix printk warning for u64
ftrace: warning in kernel/trace/ftrace.c
ftrace: fix build failure
ftrace, powerpc, sparc64, x86: remove notrace from arch ftrace file
ftrace: remove ftrace hash
ftrace: remove mcount set
ftrace: remove daemon
ftrace: disable dynamic ftrace for all archs that use daemon
ftrace: add ftrace warn on to disable ftrace
ftrace: only have ftrace_kill atomic
ftrace: use probe_kernel
ftrace: comment arch ftrace code
ftrace: return error on failed modified text.
ftrace: dynamic ftrace process only text section
...
Diffstat (limited to 'scripts/recordmcount.pl')
-rwxr-xr-x | scripts/recordmcount.pl | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index f56d760bd589..6b9fe3eb8360 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -106,7 +106,13 @@ if ($#ARGV < 6) { | |||
106 | exit(1); | 106 | exit(1); |
107 | } | 107 | } |
108 | 108 | ||
109 | my ($arch, $objdump, $objcopy, $cc, $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | 109 | my ($arch, $bits, $objdump, $objcopy, $cc, |
110 | $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | ||
111 | |||
112 | # Acceptable sections to record. | ||
113 | my %text_sections = ( | ||
114 | ".text" => 1, | ||
115 | ); | ||
110 | 116 | ||
111 | $objdump = "objdump" if ((length $objdump) == 0); | 117 | $objdump = "objdump" if ((length $objdump) == 0); |
112 | $objcopy = "objcopy" if ((length $objcopy) == 0); | 118 | $objcopy = "objcopy" if ((length $objcopy) == 0); |
@@ -129,8 +135,16 @@ my $function_regex; # Find the name of a function | |||
129 | # (return offset and func name) | 135 | # (return offset and func name) |
130 | my $mcount_regex; # Find the call site to mcount (return offset) | 136 | my $mcount_regex; # Find the call site to mcount (return offset) |
131 | 137 | ||
138 | if ($arch eq "x86") { | ||
139 | if ($bits == 64) { | ||
140 | $arch = "x86_64"; | ||
141 | } else { | ||
142 | $arch = "i386"; | ||
143 | } | ||
144 | } | ||
145 | |||
132 | if ($arch eq "x86_64") { | 146 | if ($arch eq "x86_64") { |
133 | $section_regex = "Disassembly of section"; | 147 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
134 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 148 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
135 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; | 149 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; |
136 | $type = ".quad"; | 150 | $type = ".quad"; |
@@ -142,7 +156,7 @@ if ($arch eq "x86_64") { | |||
142 | $cc .= " -m64"; | 156 | $cc .= " -m64"; |
143 | 157 | ||
144 | } elsif ($arch eq "i386") { | 158 | } elsif ($arch eq "i386") { |
145 | $section_regex = "Disassembly of section"; | 159 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
146 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 160 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
147 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | 161 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
148 | $type = ".long"; | 162 | $type = ".long"; |
@@ -289,7 +303,13 @@ my $text; | |||
289 | while (<IN>) { | 303 | while (<IN>) { |
290 | # is it a section? | 304 | # is it a section? |
291 | if (/$section_regex/) { | 305 | if (/$section_regex/) { |
292 | $read_function = 1; | 306 | |
307 | # Only record text sections that we know are safe | ||
308 | if (defined($text_sections{$1})) { | ||
309 | $read_function = 1; | ||
310 | } else { | ||
311 | $read_function = 0; | ||
312 | } | ||
293 | # print out any recorded offsets | 313 | # print out any recorded offsets |
294 | update_funcs() if ($text_found); | 314 | update_funcs() if ($text_found); |
295 | 315 | ||