evType->facility = f;
evType->index = i;
- field->field_pos = 0;
- type = lookup_named_type(f,((event*)(events->array[i]))->type);
- field->field_type = type;
- field->offset_root = 0;
- field->fixed_root = 1;
- field->offset_parent = 0;
- field->fixed_parent = 1;
- // field->base_address = NULL;
- field->field_size = 0;
- field->field_fixed = -1;
- field->parent = NULL;
- field->child = NULL;
- field->current_element = 0;
-
- //construct field tree and type graph
- constructTypeAndFields(f,((event*)(events->array[i]))->type,field);
+ if(((event*)(events->array[i]))->type != NULL){
+ field->field_pos = 0;
+ type = lookup_named_type(f,((event*)(events->array[i]))->type);
+ field->field_type = type;
+ field->offset_root = 0;
+ field->fixed_root = 1;
+ field->offset_parent = 0;
+ field->fixed_parent = 1;
+ // field->base_address = NULL;
+ field->field_size = 0;
+ field->field_fixed = -1;
+ field->parent = NULL;
+ field->child = NULL;
+ field->current_element = 0;
+
+ //construct field tree and type graph
+ constructTypeAndFields(f,((event*)(events->array[i]))->type,field);
+ }else{
+ evType->root_field = NULL;
+ g_free(field);
+ }
}
}
// Is the file large enough to contain a trace
if(lTDFStat.st_size < sizeof(BlockStart) + EVENT_HEADER_SIZE){
- g_error("The input data file %s does not contain a trace\n", fileName);
+ g_print("The input data file %s does not contain a trace\n", fileName);
+ return NULL;
}
//store the size of the file
int i;
tf = ltt_tracefile_open(t,control_name);
+ if(!tf) return;
t->control_tracefile_number++;
g_ptr_array_add(t->control_tracefiles,tf);
for(i=0;i<entry_number;i++){
if(fgets(buf,DIR_NAME_SIZE, fp)== NULL)
g_error("Not a valid file: %s\n", pathname);
+ buf[strlen(buf)-1] = '\0';
ptr = buf;
while(isspace(*ptr)) ptr++;
switch(i){
if(strncmp("ltt_major_version=",ptr,18)!=0)
g_error("Not a valid file: %s\n", pathname);
ptr += 18;
- ptr++;//skip begining "
- ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
+ // ptr++;//skip begining "
+ // ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
des->ltt_major_version = (unsigned)atoi(ptr);
break;
case 13:
if(strncmp("ltt_minor_version=",ptr,18)!=0)
g_error("Not a valid file: %s\n", pathname);
ptr += 18;
- ptr++;//skip begining "
- ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
+ // ptr++;//skip begining "
+ // ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
des->ltt_minor_version = (unsigned)atoi(ptr);
break;
case 14:
if(strncmp("ltt_block_size=",ptr,15)!=0)
g_error("Not a valid file: %s\n", pathname);
ptr += 15;
- ptr++;//skip begining "
- ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
+ // ptr++;//skip begining "
+ // ptr[strlen(ptr)-1] = '\0'; //get rid of the ending "
des->ltt_block_size = (unsigned)atoi(ptr);
break;
default:
closedir(dir);
for(j=0;j<t->facility_number;j++){
- f = (LttFacility*)g_ptr_array_index(t->facilities, i);
+ f = (LttFacility*)g_ptr_array_index(t->facilities, j);
for(i=0; i<f->event_number; i++){
et = f->events[i];
setFieldsOffset(NULL, et, NULL, t);
if(!dir) g_error("Can not open directory: %s\n", control);
while((entry = readdir(dir)) != NULL){
- if(strcmp(entry->d_name,"facilities") != 0 ||
- strcmp(entry->d_name,"interrupts") != 0 ||
+ if(strcmp(entry->d_name,"facilities") != 0 &&
+ strcmp(entry->d_name,"interrupts") != 0 &&
strcmp(entry->d_name,"processes") != 0) continue;
strcpy(name,control);
if(!dir) g_error("Can not open directory: %s\n", cpu);
while((entry = readdir(dir)) != NULL){
- if(strcmp(entry->d_name,".") != 0 ||
+ if(strcmp(entry->d_name,".") != 0 &&
strcmp(entry->d_name,"..") != 0 ){
strcpy(name,cpu);
strcat(name,entry->d_name);
LttField * rootFld = evT->root_field;
// rootFld->base_address = evD;
- rootFld->field_size = getFieldtypeSize(tf, evT, 0,0,rootFld, evD,t);
+ if(rootFld)
+ rootFld->field_size = getFieldtypeSize(tf, evT, 0,0,rootFld, evD,t);
}
/*****************************************************************************
int size, size1, element_number, i, offset1, offset2;
LttType * type = fld->field_type;
- if(!t){
+ if(t){
if(evT->latest_block==t->which_block && evT->latest_event==t->which_event){
return fld->field_size;
}