Fix eventview trap handling
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 15 May 2009 12:33:59 +0000 (12:33 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 15 May 2009 12:33:59 +0000 (12:33 +0000)
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 <mathieu.desnoyers@polymtl.ca>
git-svn-id: http://ltt.polymtl.ca/svn@3380 04897980-b3bd-0310-b5e0-8ef037075253

trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c
trunk/lttv/lttv/modules/gui/resourceview/processlist.c

index 563fc613249f32b7817cfa319c9f52cbda4a22fb..c6cb2550d8f41f7d44722535b28d14abab8a178c 100644 (file)
@@ -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;
 
index 1b07852c47967ea6efa7ebd5264eaa8c19fa6c14..ee24ba65600ac126780b69be3780214f49b5a7c5 100644 (file)
@@ -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 */
This page took 0.025879 seconds and 4 git commands to generate.