bugfixing in progress
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 19 Aug 2005 19:45:39 +0000 (19:45 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 19 Aug 2005 19:45:39 +0000 (19:45 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1019 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/facility.c
ltt/branches/poly/ltt/tracefile.c

index df3a498b1dbdab3ff46e6f4497cd50915a948f49..5b854131c6244652c328034dd4d1fd1a4b490d52 100644 (file)
@@ -602,6 +602,8 @@ guint8 ltt_facility_eventtype_number(LttFacility *f)
 
 LttEventType *ltt_facility_eventtype_get(LttFacility *f, guint8 i)
 {
+  if(!f->exists) return NULL;
+
   g_assert(i < f->events->len);
   return &g_array_index(f->events, LttEventType, i);
 }
index afec19efb1e4dba7b36a492ee6a10d1c033d6c03..694dadfe5e9b5a5c1de6ce5e5181fe882569039b 100644 (file)
@@ -1588,13 +1588,15 @@ void ltt_update_event_size(LttTracefile *tf)
   if(likely(tf->event.facility_id == LTT_FACILITY_CORE)) {
     switch((enum ltt_core_events)tf->event.event_id) {
   case LTT_EVENT_FACILITY_LOAD:
-    size = sizeof(struct LttFacilityLoad);
+    size = strlen((char*)tf->event.data);
+    size += sizeof(struct LttFacilityLoad);
     break;
   case LTT_EVENT_FACILITY_UNLOAD:
     size = sizeof(struct LttFacilityUnload);
     break;
   case LTT_EVENT_STATE_DUMP_FACILITY_LOAD:
-    size = sizeof(struct LttStateDumpFacilityLoad);
+    size = strlen((char*)tf->event.data);
+    size += sizeof(struct LttStateDumpFacilityLoad);
     break;
   case LTT_EVENT_HEARTBEAT:
     size = sizeof(TimeHeartbeat);
@@ -1608,16 +1610,37 @@ void ltt_update_event_size(LttTracefile *tf)
 
     }
   } else {
+    if(!f->exists) {
+      g_error("Unknown facility %hhu (0x%hhx) in tracefile %s",
+          tf->event.facility_id,
+          tf->event.facility_id,
+          g_quark_to_string(tf->name));
+      goto facility_error;
+    }
+
     LttEventType *event_type = 
       ltt_facility_eventtype_get(f, tf->event.event_id);
+
+    if(!event_type) {
+      g_error("Unknown event id %hhu in facility %s in tracefile %s",
+          tf->event.event_id,
+          g_quark_to_string(f->name),
+          g_quark_to_string(tf->name));
+      goto event_type_error;
+    }
+
     size = get_field_type_size(tf, event_type,
         0, 0, event_type->root_field, tf->event.data);
+    g_debug("Event root field : f.e %hhu.%hhu size %lu", tf->event.facility_id,
+        tf->event.event_id, size);
   }
   
   tf->event.data_size = size;
   
   return;
 
+facility_error:
+event_type_error:
 event_id_error:
   tf->event.data_size = 0;
 }
This page took 0.03391 seconds and 4 git commands to generate.