Re: [PATCH] trace-view: Handle unknown events more gracefully

From: Jan Kiszka
Date: Fri Nov 12 2010 - 03:12:42 EST


Am 14.10.2010 21:23, Jan Kiszka wrote:
> Kernel 2.6.35.7 generates invalid trace files due to
> /sys/kernel/debug/tracing/events/scsi/scsi_dispatch_cmd_timeout/format
> returning "FORMAT TOO BIG" (seems to be fixed in 2.6.36). This makes
> pevent_data_event_from_type return NULL, and dereferencing of event
> crashes the viewer.
>
> Catch and report the error properly.

Ping...

Jan

>
> Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxx>
> ---
> trace-view-store.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/trace-view-store.c b/trace-view-store.c
> index 0834df7..34f8155 100644
> --- a/trace-view-store.c
> +++ b/trace-view-store.c
> @@ -507,12 +507,17 @@ trace_view_store_get_value (GtkTreeModel *tree_model,
> case TRACE_VIEW_STORE_COL_INFO:
> val = pevent_data_type(pevent, data);
> event = pevent_data_event_from_type(pevent, val);
> + if (!event) {
> + if (column == TRACE_VIEW_STORE_COL_EVENT)
> + g_value_set_string(value, "[UNKNOWN EVENT]");
> + break;
> + }
> +
> if (column == TRACE_VIEW_STORE_COL_EVENT) {
> g_value_set_string(value, event->name);
> break;
> }
>
> -
> trace_seq_init(&s);
> pevent_event_info(&s, event, data);
> g_value_set_string(value, s.buffer);


Attachment: signature.asc
Description: OpenPGP digital signature