From: compudj Date: Sat, 17 Dec 2005 03:55:46 +0000 (+0000) Subject: outstanding bugs fixed X-Git-Tag: v0.12.20~2076 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=743e50fd0105daeea4804d68989965399bf3a4d3;p=lttv.git outstanding bugs fixed git-svn-id: http://ltt.polymtl.ca/svn@1413 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/facilities/Makefile.am b/ltt/branches/poly/facilities/Makefile.am index 7425c3dc..e10a3da6 100644 --- a/ltt/branches/poly/facilities/Makefile.am +++ b/ltt/branches/poly/facilities/Makefile.am @@ -8,6 +8,7 @@ memory.xml \ network.xml \ process.xml \ socket.xml \ +statedump.xml \ timer.xml facilities_DATA = \ @@ -19,6 +20,7 @@ memory.xml \ network.xml \ process.xml \ socket.xml \ +statedump.xml \ timer.xml diff --git a/ltt/branches/poly/facilities/process.xml b/ltt/branches/poly/facilities/process.xml index e9f403e7..58133392 100644 --- a/ltt/branches/poly/facilities/process.xml +++ b/ltt/branches/poly/facilities/process.xml @@ -41,57 +41,57 @@ Process fork - PID of the parent process - PID of the child process + PID of the parent process + PID of the child process Just created a new kernel thread - PID of the kernel thread + PID of the kernel thread Function called Process exit - PID of the process + PID of the process Process wait - PID of the waiting process - PID of the process waited for + PID of the waiting process + PID of the process waited for Process kernel data structure free (end of life of a zombie) - PID of the freed process + PID of the freed process Process kill system call - PID of the process - PID of the process to kill + PID of the process + PID of the process to kill Signal number Process signal reception - PID of the receiving process + PID of the receiving process Signal number Process wakeup - PID of the receiving process - State of the awakened process. -1 unrunnable, 0 runnable, >0 stopped. + PID of the receiving process + State of the awakened process. -1 unrunnable, 0 runnable, >0 stopped. Scheduling change - Outgoing process - Incoming process - Outgoing process' state. -1 unrunnable, 0 runnable, >0 stopped. + Outgoing process + Incoming process + Outgoing process' state. -1 unrunnable, 0 runnable, >0 stopped. diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index f6db1817..6265f7fb 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -37,10 +37,8 @@ -void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, - void *root); - - +void compute_fields_offsets(LttTracefile *tf, + LttFacility *fac, LttField *field, off_t *offset, void *root); LttEvent *ltt_event_new() @@ -462,13 +460,13 @@ LttField *ltt_event_field_element_select(LttEvent *e, LttField *f, gulong i) if(f->field_type.type_class != LTT_ARRAY && f->field_type.type_class != LTT_SEQUENCE) - return ; + return NULL; element_number = ltt_event_field_element_number(e,f); event_type = ltt_event_eventtype(e); /* Sanity check for i : 0..n-1 only, and must be lower or equal element_number */ - if(i >= element_number) return; + if(i >= element_number) return NULL; if(f->field_type.type_class == LTT_ARRAY) { field = &g_array_index(f->field_type.fields, LttField, 0); @@ -478,14 +476,15 @@ LttField *ltt_event_field_element_select(LttEvent *e, LttField *f, gulong i) if(field->field_size != 0) { if(f->array_offset + (i * field->field_size) == field->offset_root) - return; /* fixed length child, already at the right offset */ + return field; /* fixed length child, already at the right offset */ else new_offset = f->array_offset + (i * field->field_size); } else { /* Var. len. child */ new_offset = g_array_index(f->dynamic_offsets, off_t, i); } - compute_fields_offsets(e->tracefile, field, &new_offset, e->data); + compute_fields_offsets(e->tracefile, + ltt_event_facility(e), field, &new_offset, e->data); return field; } @@ -691,7 +690,7 @@ size_t get_field_type_size(LttTracefile *tf, LttEventType *event_type, g_assert(field->fixed_size == FIELD_FIXED); size = field->field_size; align = ltt_align(field->offset_root, - size, event_type->facility->has_alignment); + size, event_type->facility->alignment); field->offset_root += align; field->offset_parent += align; size += align; @@ -791,14 +790,14 @@ size_t get_field_type_size(LttTracefile *tf, LttEventType *event_type, *Function name * compute_fields_offsets : set the precomputable offset of the fields *Input params - * tf : tracefile + * fac : facility * field : the field * offset : pointer to the current offset, must be incremented ****************************************************************************/ -void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, - void *root) +void compute_fields_offsets(LttTracefile *tf, + LttFacility *fac, LttField *field, off_t *offset, void *root) { LttType *type = &field->field_type; @@ -821,23 +820,29 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, case LTT_ENUM: if(field->fixed_root == FIELD_VARIABLE) { /* Align offset on type size */ - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; /* Increment offset */ *offset += field->field_size; + } else { + //g_debug("type before offset : %llu %llu %u\n", *offset, + // field->offset_root, + // field->field_size); + *offset = field->offset_root; + *offset += field->field_size; + //g_debug("type after offset : %llu\n", *offset); } - /* None of these types has variable size, so we are sure that if - * this element has a fixed_root, then the following one will have - * a fixed root too, so it does not need the *offset at all. - */ break; case LTT_STRING: if(field->fixed_root == FIELD_VARIABLE) { field->offset_root = *offset; } *offset += strlen((gchar*)(root+*offset)) + 1; + /* Realign the data */ + *offset += ltt_align(*offset, fac->pointer_size, + fac->alignment); break; case LTT_ARRAY: g_assert(type->fields->len == 1); @@ -845,8 +850,8 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, off_t local_offset; LttField *child = &g_array_index(type->fields, LttField, 0); if(field->fixed_root == FIELD_VARIABLE) { - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; field->array_offset = *offset; @@ -863,12 +868,12 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, 0); for(i=0; isize; i++) { g_array_append_val(field->dynamic_offsets, *offset); - compute_fields_offsets(tf, child, offset, root); + compute_fields_offsets(tf, fac, child, offset, root); } } // local_offset = field->array_offset; // /* Set the offset at position 0 */ - // compute_fields_offsets(tf, child, &local_offset, root); + // compute_fields_offsets(tf, fac, child, &local_offset, root); } break; case LTT_SEQUENCE: @@ -877,17 +882,18 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, off_t local_offset; LttField *child; guint i; + guint num_elem; if(field->fixed_root == FIELD_VARIABLE) { - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; child = &g_array_index(type->fields, LttField, 0); - compute_fields_offsets(tf, child, offset, root); + compute_fields_offsets(tf, fac, child, offset, root); child = &g_array_index(type->fields, LttField, 1); - *offset += ltt_align(*offset, get_alignment(tf, child), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(child), + fac->alignment); field->array_offset = *offset; } else { @@ -896,13 +902,20 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, *offset = field->array_offset; field->dynamic_offsets = g_array_set_size(field->dynamic_offsets, 0); - for(i=0; ievent, field); i++) { + num_elem = ltt_event_field_element_number(&tf->event, field); + for(i=0; idynamic_offsets, *offset); - compute_fields_offsets(tf, child, offset, root); + compute_fields_offsets(tf, fac, child, offset, root); } + g_assert(num_elem == field->dynamic_offsets->len); + + /* Realign the data */ + *offset += ltt_align(*offset, fac->pointer_size, + fac->alignment); + // local_offset = field->array_offset; // /* Set the offset at position 0 */ - // compute_fields_offsets(tf, child, &local_offset, root); + // compute_fields_offsets(tf, fac, child, &local_offset, root); } break; case LTT_STRUCT: @@ -911,8 +924,8 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, guint i; gint ret=0; if(field->fixed_root == FIELD_VARIABLE) { - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(fac, field), + fac->alignment); /* remember offset */ field->offset_root = *offset; } else { @@ -920,7 +933,7 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, } for(i=0; ifields->len; i++) { child = &g_array_index(type->fields, LttField, i); - compute_fields_offsets(tf, child, offset, root); + compute_fields_offsets(tf, fac, child, offset, root); } } break; @@ -930,15 +943,15 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, guint i; gint ret=0; if(field->fixed_root == FIELD_VARIABLE) { - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; } for(i=0; ifields->len; i++) { *offset = field->offset_root; child = &g_array_index(type->fields, LttField, i); - compute_fields_offsets(tf, child, offset, root); + compute_fields_offsets(tf, fac, child, offset, root); } *offset = field->offset_root + field->field_size; } @@ -959,17 +972,16 @@ void compute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset, * event : event type * ****************************************************************************/ -void compute_offsets(LttTracefile *tf, LttEventType *event, off_t *offset, - void *root) +void compute_offsets(LttTracefile *tf, LttFacility *fac, + LttEventType *event, off_t *offset, void *root) { guint i; - gint ret; /* compute all variable offsets */ for(i=0; ifields->len; i++) { + //g_debug("computing offset %u of %u\n", i, event->fields->len-1); LttField *field = &g_array_index(event->fields, LttField, i); - compute_fields_offsets(tf, field, offset, root); - if(ret) break; + compute_fields_offsets(tf, fac, field, offset, root); } } diff --git a/ltt/branches/poly/ltt/event.h b/ltt/branches/poly/ltt/event.h index 209ba361..f243851f 100644 --- a/ltt/branches/poly/ltt/event.h +++ b/ltt/branches/poly/ltt/event.h @@ -127,7 +127,7 @@ double ltt_event_get_double(LttEvent *e, LttField *f); gchar *ltt_event_get_string(LttEvent *e, LttField *f); -void compute_offsets(LttTracefile *tf, LttEventType *event, off_t *offset, - void *root); +void compute_offsets(LttTracefile *tf, LttFacility *fac, + LttEventType *event, off_t *offset, void *root); #endif // EVENT_H diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index 252c6759..1e49b8d2 100644 --- a/ltt/branches/poly/ltt/facility.c +++ b/ltt/branches/poly/ltt/facility.c @@ -294,7 +294,7 @@ void construct_fields(LttFacility *fac, type->enum_map = NULL; type->fields = NULL; type->fields_by_name = NULL; - + switch(td->type) { case INT_FIXED: type->type_class = LTT_INT_FIXED; @@ -315,6 +315,7 @@ void construct_fields(LttFacility *fac, case UCHAR: type->type_class = LTT_UCHAR; type->size = td->size; + g_assert(type->size != 0); break; case SHORT: type->type_class = LTT_SHORT; @@ -331,6 +332,7 @@ void construct_fields(LttFacility *fac, case UINT: type->type_class = LTT_UINT; type->size = fac->int_size; + g_assert(type->size != 0); break; case LONG: type->type_class = LTT_LONG; @@ -365,13 +367,14 @@ void construct_fields(LttFacility *fac, type->size = fac->int_size; { guint i; - type->enum_map = g_hash_table_new(g_int_hash, g_int_equal); + type->enum_map = g_hash_table_new(g_direct_hash, g_direct_equal); for(i=0; ilabels.position; i++) { GQuark value = g_quark_from_string((char*)td->labels.array[i]); gint key = *(int*)td->labels_values.array[i]; g_hash_table_insert(type->enum_map, (gpointer)key, (gpointer)value); } } + g_assert(type->size != 0); break; case ARRAY: type->type_class = LTT_ARRAY; diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index 8af6e3bf..72d2ebf0 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -460,7 +460,5 @@ static inline unsigned int ltt_align(size_t align_drift, return ((alignment - align_drift) & (alignment-1)); } -off_t field_align(LttTracefile *tf, LttField *field, off_t offset); - #endif /* LTT_PRIVATE_H */ diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c index bfa64564..921c559a 100644 --- a/ltt/branches/poly/ltt/parser.c +++ b/ltt/branches/poly/ltt/parser.c @@ -784,29 +784,29 @@ type_descriptor_t *parseType(parse_file_t *in, type_descriptor_t *inType, } else if(strcmp(token,"char") == 0) { t->type = CHAR; - t->size = 1; getTypeAttributes(in, t, unnamed_types, named_types); + t->size = 1; getForwardslash(in); getRAnglebracket(in); } else if(strcmp(token,"uchar") == 0) { t->type = UCHAR; - t->size = 1; getTypeAttributes(in, t, unnamed_types, named_types); + t->size = 1; getForwardslash(in); getRAnglebracket(in); } else if(strcmp(token,"short") == 0) { t->type = SHORT; - t->size = 2; getTypeAttributes(in, t, unnamed_types, named_types); + t->size = 2; getForwardslash(in); getRAnglebracket(in); } else if(strcmp(token,"ushort") == 0) { t->type = USHORT; - t->size = 2; getTypeAttributes(in, t, unnamed_types, named_types); + t->size = 2; getForwardslash(in); getRAnglebracket(in); } @@ -1344,8 +1344,7 @@ unsigned long getTypeChecksum(unsigned long aCrc, type_descriptor_t * type) flag = 1; break; case SEQUENCE: - sprintf(buf,"%zu", type->size); - str = appendString("sequence ",buf); + str = allocAndCopy("sequence "); flag = 1; break; case STRUCT: diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 5ddabdbd..5fbf53cb 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -106,7 +106,7 @@ static int ltt_seek_next_event(LttTracefile *tf); void ltt_update_event_size(LttTracefile *tf); -void precompute_offsets(LttTracefile *tf, LttEventType *event); +void precompute_offsets(LttFacility *fac, LttEventType *event); #if 0 /* Functions to parse system.xml file (using glib xml parser) */ @@ -951,6 +951,7 @@ static int ltt_process_facility_tracefile(LttTracefile *tf) struct LttFacilityLoad *fac_load_data; struct LttStateDumpFacilityLoad *fac_state_dump_load_data; char *fac_name; + void *pos; // FIXME align switch((enum ltt_core_events)tf->event.event_id) { @@ -958,9 +959,10 @@ static int ltt_process_facility_tracefile(LttTracefile *tf) fac_name = (char*)(tf->event.data); g_debug("Doing LTT_EVENT_FACILITY_LOAD of facility %s", fac_name); - fac_load_data = - (struct LttFacilityLoad *) - (tf->event.data + strlen(fac_name) + 1); + pos = (tf->event.data + strlen(fac_name) + 1); + pos += ltt_align((size_t)pos, sizeof(guint32), tf->has_alignment); + fac_load_data = (struct LttFacilityLoad *)pos; + fac = &g_array_index (tf->trace->facilities_by_num, LttFacility, ltt_get_uint32(LTT_GET_BO(tf), &fac_load_data->id)); /* facility may already exist if trace is paused/unpaused */ @@ -988,7 +990,7 @@ static int ltt_process_facility_tracefile(LttTracefile *tf) /* Preset the field offsets */ for(i=0; ievents->len; i++){ et = &g_array_index(fac->events, LttEventType, i); - precompute_offsets(tf, et); + precompute_offsets(fac, et); } fac->exists = 1; @@ -1013,9 +1015,10 @@ static int ltt_process_facility_tracefile(LttTracefile *tf) fac_name = (char*)(tf->event.data); g_debug("Doing LTT_EVENT_STATE_DUMP_FACILITY_LOAD of facility %s", fac_name); - fac_state_dump_load_data = - (struct LttStateDumpFacilityLoad *) - (tf->event.data + strlen(fac_name) + 1); + pos = (tf->event.data + strlen(fac_name) + 1); + pos += ltt_align((size_t)pos, sizeof(guint32), tf->has_alignment); + fac_state_dump_load_data = (struct LttStateDumpFacilityLoad *)pos; + fac = &g_array_index (tf->trace->facilities_by_num, LttFacility, ltt_get_uint32(LTT_GET_BO(tf), &fac_state_dump_load_data->id)); /* facility may already exist if trace is paused/unpaused */ @@ -1043,7 +1046,7 @@ static int ltt_process_facility_tracefile(LttTracefile *tf) /* Preset the field offsets */ for(i=0; ievents->len; i++){ et = &g_array_index(fac->events, LttEventType, i); - precompute_offsets(tf, et); + precompute_offsets(fac, et); } fac->exists = 1; @@ -1863,6 +1866,7 @@ void ltt_update_event_size(LttTracefile *tf) case LTT_EVENT_FACILITY_LOAD: size = strlen((char*)tf->event.data) + 1; //g_debug("Update Event facility load of facility %s", (char*)tf->event.data); + size += ltt_align(size, sizeof(guint32), tf->has_alignment); size += sizeof(struct LttFacilityLoad); break; case LTT_EVENT_FACILITY_UNLOAD: @@ -1871,6 +1875,7 @@ void ltt_update_event_size(LttTracefile *tf) break; case LTT_EVENT_STATE_DUMP_FACILITY_LOAD: size = strlen((char*)tf->event.data) + 1; + size += ltt_align(size, sizeof(guint32), tf->has_alignment); //g_debug("Update Event facility load state dump of facility %s", // (char*)tf->event.data); size += sizeof(struct LttStateDumpFacilityLoad); @@ -1908,7 +1913,7 @@ void ltt_update_event_size(LttTracefile *tf) } /* Compute the dynamic offsets */ - compute_offsets(tf, event_type, &size, tf->event.data); + compute_offsets(tf, f, event_type, &size, tf->event.data); //g_debug("Event root field : f.e %hhu.%hhu size %zd", // tf->event.facility_id, @@ -2044,13 +2049,12 @@ void set_fields_offsets(LttTracefile *tf, LttEventType *event_type) *Function name * get_alignment : Get the alignment needed for a field. *Input params - * tf : tracefile * field : field * * returns : The size on which it must be aligned. * ****************************************************************************/ -off_t get_alignment(LttTracefile *tf, LttField *field) +off_t get_alignment(LttField *field) { LttType *type = &field->field_type; @@ -2081,7 +2085,7 @@ off_t get_alignment(LttTracefile *tf, LttField *field) g_assert(type->fields->len == 1); { LttField *child = &g_array_index(type->fields, LttField, 0); - return get_alignment(tf, child); + return get_alignment(child); } break; case LTT_SEQUENCE: @@ -2090,10 +2094,10 @@ off_t get_alignment(LttTracefile *tf, LttField *field) off_t localign = 0; LttField *child = &g_array_index(type->fields, LttField, 0); - localign = max(localign, get_alignment(tf, child)); + localign = max(localign, get_alignment(child)); child = &g_array_index(type->fields, LttField, 1); - localign = max(localign, get_alignment(tf, child)); + localign = max(localign, get_alignment(child)); return localign; } @@ -2106,7 +2110,7 @@ off_t get_alignment(LttTracefile *tf, LttField *field) for(i=0; ifields->len; i++) { LttField *child = &g_array_index(type->fields, LttField, i); - localign = max(localign, get_alignment(tf, child)); + localign = max(localign, get_alignment(child)); } return localign; } @@ -2129,7 +2133,7 @@ off_t get_alignment(LttTracefile *tf, LttField *field) * ****************************************************************************/ -void field_compute_static_size(LttTracefile *tf, LttField *field) +void field_compute_static_size(LttFacility *fac, LttField *field) { LttType *type = &field->field_type; @@ -2159,7 +2163,7 @@ void field_compute_static_size(LttTracefile *tf, LttField *field) g_assert(type->fields->len == 1); { LttField *child = &g_array_index(type->fields, LttField, 0); - field_compute_static_size(tf, child); + field_compute_static_size(fac, child); if(child->field_size != 0) { field->field_size = type->size * child->field_size; @@ -2175,7 +2179,7 @@ void field_compute_static_size(LttTracefile *tf, LttField *field) { off_t local_offset = 0; LttField *child = &g_array_index(type->fields, LttField, 1); - field_compute_static_size(tf, child); + field_compute_static_size(fac, child); field->field_size = 0; type->size = 0; if(child->field_size != 0) { @@ -2190,10 +2194,10 @@ void field_compute_static_size(LttTracefile *tf, LttField *field) guint i; for(i=0;ifields->len;i++) { LttField *child = &g_array_index(type->fields, LttField, i); - field_compute_static_size(tf, child); + field_compute_static_size(fac, child); if(child->field_size != 0) { - type->size += ltt_align(type->size, get_alignment(tf, child), - tf->has_alignment); + type->size += ltt_align(type->size, get_alignment(child), + fac->alignment); type->size += child->field_size; } else { /* As soon as we find a child with variable size, we have @@ -2217,7 +2221,7 @@ void field_compute_static_size(LttTracefile *tf, LttField *field) *Function name * precompute_fields_offsets : set the precomputable offset of the fields *Input params - * tf : tracefile + * fac : facility * field : the field * offset : pointer to the current offset, must be incremented * @@ -2226,7 +2230,7 @@ void field_compute_static_size(LttTracefile *tf, LttField *field) ****************************************************************************/ -gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) +gint precompute_fields_offsets(LttFacility *fac, LttField *field, off_t *offset) { LttType *type = &field->field_type; @@ -2247,9 +2251,10 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) case LTT_OFF_T: case LTT_FLOAT: case LTT_ENUM: + g_assert(field->field_size != 0); /* Align offset on type size */ - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; field->fixed_root = FIELD_FIXED; @@ -2267,8 +2272,8 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) { LttField *child = &g_array_index(type->fields, LttField, 0); - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; @@ -2294,23 +2299,23 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) LttField *child; guint ret; - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; field->fixed_root = FIELD_FIXED; child = &g_array_index(type->fields, LttField, 0); - ret = precompute_fields_offsets(tf, child, offset); + ret = precompute_fields_offsets(fac, child, offset); g_assert(ret == 0); /* Seq len cannot have variable len */ child = &g_array_index(type->fields, LttField, 1); - *offset += ltt_align(*offset, get_alignment(tf, child), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(child), + fac->alignment); field->array_offset = *offset; - /* Set the offset position at position 0 */ - ret = precompute_fields_offsets(tf, child, offset); + /* Let the child be variable. */ + //ret = precompute_fields_offsets(fac, child, offset); /* Cannot precompute fields offsets of sequence members, and has * variable length. */ @@ -2323,15 +2328,15 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) guint i; gint ret=0; - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; field->fixed_root = FIELD_FIXED; for(i=0; i< type->fields->len; i++) { child = &g_array_index(type->fields, LttField, i); - ret = precompute_fields_offsets(tf, child, offset); + ret = precompute_fields_offsets(fac, child, offset); if(ret) break; } @@ -2344,8 +2349,8 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) guint i; gint ret=0; - *offset += ltt_align(*offset, get_alignment(tf, field), - tf->has_alignment); + *offset += ltt_align(*offset, get_alignment(field), + fac->alignment); /* remember offset */ field->offset_root = *offset; field->fixed_root = FIELD_FIXED; @@ -2353,7 +2358,7 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) for(i=0; i< type->fields->len; i++) { *offset = field->offset_root; child = &g_array_index(type->fields, LttField, i); - ret = precompute_fields_offsets(tf, child, offset); + ret = precompute_fields_offsets(fac, child, offset); if(ret) break; } @@ -2379,7 +2384,7 @@ gint precompute_fields_offsets(LttTracefile *tf, LttField *field, off_t *offset) * event : event type * ****************************************************************************/ -void precompute_offsets(LttTracefile *tf, LttEventType *event) +void precompute_offsets(LttFacility *fac, LttEventType *event) { guint i; off_t offset = 0; @@ -2389,13 +2394,13 @@ void precompute_offsets(LttTracefile *tf, LttEventType *event) * arrays, struct and unions, which is not done by the parser */ for(i=0; ifields->len; i++) { LttField *field = &g_array_index(event->fields, LttField, i); - field_compute_static_size(tf, field); + field_compute_static_size(fac, field); } /* Precompute all known offsets */ for(i=0; ifields->len; i++) { LttField *field = &g_array_index(event->fields, LttField, i); - ret = precompute_fields_offsets(tf, field, &offset); + ret = precompute_fields_offsets(fac, field, &offset); if(ret) break; } } diff --git a/ltt/branches/poly/lttv/lttv/print.c b/ltt/branches/poly/lttv/lttv/print.c index 84f3af79..50c7c674 100644 --- a/ltt/branches/poly/lttv/lttv/print.c +++ b/ltt/branches/poly/lttv/lttv/print.c @@ -190,6 +190,9 @@ void lttv_event_to_string(LttEvent *e, GString *s, event_type = ltt_event_eventtype(e); num_fields = ltt_eventtype_num_fields(event_type); + if(num_fields == 0) return; + g_string_append_printf(s, " "); + g_string_append_printf(s, "{ "); for(i=0; iparent.t_context; LttEvent *e = ltt_tracefile_get_event(s->parent.tf); LttvTraceHookByFacility *thf = (LttvTraceHookByFacility *)hook_data; - gchar *name; + //gchar *name; guint cpu = ltt_tracefile_num(s->parent.tf); LttvProcessState *process = ts->running_process[cpu]; /* PID of the process to release */ - name = ltt_event_get_string(e, thf->f1); - - process->name = g_quark_from_string(name); + guint64 name_len = ltt_event_field_element_number(e, thf->f1); + //name = ltt_event_get_string(e, thf->f1); + gchar *name_begin = ltt_event_field_element_select(e, thf->f1, 0); + gchar *null_term_name = g_new(gchar, name_len+1); + memcpy(null_term_name, name_begin, name_len); + null_term_name[name_len] = '\0'; + + process->name = g_quark_from_string(null_term_name); return FALSE; }