From: compudj Date: Fri, 19 Aug 2005 19:45:39 +0000 (+0000) Subject: bugfixing in progress X-Git-Tag: v0.12.20~2470 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c4afd5d8cb744919d71f3a44b4743060905d28dc;p=lttv.git bugfixing in progress git-svn-id: http://ltt.polymtl.ca/svn@1019 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index df3a498b..5b854131 100644 --- a/ltt/branches/poly/ltt/facility.c +++ b/ltt/branches/poly/ltt/facility.c @@ -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); } diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index afec19ef..694dadfe 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -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; }