resourceview: make resource accessing api more generic
[lttv.git] / ltt / branches / poly / lttv / lttv / state.c
index b15c616847d77276471919f5f1808a1eab055ac7..7835b708d2a33a097b9d037634f368bb0047281e 100644 (file)
@@ -253,7 +253,10 @@ static void lttv_state_free_usertraces(GHashTable *usertraces)
   g_hash_table_destroy(usertraces);
 }
 
-
+gboolean rettrue(gpointer key, gpointer value, gpointer user_data)
+{
+       return TRUE;
+}
 
 static void
 restore_init_state(LttvTraceState *self)
@@ -316,7 +319,8 @@ restore_init_state(LttvTraceState *self)
 
   /* reset bdev states */
   g_hash_table_foreach(self->bdev_states, bdevstate_free_cb, NULL);
-  g_hash_table_steal_all(self->bdev_states);
+  //g_hash_table_steal_all(self->bdev_states);
+  g_hash_table_foreach_steal(self->bdev_states, rettrue, NULL);
   
 #if 0
   nb_tracefile = self->parent.tracefiles->len;
@@ -1155,7 +1159,7 @@ static void lttv_state_free_cpu_states(LttvCPUState *states, guint n)
   guint i;
 
   for(i=0; i<n; i++) {
-    g_array_free(states[i].mode_stack, FALSE);
+    g_array_free(states[i].mode_stack, TRUE);
   }
 
   g_free(states);
@@ -1184,7 +1188,7 @@ static void lttv_state_free_irq_states(LttvIRQState *states, guint n)
   guint i;
 
   for(i=0; i<n; i++) {
-    g_array_free(states[i].mode_stack, FALSE);
+    g_array_free(states[i].mode_stack, TRUE);
   }
 
   g_free(states);
@@ -1221,7 +1225,7 @@ static LttvBdevState *bdevstate_new(void)
 
 static void bdevstate_free(LttvBdevState *bds)
 {
-  g_array_free(bds->mode_stack, FALSE);
+  g_array_free(bds->mode_stack, TRUE);
   g_free(bds);
 }
 
@@ -2139,7 +2143,7 @@ lttv_state_find_process_or_create(LttvTraceState *ts, guint cpu, guint pid,
  * the parent waits for its child terminaison, but may also happen in special
  * cases in the child's exit : when the parent ignores its children SIGCCHLD or
  * has the flag SA_NOCLDWAIT. It can also happen when the child is part
- * of a killed thread ground, but isn't the leader.
+ * of a killed thread group, but isn't the leader.
  */
 static void exit_process(LttvTracefileState *tfs, LttvProcessState *process) 
 {
@@ -2546,7 +2550,7 @@ static gboolean schedchange(void *hook_data, void *call_data)
         process->state->change = s->parent.timestamp;
       }
       
-      if(state_out == 32 || state_out == 128)
+      if(state_out == 32 || state_out == 64)
          exit_process(s, process); /* EXIT_DEAD || TASK_DEAD */
             /* see sched.h for states */
     }
@@ -2565,9 +2569,18 @@ static gboolean schedchange(void *hook_data, void *call_data)
 
   /* update cpu status */
   if(pid_in == 0)
+    /* going to idle task */
     cpu_set_base_mode(s->cpu_state, LTTV_CPU_IDLE);
-  else
+  else {
+    /* scheduling a real task.
+     * we must be careful here:
+     * if we just schedule()'ed to a process that is
+     * in a trap, we must put the cpu in trap mode
+     */
     cpu_set_base_mode(s->cpu_state, LTTV_CPU_BUSY);
+    if(process->state->t == LTTV_STATE_TRAP)
+      cpu_push_mode(s->cpu_state, LTTV_CPU_TRAP);
+  }
 
   return FALSE;
 }
This page took 0.023473 seconds and 4 git commands to generate.