Skip to content

Commit c42de70

Browse files
Taeungacmel
authored andcommitted
perf trace: Check and discard not only 'nr' but also '__syscall_nr'
Format fields of a syscall have the first variable '__syscall_nr' or 'nr' that mean the syscall number. But it isn't relevant here so drop it. 'nr' among fields of syscall was renamed '__syscall_nr'. So add exception handling to drop '__syscall_nr' and modify the comment for this excpetion handling. Reported-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Taeung Song <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 67d5268 commit c42de70

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/perf/builtin-trace.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,8 +1725,12 @@ static int trace__read_syscall_info(struct trace *trace, int id)
17251725

17261726
sc->args = sc->tp_format->format.fields;
17271727
sc->nr_args = sc->tp_format->format.nr_fields;
1728-
/* drop nr field - not relevant here; does not exist on older kernels */
1729-
if (sc->args && strcmp(sc->args->name, "nr") == 0) {
1728+
/*
1729+
* We need to check and discard the first variable '__syscall_nr'
1730+
* or 'nr' that mean the syscall number. It is needless here.
1731+
* So drop '__syscall_nr' or 'nr' field but does not exist on older kernels.
1732+
*/
1733+
if (sc->args && (!strcmp(sc->args->name, "__syscall_nr") || !strcmp(sc->args->name, "nr"))) {
17301734
sc->args = sc->args->next;
17311735
--sc->nr_args;
17321736
}

0 commit comments

Comments
 (0)