diff options
author | Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> | 2009-12-06 23:04:49 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-07 00:26:22 -0500 |
commit | c0777c5aa835a97ccc77d82e55388940f0140a61 (patch) | |
tree | c81079cba831d221c13ae8ce427fe329bff40e78 /tools/perf | |
parent | b9b1e1c71a9481c0c34ed5bed42f1bfa730fd39e (diff) |
perf/sched: Fix 'perf sched trace'
If we use 'perf sched trace', it will call symbol__init() again,
and can lead to a perf tool crash:
[root@localhost perf]# ./perf sched trace
*** glibc detected *** ./perf: free(): invalid next size (normal): 0x094c1898 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7602404]
/lib/libc.so.6(cfree+0x96)[0xb76043b6]
./perf[0x80730fe]
./perf[0x8074c97]
./perf[0x805eb59]
./perf[0x80536fd]
./perf[0x804b618]
./perf[0x804bdc3]
/lib/libc.so.6(__libc_start_main+0xe5)[0xb75a9735]
./perf[0x804af81]
======= Memory map: ========
08048000-08158000 r-xp 00000000 fe:00 556831 /home/eric/....
08158000-08168000 rw-p 0010f000 fe:00 556831 /home/eric/...
08168000-085fe000 rw-p 00000000 00:00 0
094ab000-094cc000 rw-p 00000000 00:00 0 [heap]
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
LKML-Reference: <4B1C7EE1.8030906@cn.fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-sched.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 45c46c790493..7481ebdb17ef 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1888,13 +1888,18 @@ static int __cmd_record(int argc, const char **argv) | |||
1888 | 1888 | ||
1889 | int cmd_sched(int argc, const char **argv, const char *prefix __used) | 1889 | int cmd_sched(int argc, const char **argv, const char *prefix __used) |
1890 | { | 1890 | { |
1891 | symbol__init(0); | ||
1892 | |||
1893 | argc = parse_options(argc, argv, sched_options, sched_usage, | 1891 | argc = parse_options(argc, argv, sched_options, sched_usage, |
1894 | PARSE_OPT_STOP_AT_NON_OPTION); | 1892 | PARSE_OPT_STOP_AT_NON_OPTION); |
1895 | if (!argc) | 1893 | if (!argc) |
1896 | usage_with_options(sched_usage, sched_options); | 1894 | usage_with_options(sched_usage, sched_options); |
1897 | 1895 | ||
1896 | /* | ||
1897 | * Aliased to 'perf trace' for now: | ||
1898 | */ | ||
1899 | if (!strcmp(argv[0], "trace")) | ||
1900 | return cmd_trace(argc, argv, prefix); | ||
1901 | |||
1902 | symbol__init(0); | ||
1898 | if (!strncmp(argv[0], "rec", 3)) { | 1903 | if (!strncmp(argv[0], "rec", 3)) { |
1899 | return __cmd_record(argc, argv); | 1904 | return __cmd_record(argc, argv); |
1900 | } else if (!strncmp(argv[0], "lat", 3)) { | 1905 | } else if (!strncmp(argv[0], "lat", 3)) { |
@@ -1918,11 +1923,6 @@ int cmd_sched(int argc, const char **argv, const char *prefix __used) | |||
1918 | usage_with_options(replay_usage, replay_options); | 1923 | usage_with_options(replay_usage, replay_options); |
1919 | } | 1924 | } |
1920 | __cmd_replay(); | 1925 | __cmd_replay(); |
1921 | } else if (!strcmp(argv[0], "trace")) { | ||
1922 | /* | ||
1923 | * Aliased to 'perf trace' for now: | ||
1924 | */ | ||
1925 | return cmd_trace(argc, argv, prefix); | ||
1926 | } else { | 1926 | } else { |
1927 | usage_with_options(sched_usage, sched_options); | 1927 | usage_with_options(sched_usage, sched_options); |
1928 | } | 1928 | } |