perf-probe bugfixes
cover perf-probe bugfixes
Hi Ingo,
Before introducing new patches, I'd like to push some bugfixes. (I'll update previous series and post again.)
Thank you,
---
Masami Hiramatsu (4):
[BUGFIX][RESEND] perf probe: Fix to close dwarf when failing to analyze it [BUGFIX] perf probe: Correct error message for non-structure type [BUGFIX] perf probe: Fix not to return non-matched file [BUGFIX] perf probe: Fix --line syntax help and document
tools/perf/Documentation/perf-probe.txt | 2 +- tools/perf/builtin-probe.c | 2 +- tools/perf/util/probe-finder.c | 20 ++++++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-)
Signature · 2 lines
Masami Hiramatsu e-mail: [email protected]
PATCH 1/4 perf probe: Fix --line syntax help and document
Just fix typos. --line option accepts ':START-END' syntax, not ':START:END'.
---
tools/perf/Documentation/perf-probe.txt | 2 +- tools/perf/builtin-probe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-probe.txt +1 -1
@@ -85,7 +85,7 @@ LINE SYNTAX ----------- Line range is descripted by following syntax. - "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]" + "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]" FUNC specifies the function name of showing lines. 'RLN' is the start line number from function entry line, and 'RLN2' is the end line number. As same as
tools/perf/builtin-probe.c +1 -1
@@ -167,7 +167,7 @@ static const struct option options[] = { " with existing name"),#ifdef DWARF_SUPPORT OPT_CALLBACK ('L' ,"line" ,NULL , -"FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]" , +"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]" ,"Show source code lines." , opt_show_lines),OPT_STRING ('k' ,"vmlinux" , &symbol_conf.vmlinux_name, "file", "vmlinux pathname"),
Signature · 2 lines
Masami Hiramatsu e-mail: [email protected]
[tip:perf/core] perf probe: Fix --line syntax help and document
Commit-ID: 085ea739adf107b5a5d131f3625e517ff4a5181e Gitweb: http://git.kernel.org/tip/085ea739adf107b5a5d131f3625e517ff4a5181e Author: Masami Hiramatsu <[email protected]> AuthorDate: Fri, 2 Apr 2010 12:50:39 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 2 Apr 2010 19:35:42 +0200
perf probe: Fix --line syntax help and document
Just fix typos. --line option accepts ':START-END' syntax, not ':START:END'.
LKML-Reference: <[email protected]>
--- tools/perf/Documentation/perf-probe.txt | 2 +- tools/perf/builtin-probe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-probe.txt +1 -1
@@ -85,7 +85,7 @@ LINE SYNTAX ----------- Line range is descripted by following syntax. - "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]" + "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]" FUNC specifies the function name of showing lines. 'RLN' is the start line number from function entry line, and 'RLN2' is the end line number. As same as
tools/perf/builtin-probe.c +1 -1
@@ -167,7 +167,7 @@ static const struct option options[] = { " with existing name"),#ifdef DWARF_SUPPORT OPT_CALLBACK ('L' ,"line" ,NULL , -"FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]" , +"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]" ,"Show source code lines." , opt_show_lines),OPT_STRING ('k' ,"vmlinux" , &symbol_conf.vmlinux_name, "file", "vmlinux pathname"),
PATCH 2/4 perf probe: Fix not to return non-matched file
In reply to Masami HiramatsuFix cu_find_realpath() not to return the last file path if that is not matched to input pattern.
---
tools/perf/util/probe-finder.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/probe-finder.c +2 -0
@@ -183,6 +183,8 @@ static const char *cu_find_realpath(Dwarf_Die *cu_die, const char *fname)if (strtailcmp (src, fname) ==0 )break ; } +if (i == nfiles) +return NULL ;return src; }
Signature · 2 lines
Masami Hiramatsu e-mail: [email protected]
[tip:perf/core] perf probe: Fix not to return non-matched file
Commit-ID: c9e385826d4f1ca5a72005ab8503598f791a8dc0 Gitweb: http://git.kernel.org/tip/c9e385826d4f1ca5a72005ab8503598f791a8dc0 Author: Masami Hiramatsu <[email protected]> AuthorDate: Fri, 2 Apr 2010 12:50:45 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 2 Apr 2010 19:35:42 +0200
perf probe: Fix not to return non-matched file
Fix cu_find_realpath() not to return the last file path if that is not matched to input pattern.
LKML-Reference: <[email protected]>
--- tools/perf/util/probe-finder.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/probe-finder.c +2 -0
@@ -183,6 +183,8 @@ static const char *cu_find_realpath(Dwarf_Die *cu_die, const char *fname)if (strtailcmp (src, fname) ==0 )break ; } +if (i == nfiles) +return NULL ;return src; }
PATCH 3/4 perf probe: Correct error message for non-structure type
In reply to Masami Hiramatsuperf probe outputs incorrect error message when it called with non-exist field on a non-data structure local variable.
<Before>
# perf probe vfs_read 'count.hoge' Fatal: Structure on a register is not supported yet. # perf probe vfs_read 'count->hoge' Fatal: Semantic error: hoge must be referred by '.'
This corrects the messsage.
<After>
# perf probe vfs_read 'count.hoge' Fatal: count is not a data structure. # perf probe vfs_read 'count->hoge' Fatal: count is not a data structure.
---
tools/perf/util/probe-finder.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/probe-finder.c +8 -4
@@ -429,12 +429,20 @@ static void convert_variable_fields(Dwarf_Die *vr_die, const char *varname,if (die_get_real_type (&type, &type) ==NULL )die ("Failed to get a type information of %s." , varname); +/* Verify it is a data structure */ +if (dwarf_tag (&type) != DW_TAG_structure_type) +die ("%s is not a data structure." , varname); + ref =xzalloc (sizeof (struct kprobe_trace_arg_ref ));if (*ref_ptr) (*ref_ptr)->next = ref;else *ref_ptr = ref; }else { +/* Verify it is a data structure */ +if (dwarf_tag (&type) != DW_TAG_structure_type) +die ("%s is not a data structure." , varname); +if (field->ref)die ("Semantic error: %s must be referred by '.'" , field->name);
@@ -442,10 +450,6 @@ static void convert_variable_fields(Dwarf_Die *vr_die, const char *varname,die ("Structure on a register is not supported yet." ); } -/* Verify it is a data structure */ -if (dwarf_tag (&type) != DW_TAG_structure_type) -die ("%s is not a data structure." , varname); -if (die_find_member (&type, field->name, &member) ==NULL )die ("%s(tyep:%s) has no member %s." , varname,dwarf_diename (&type), field->name);
Signature · 2 lines
Masami Hiramatsu e-mail: [email protected]
[tip:perf/core] perf probe: Correct error message for non-structure type
Commit-ID: 12e5a7ae475ccb2733d740ffb95d9ca0a18392da Gitweb: http://git.kernel.org/tip/12e5a7ae475ccb2733d740ffb95d9ca0a18392da Author: Masami Hiramatsu <[email protected]> AuthorDate: Fri, 2 Apr 2010 12:50:53 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 2 Apr 2010 19:35:43 +0200
perf probe: Correct error message for non-structure type
perf probe outputs incorrect error message when it is called with non-existent field on a non-data structure local variable.
<Before>
# perf probe vfs_read 'count.hoge' Fatal: Structure on a register is not supported yet. # perf probe vfs_read 'count->hoge' Fatal: Semantic error: hoge must be referred by '.'
This corrects the messsage.
<After>
# perf probe vfs_read 'count.hoge' Fatal: count is not a data structure. # perf probe vfs_read 'count->hoge' Fatal: count is not a data structure.
LKML-Reference: <[email protected]>
--- tools/perf/util/probe-finder.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/probe-finder.c +8 -4
@@ -429,12 +429,20 @@ static void convert_variable_fields(Dwarf_Die *vr_die, const char *varname,if (die_get_real_type (&type, &type) ==NULL )die ("Failed to get a type information of %s." , varname); +/* Verify it is a data structure */ +if (dwarf_tag (&type) != DW_TAG_structure_type) +die ("%s is not a data structure." , varname); + ref =xzalloc (sizeof (struct kprobe_trace_arg_ref ));if (*ref_ptr) (*ref_ptr)->next = ref;else *ref_ptr = ref; }else { +/* Verify it is a data structure */ +if (dwarf_tag (&type) != DW_TAG_structure_type) +die ("%s is not a data structure." , varname); +if (field->ref)die ("Semantic error: %s must be referred by '.'" , field->name);
@@ -442,10 +450,6 @@ static void convert_variable_fields(Dwarf_Die *vr_die, const char *varname,die ("Structure on a register is not supported yet." ); } -/* Verify it is a data structure */ -if (dwarf_tag (&type) != DW_TAG_structure_type) -die ("%s is not a data structure." , varname); -if (die_find_member (&type, field->name, &member) ==NULL )die ("%s(tyep:%s) has no member %s." , varname,dwarf_diename (&type), field->name);
PATCH RESEND 4/4 perf probe: Fix to close dwarf when failing to analyze it
In reply to Masami HiramatsuFix to close libdw routine when failing to analyze it in find_perf_probe_point().
---
tools/perf/util/probe-finder.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/probe-finder.c +4 -2
@@ -818,8 +818,10 @@ int find_perf_probe_point(int fd, unsigned long addr,return -ENOENT ;/* Find cu die */ -if (!dwarf_addrdie (dbg, (Dwarf_Addr )addr, &cudie)) -return -EINVAL ; +if (!dwarf_addrdie (dbg, (Dwarf_Addr )addr, &cudie)) { + ret = -EINVAL ; + goto end; + }/* Find a corresponding line */ line =dwarf_getsrc_die (&cudie, (Dwarf_Addr )addr);
Signature · 2 lines
Masami Hiramatsu e-mail: [email protected]
[tip:perf/core] perf probe: Fix to close dwarf when failing to analyze it
Commit-ID: 75ec5a245c7763c397f31ec8964d0a46c54a7386 Gitweb: http://git.kernel.org/tip/75ec5a245c7763c397f31ec8964d0a46c54a7386 Author: Masami Hiramatsu <[email protected]> AuthorDate: Fri, 2 Apr 2010 12:50:59 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 2 Apr 2010 19:35:44 +0200
perf probe: Fix to close dwarf when failing to analyze it
Fix to close libdw routine when failing to analyze it in find_perf_probe_point().
LKML-Reference: <[email protected]>
--- tools/perf/util/probe-finder.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/probe-finder.c +4 -2
@@ -818,8 +818,10 @@ int find_perf_probe_point(int fd, unsigned long addr,return -ENOENT ;/* Find cu die */ -if (!dwarf_addrdie (dbg, (Dwarf_Addr )addr, &cudie)) -return -EINVAL ; +if (!dwarf_addrdie (dbg, (Dwarf_Addr )addr, &cudie)) { + ret = -EINVAL ; + goto end; + }/* Find a corresponding line */ line =dwarf_getsrc_die (&cudie, (Dwarf_Addr )addr);