diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 19f22127f02e6d799149041784e5419012d2e642..905e57c336b0024648acd5e1eb1bffb3179d47eb 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1233,8 +1233,17 @@ static void thread__set_filename_pos(struct thread *thread, const char *bf, static size_t syscall_arg__scnprintf_augmented_string(struct syscall_arg *arg, char *bf, size_t size) { struct augmented_arg *augmented_arg = arg->augmented.args; + size_t printed = scnprintf(bf, size, "\"%.*s\"", augmented_arg->size, augmented_arg->value); + /* + * So that the next arg with a payload can consume its augmented arg, i.e. for rename* syscalls + * we would have two strings, each prefixed by its size. + */ + int consumed = sizeof(*augmented_arg) + augmented_arg->size; - return scnprintf(bf, size, "\"%.*s\"", augmented_arg->size, augmented_arg->value); + arg->augmented.args += consumed; + arg->augmented.size -= consumed; + + return printed; } static size_t syscall_arg__scnprintf_filename(char *bf, size_t size,