From 86f3d84b4d12bc599df8dca2cc8d954746d67942 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 15 May 2009 12:33:59 +0000 Subject: [PATCH] Fix eventview trap handling And here is the offending code : eventhooks.c : int before_execmode_hook_trap(void *hook_data, void *call_data) if (tfc->tf->name != LTT_CHANNEL_KERNEL) return 0; minfo = marker_get_info_from_id(tfc->tf->mdata, e->event_id); g_assert(minfo != NULL); if (minfo->name == LTT_EVENT_TRAP_ENTRY || minfo->name == LTT_EVENT_PAGE_FAULT_ENTRY || minfo->name == LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY) { trap = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0)); } else if (minfo->name == LTT_EVENT_TRAP_EXIT || minfo->name == LTT_EVENT_PAGE_FAULT_EXIT || minfo->name == LTT_EVENT_PAGE_FAULT_NOSEM_EXIT) { trap = ts->cpu_states[cpu].last_trap; } else return 0; guint trace_num = ts->parent.index; /* Well, the process_out existed : we must get it in the process hash * or add it, and draw its items. */ /* Add process to process list (if not present) */ guint pl_height = 0; HashedResourceData *hashed_process_data = NULL; ProcessList *process_list = resourceview_data->process_list; hashed_process_data = resourcelist_obtain_trap(resourceview_data, trace_num, trap); we end up calling resourcelist_obtain_trap() with a trap id of 0. I bet the trace first has a trap exit event, without any prior trap entry. Therefore, the last_trap is probably set to -1, which is used as trap id. Signed-off-by: Mathieu Desnoyers git-svn-id: http://ltt.polymtl.ca/svn@3380 04897980-b3bd-0310-b5e0-8ef037075253 --- trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c | 3 +++ trunk/lttv/lttv/modules/gui/resourceview/processlist.c | 1 + 2 files changed, 4 insertions(+) diff --git a/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c b/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c index 563fc613..c6cb2550 100644 --- a/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c +++ b/trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c @@ -1201,6 +1201,9 @@ int before_execmode_hook_trap(void *hook_data, void *call_data) || minfo->name == LTT_EVENT_PAGE_FAULT_EXIT || minfo->name == LTT_EVENT_PAGE_FAULT_NOSEM_EXIT) { trap = ts->cpu_states[cpu].last_trap; + /* Handle case where a trace starts with a trap exit event */ + if (trap == -1) + return 0; } else return 0; diff --git a/trunk/lttv/lttv/modules/gui/resourceview/processlist.c b/trunk/lttv/lttv/modules/gui/resourceview/processlist.c index 1b07852c..ee24ba65 100644 --- a/trunk/lttv/lttv/modules/gui/resourceview/processlist.c +++ b/trunk/lttv/lttv/modules/gui/resourceview/processlist.c @@ -693,6 +693,7 @@ HashedResourceData *resourcelist_obtain_generic(ControlFlowData *resourceview_da /* Prepare hash key */ ru->ru.type = &(resourceview_data->process_list->restypes[res_type]); ru->trace_num = trace_num; + g_assert(id != -1); ru->id = id; /* Search within hash table */ -- 2.34.1