diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-01-24 12:37:49 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-01-24 12:40:20 -0500 |
commit | cc7e61b351a532838b1e40010f7e93b66ef7d0f5 (patch) | |
tree | 3c1f87319630ba5c8440d82dae4820920132472e | |
parent | ad8bff234eddd23892ecd9ca344bc0a8144b3125 (diff) | |
download | libtraceevent-cc7e61b351a532838b1e40010f7e93b66ef7d0f5.tar.gz |
libtraceevent: Fix backward compatibility with tep_print_arg_string
It appears that trace-cmd 2.9.6 referenced the tep_print_arg_string to
get to the offset, which was removed by libtraceevent commit 512d7be1
("libtraceevent: Add __rel_loc relative location attribute support").
Add the offset back to both tep_print_arg_string and to
tep_print_arg_bitmask (yeah, it adds a hole in the structure), for
backward compatibility.
Link: https://lore.kernel.org/linux-trace-devel/20220124123749.40a0c18b@gandalf.local.home
Reported-by: Vitaly Chikunov <vt@altlinux.org>
Fixes: 512d7be1 ("libtraceevent: Add __rel_loc relative location attribute support")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215521
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | include/traceevent/event-parse.h | 2 | ||||
-rw-r--r-- | src/event-parse.c | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 27cba06..68b2f43 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -154,11 +154,13 @@ struct tep_print_arg_atom { struct tep_print_arg_string { char *string; + int offset; // for backward compatibility struct tep_format_field *field; }; struct tep_print_arg_bitmask { char *bitmask; + int offset; // for backward compatibility struct tep_format_field *field; }; diff --git a/src/event-parse.c b/src/event-parse.c index d3e43e5..2b346a5 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -3135,6 +3135,7 @@ process_str(struct tep_event *event __maybe_unused, struct tep_print_arg *arg, arg->type = TEP_PRINT_STRING; arg->string.string = token; + arg->string.offset = -1; arg->string.field = NULL; if (read_expected(TEP_EVENT_DELIM, ")") < 0) @@ -3164,6 +3165,7 @@ process_bitmask(struct tep_event *event __maybe_unused, struct tep_print_arg *ar arg->type = TEP_PRINT_BITMASK; arg->bitmask.bitmask = token; + arg->bitmask.offset = -1; arg->bitmask.field = NULL; if (read_expected(TEP_EVENT_DELIM, ")") < 0) @@ -4444,8 +4446,10 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, case TEP_PRINT_TYPE: break; case TEP_PRINT_STRING: { - if (!arg->string.field) + if (!arg->string.field) { arg->string.field = tep_find_any_field(event, arg->string.string); + arg->string.offset = arg->string.field->offset; + } if (!arg->string.field) break; dynamic_offset_field(tep, arg->string.field, data, size, &offset, &len); @@ -4459,8 +4463,10 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, print_str_to_seq(s, format, len_arg, arg->string.string); break; case TEP_PRINT_BITMASK: { - if (!arg->bitmask.field) + if (!arg->bitmask.field) { arg->bitmask.field = tep_find_any_field(event, arg->bitmask.bitmask); + arg->bitmask.offset = arg->bitmask.field->offset; + } if (!arg->bitmask.field) break; dynamic_offset_field(tep, arg->bitmask.field, data, size, &offset, &len); |