fixes coming from the powerpc port
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 12 May 2006 22:19:04 +0000 (22:19 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 12 May 2006 22:19:04 +0000 (22:19 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1794 04897980-b3bd-0310-b5e0-8ef037075253

12 files changed:
genevent/parser.c
genevent/parser.h
ltt/branches/poly/configure.in
ltt/branches/poly/ltt/event.c
ltt/branches/poly/ltt/ltt-private.h
ltt/branches/poly/ltt/ltt.h
ltt/branches/poly/ltt/parser.c
ltt/branches/poly/ltt/parser.h
ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/ltt/type.c
ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c

index 1ab1b73bf7bf256ac23f468d95482c31584cfc33..3bc227cfb154b9c5b9993d7cb93713428eb05865 100644 (file)
@@ -97,7 +97,7 @@ int getSizeindex(unsigned int value)
 unsigned long long int getSize(parse_file_t *in)
 {
   char *token, *token2;
-       unsigned long long int ret;
+  unsigned long long int ret;
 
   token = getToken(in);
 
@@ -198,7 +198,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
                           sequence_t * unnamed_types, table_t * named_types) 
 {
   char * token;
-       char car;
+  int car;
 
   t->fmt = NULL;
   t->size = 0;
@@ -263,7 +263,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
 void getEventAttributes(parse_file_t *in, event_t *ev)
 {
   char * token;
-  char car;
+  int car;
   
   ev->name = NULL;
   ev->per_trace = 0;
@@ -326,7 +326,7 @@ void getEventAttributes(parse_file_t *in, event_t *ev)
 void getFacilityAttributes(parse_file_t *in, facility_t *fac)
 {
   char * token;
-  char car;
+  int car;
   
   fac->name = NULL;
   fac->arch = NULL;
@@ -371,7 +371,7 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
 void getFieldAttributes(parse_file_t *in, field_t *f)
 {
   char * token;
-  char car;
+  int car;
 
   f->name = NULL;
 
@@ -396,7 +396,7 @@ char *getNameAttribute(parse_file_t *in)
 {
   char * token;
   char *name = NULL;
-  char car;
+  int car;
   
   while(1) {
     token = getToken(in); 
@@ -459,7 +459,8 @@ error:
 char * getDescription(parse_file_t *in)
 {
   long int pos;
-  char * token, car, *str;
+  char * token, *str;
+  int car;
 
   pos = ftell(in->fp);
 
@@ -1127,9 +1128,9 @@ char * getEqual(parse_file_t *in)
   return token;
 }
 
-char seekNextChar(parse_file_t *in)
+int seekNextChar(parse_file_t *in)
 {
-  char car;
+  int car;
   while((car = getc(in->fp)) != EOF) {
     if(!isspace(car)){
       ungetc(car,in->fp);
@@ -1162,7 +1163,7 @@ void ungetToken(parse_file_t * in)
 char *getToken(parse_file_t * in)
 {
   FILE *fp = in->fp;
-  char car, car1;
+  int car, car1;
   int pos = 0, escaped;
 
   if(in->unget == 1) {
@@ -1274,7 +1275,7 @@ char *getToken(parse_file_t * in)
 
 void skipComment(parse_file_t * in)
 {
-  char car;
+  int car;
   while((car = getc(in->fp)) != EOF) {
     if(car == '\n') in->lineno++;
     else if(car == '*') {
@@ -1289,7 +1290,7 @@ void skipComment(parse_file_t * in)
 
 void skipEOL(parse_file_t * in)
 {
-  char car;
+  int car;
   while((car = getc(in->fp)) != EOF) {
     if(car == '\n') {
       ungetc(car,in->fp);
index ec360f8444ce5b3466f49abb3004282427961a25..a447d6db03c3cca91b1bbc727cd8911aa1959bfb 100644 (file)
@@ -64,7 +64,7 @@ char *getQuotedString(parse_file_t *in);
 char *getName(parse_file_t *in);
 int   getNumber(parse_file_t *in);
 char *getEqual(parse_file_t *in);
-char  seekNextChar(parse_file_t *in);
+int   seekNextChar(parse_file_t *in);
 
 void skipComment(parse_file_t * in);
 void skipEOL(parse_file_t * in);
index e1b76ce8b16158e8ff796e0e365ee0fdea55c5f4..7aa7f90da2a74e5d0151fb0220698af6cd17ccbb 100644 (file)
@@ -23,7 +23,7 @@
 AC_PREREQ(2.57)
 AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
 #AC_WITH_LTDL  # not needed ?
-AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.40-06052006)
+AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.41-10052006)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
index 67c689b67ee9e6a4d77708e5ace2b9c9e7c3547e..17e9688a14ce5d82a00704dd0bb45bfd8414ece1 100644 (file)
@@ -687,7 +687,7 @@ void compute_fields_offsets(LttTracefile *tf,
         guint i;
         gint ret=0;
         if(field->fixed_root == FIELD_VARIABLE) {
-          *offset += ltt_align(*offset, get_alignment(fac, field),
+          *offset += ltt_align(*offset, get_alignment(field),
                                fac->alignment);
           /* remember offset */
           field->offset_root = *offset;
index eceadc437c36f12879912ccb0fb109c889839add..9b9d2f5079f0719e285af7b9d2bd6cd3077a9909 100644 (file)
@@ -440,19 +440,22 @@ struct _LttSystemDescription {
 //#define EVENT_HEADER_SIZE (TIMESTAMP_SIZE + EVENT_ID_SIZE)
 
 
+off_t get_alignment(LttField *field);
+
 /* Calculate the offset needed to align the type.
  * If has_alignment is 0, alignment is disactivated.
  * else, the function returns the offset needed to
  * align align_drift on the has_alignment value (should be
  * the size of the architecture). */
 static inline unsigned int ltt_align(size_t align_drift,
-                                                                                                                                                size_t size_of_type,
-                                                                                                                                                size_t has_alignment)
+          size_t size_of_type,
+          size_t has_alignment)
 {
        size_t alignment = min(has_alignment, size_of_type);
        
        if(!has_alignment) return 0;
        
+       g_assert(size_of_type != 0);
        return ((alignment - align_drift) & (alignment-1));
 }
 
index df1a2339d3b889fd396387c948a9efd1ebba9eb5..57298fe0dc240be48b07362ff922fc7f6718d3ae 100644 (file)
@@ -167,6 +167,7 @@ typedef enum _LttTypeEnum
 #define LTT_ARCH_TYPE_PPC64         7
 #define LTT_ARCH_TYPE_X86_64        8
 #define LTT_ARCH_TYPE_C2                 9
+#define LTT_ARCH_TYPE_POWERPC            10
 
 /* Standard definitions for variants */
 #define LTT_ARCH_VARIANT_NONE       0  /* Main architecture implementation */
index 1ab1b73bf7bf256ac23f468d95482c31584cfc33..3bc227cfb154b9c5b9993d7cb93713428eb05865 100644 (file)
@@ -97,7 +97,7 @@ int getSizeindex(unsigned int value)
 unsigned long long int getSize(parse_file_t *in)
 {
   char *token, *token2;
-       unsigned long long int ret;
+  unsigned long long int ret;
 
   token = getToken(in);
 
@@ -198,7 +198,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
                           sequence_t * unnamed_types, table_t * named_types) 
 {
   char * token;
-       char car;
+  int car;
 
   t->fmt = NULL;
   t->size = 0;
@@ -263,7 +263,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
 void getEventAttributes(parse_file_t *in, event_t *ev)
 {
   char * token;
-  char car;
+  int car;
   
   ev->name = NULL;
   ev->per_trace = 0;
@@ -326,7 +326,7 @@ void getEventAttributes(parse_file_t *in, event_t *ev)
 void getFacilityAttributes(parse_file_t *in, facility_t *fac)
 {
   char * token;
-  char car;
+  int car;
   
   fac->name = NULL;
   fac->arch = NULL;
@@ -371,7 +371,7 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
 void getFieldAttributes(parse_file_t *in, field_t *f)
 {
   char * token;
-  char car;
+  int car;
 
   f->name = NULL;
 
@@ -396,7 +396,7 @@ char *getNameAttribute(parse_file_t *in)
 {
   char * token;
   char *name = NULL;
-  char car;
+  int car;
   
   while(1) {
     token = getToken(in); 
@@ -459,7 +459,8 @@ error:
 char * getDescription(parse_file_t *in)
 {
   long int pos;
-  char * token, car, *str;
+  char * token, *str;
+  int car;
 
   pos = ftell(in->fp);
 
@@ -1127,9 +1128,9 @@ char * getEqual(parse_file_t *in)
   return token;
 }
 
-char seekNextChar(parse_file_t *in)
+int seekNextChar(parse_file_t *in)
 {
-  char car;
+  int car;
   while((car = getc(in->fp)) != EOF) {
     if(!isspace(car)){
       ungetc(car,in->fp);
@@ -1162,7 +1163,7 @@ void ungetToken(parse_file_t * in)
 char *getToken(parse_file_t * in)
 {
   FILE *fp = in->fp;
-  char car, car1;
+  int car, car1;
   int pos = 0, escaped;
 
   if(in->unget == 1) {
@@ -1274,7 +1275,7 @@ char *getToken(parse_file_t * in)
 
 void skipComment(parse_file_t * in)
 {
-  char car;
+  int car;
   while((car = getc(in->fp)) != EOF) {
     if(car == '\n') in->lineno++;
     else if(car == '*') {
@@ -1289,7 +1290,7 @@ void skipComment(parse_file_t * in)
 
 void skipEOL(parse_file_t * in)
 {
-  char car;
+  int car;
   while((car = getc(in->fp)) != EOF) {
     if(car == '\n') {
       ungetc(car,in->fp);
index ec360f8444ce5b3466f49abb3004282427961a25..a447d6db03c3cca91b1bbc727cd8911aa1959bfb 100644 (file)
@@ -64,7 +64,7 @@ char *getQuotedString(parse_file_t *in);
 char *getName(parse_file_t *in);
 int   getNumber(parse_file_t *in);
 char *getEqual(parse_file_t *in);
-char  seekNextChar(parse_file_t *in);
+int   seekNextChar(parse_file_t *in);
 
 void skipComment(parse_file_t * in);
 void skipEOL(parse_file_t * in);
index 021e2b4e897b92b0dc18679d95b172f334a280d6..f28a1b21e25c5414ae798739a4a8498c15c161dc 100644 (file)
@@ -997,6 +997,9 @@ static int ltt_get_facility_description(LttFacility *f,
                        case LTT_ARCH_TYPE_C2:
                                text = "_c2";
                                break;
+                       case LTT_ARCH_TYPE_POWERPC:
+                               text = "_powerpc";
+                               break;
                        default:
                                g_error("Trace from unsupported architecture.");
                }
@@ -1091,8 +1094,8 @@ static int ltt_process_facility_tracefile(LttTracefile *tf)
           fac->id = ltt_get_uint32(LTT_GET_BO(tf), &fac_load_data->id);
           fac->pointer_size = ltt_get_uint32(LTT_GET_BO(tf),
                           &fac_load_data->pointer_size);
-                                       fac->int_size = ltt_get_uint32(LTT_GET_BO(tf),
-                                                                                                       &fac_load_data->int_size);
+          fac->int_size = ltt_get_uint32(LTT_GET_BO(tf),
+                          &fac_load_data->int_size);
           fac->long_size = ltt_get_uint32(LTT_GET_BO(tf),
                           &fac_load_data->long_size);
           fac->size_t_size = ltt_get_uint32(LTT_GET_BO(tf),
@@ -1148,8 +1151,8 @@ static int ltt_process_facility_tracefile(LttTracefile *tf)
                           &fac_state_dump_load_data->id);
           fac->pointer_size = ltt_get_uint32(LTT_GET_BO(tf),
                           &fac_state_dump_load_data->pointer_size);
-                                       fac->int_size = ltt_get_uint32(LTT_GET_BO(tf),
-                                                                                                       &fac_state_dump_load_data->int_size);
+          fac->int_size = ltt_get_uint32(LTT_GET_BO(tf),
+                          &fac_state_dump_load_data->int_size);
           fac->long_size = ltt_get_uint32(LTT_GET_BO(tf),
                           &fac_state_dump_load_data->long_size);
           fac->size_t_size = ltt_get_uint32(LTT_GET_BO(tf),
@@ -2228,10 +2231,11 @@ off_t get_alignment(LttField *field)
     case LTT_FLOAT:
     case LTT_ENUM:
       /* Align offset on type size */
+      g_assert(field->field_size != 0);
       return field->field_size;
       break;
     case LTT_STRING:
-      return 0;
+      return 1;
       break;
     case LTT_ARRAY:
       g_assert(type->fields->len == 1);
@@ -2243,7 +2247,7 @@ off_t get_alignment(LttField *field)
     case LTT_SEQUENCE:
       g_assert(type->fields->len == 2);
       {
-        off_t localign = 0;
+        off_t localign = 1;
         LttField *child = &g_array_index(type->fields, LttField, 0);
 
         localign = max(localign, get_alignment(child));
@@ -2258,7 +2262,7 @@ off_t get_alignment(LttField *field)
     case LTT_UNION:
       {
         guint i;
-        off_t localign = 0;
+        off_t localign = 1;
         
         for(i=0; i<type->fields->len; i++) {
           LttField *child = &g_array_index(type->fields, LttField, i);
@@ -2270,8 +2274,8 @@ off_t get_alignment(LttField *field)
     case LTT_NONE:
     default:
       g_error("get_alignment : unknown type");
+      return -1;
   }
-
 }
 
 /*****************************************************************************
@@ -2614,6 +2618,12 @@ void preset_field_type_size(LttTracefile *tf, LttEventType *event_type,
   size_t max_size;
 
   switch(type->type_class) {
+    case LTT_INT_FIXED:
+    case LTT_UINT_FIXED:
+    case LTT_CHAR:
+    case LTT_UCHAR:
+    case LTT_SHORT:
+    case LTT_USHORT:
     case LTT_INT:
     case LTT_UINT:
     case LTT_FLOAT:
@@ -2725,6 +2735,9 @@ void preset_field_type_size(LttTracefile *tf, LttEventType *event_type,
         field->fixed_size = FIELD_FIXED;
       }
       break;
+    case LTT_NONE:
+      g_error("unexpected type NONE");
+      break;
   }
 
 }
@@ -2892,6 +2905,13 @@ gint check_fields_compatibility(LttEventType *event_type1,
   }
     
   switch(type1->type_class) {
+    case LTT_INT_FIXED:
+    case LTT_UINT_FIXED:
+    case LTT_POINTER:
+    case LTT_CHAR:
+    case LTT_UCHAR:
+    case LTT_SHORT:
+    case LTT_USHORT:
     case LTT_INT:
     case LTT_UINT:
     case LTT_FLOAT:
index a1563d04a494e776f5195e9b51074dd5b09aca18..d759f325d4a121bba3a78174671bce4bb10d093b 100644 (file)
@@ -146,10 +146,14 @@ size_t ltt_type_size(LttTrace * trace, LttType *t)
   size_t size;
 
   switch(t->type_class) {
-
+    case LTT_INT_FIXED:
+    case LTT_UINT_FIXED:
+    case LTT_CHAR:
+    case LTT_UCHAR:
+    case LTT_SHORT:
+    case LTT_USHORT:
     case LTT_INT:
     case LTT_UINT:
-    case LTT_SEQUENCE:
     case LTT_ENUM:
       if(likely(t->size < INT_SIZES_NUMBER))
         size = intSizes[t->size];
@@ -167,11 +171,13 @@ size_t ltt_type_size(LttTrace * trace, LttType *t)
     case LTT_ULONG:
     case LTT_SIZE_T:
     case LTT_SSIZE_T:
+    case LTT_SEQUENCE:
     case LTT_OFF_T:
     case LTT_STRING:
     case LTT_ARRAY:
     case LTT_STRUCT:
     case LTT_UNION:
+    case LTT_NONE:
       goto error;
       break;
   }
@@ -371,7 +377,7 @@ int ltt_field_size(LttField * f)
 
 guint ltt_eventtype_num_fields(LttEventType *event_type)
 {
-  if(unlikely(!event_type)) return NULL;
+  if(unlikely(!event_type)) return 0;
 
   return event_type->fields->len;
   
index 1369be5e68576d37a91e266814d2bfcfb80f03a7..05ea74f1d866993b9f7dd02a2d17c3a422aed4d4 100644 (file)
@@ -2640,7 +2640,7 @@ lttv_tracefile_state_get_type(void)
 
 static void module_init()
 {
-  LTTV_STATE_UNNAMED = g_quark_from_string("unnamed");
+  LTTV_STATE_UNNAMED = g_quark_from_string("UNNAMED");
   LTTV_STATE_MODE_UNKNOWN = g_quark_from_string("MODE_UNKNOWN");
   LTTV_STATE_USER_MODE = g_quark_from_string("USER_MODE");
   LTTV_STATE_SYSCALL = g_quark_from_string("SYSCALL");
index 43b15af751357fcfb7c60be7ccc7280e36f1ba36..95f3887c048b9059edf7e6bb4ecfff683a1783e0 100644 (file)
@@ -178,6 +178,7 @@ void drawing_data_request(Drawing_t *drawing,
     LttvTraceHookByFacility *thf;
 
     guint ret;
+    gint before_hn, after_hn;
 
     nb_trace = lttv_traceset_number(traceset);
     // FIXME : eventually request for more traces
@@ -221,6 +222,7 @@ void drawing_data_request(Drawing_t *drawing,
 
       hooks = g_array_new(FALSE, FALSE, sizeof(LttvTraceHook));
       hooks = g_array_set_size(hooks, 16);
+      before_hn = after_hn = 0;
 
       /* before hooks */
       
@@ -229,64 +231,64 @@ void drawing_data_request(Drawing_t *drawing,
           LTT_FIELD_SYSCALL_ID, 0, 0,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 0));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
           0, 0, 0,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 1));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_ENTRY,
           LTT_FIELD_TRAP_ID, 0, 0,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 2));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_EXIT,
           0, 0, 0, 
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 3));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
           LTT_FIELD_IRQ_ID, 0, 0,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 4));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
           0, 0, 0, 
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 5));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
           LTT_FIELD_SOFT_IRQ_ID, 0, 0,
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 6));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
           0, 0, 0, 
           before_execmode_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 7));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
 
       ret = lttv_trace_find_hook(ts->parent.t,
@@ -294,38 +296,38 @@ void drawing_data_request(Drawing_t *drawing,
           LTT_FIELD_OUT, LTT_FIELD_IN, LTT_FIELD_OUT_STATE,
           before_schedchange_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 8));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_PROCESS, LTT_EVENT_EXIT,
           LTT_FIELD_PID, 0, 0,
           before_process_exit_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 9));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
       
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_PROCESS, LTT_EVENT_FREE,
           LTT_FIELD_PID, 0, 0,
           before_process_release_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 10));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, before_hn++));
+      if(ret) before_hn--;
 
 
 #if 0
       lttv_trace_find_hook(ts->parent.t,
           "core", "process", "event_sub_id", 
           "event_data1", "event_data2", before_process_hook,
-          &g_array_index(hooks, LttvTraceHook, 7));
+          &g_array_index(hooks, LttvTraceHook, hn++));
 #endif //0
 #if 0
       lttv_trace_find_hook(ts->parent.t, "core", "process_fork", "child_pid", 
-          NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, 7));
+          NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, hn++));
 
       lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL, 
-          NULL, process_exit, &g_array_index(hooks, LttvTraceHook, 8));
+          NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++));
 #endif //0
 
       /* after hooks */
@@ -333,91 +335,93 @@ void drawing_data_request(Drawing_t *drawing,
 #if 0
       /**** DESACTIVATED ****/
       lttv_trace_find_hook(ts->parent.t, "core","syscall_entry","syscall_id", 
-    NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, 8));
+    NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
       /**** DESACTIVATED ****/
       lttv_trace_find_hook(ts->parent.t, "core", "syscall_exit", NULL, NULL, 
-          NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, 9));
+          NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
 
       /**** DESACTIVATED ****/
       lttv_trace_find_hook(ts->parent.t, "core", "trap_entry", "trap_id",
-    NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, 10));
+    NULL, NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
 
       /**** DESACTIVATED ****/
       lttv_trace_find_hook(ts->parent.t, "core", "trap_exit", NULL, NULL, NULL, 
-          after_execmode_hook, &g_array_index(hooks, LttvTraceHook, 11));
+          after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
 
       /**** DESACTIVATED ****/
       lttv_trace_find_hook(ts->parent.t, "core", "irq_entry", "irq_id", NULL, 
-          NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, 12));
+          NULL, after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
 
       /**** DESACTIVATED ****/
       lttv_trace_find_hook(ts->parent.t, "core", "irq_exit", NULL, NULL, NULL, 
-          after_execmode_hook, &g_array_index(hooks, LttvTraceHook, 13));
+          after_execmode_hook, &g_array_index(hooks, LttvTraceHook, hn++));
 #endif //0
 #if 0
       lttv_trace_find_hook(ts->parent.t, "core", "schedchange", "in", "out", 
         "out_state", after_schedchange_hook, 
-        &g_array_index(hooks, LttvTraceHook, 8));
+        &g_array_index(hooks, LttvTraceHook, hn++));
 
       lttv_trace_find_hook(ts->parent.t, "core", "process", "event_sub_id", 
           "event_data1", "event_data2", after_process_hook,
-          &g_array_index(hooks, LttvTraceHook, 9));
+          &g_array_index(hooks, LttvTraceHook, hn++));
 #endif //0
+      after_hn = before_hn;
+      
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_PROCESS, LTT_EVENT_SCHEDCHANGE,
           LTT_FIELD_OUT, LTT_FIELD_IN, LTT_FIELD_OUT_STATE,
           after_schedchange_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 11));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, after_hn++));
+      if(ret) after_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_PROCESS, LTT_EVENT_FORK,
           LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
           after_process_fork_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 12));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, after_hn++));
+      if(ret) after_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_PROCESS, LTT_EVENT_EXIT,
           LTT_FIELD_PID, 0, 0,
           after_process_exit_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 13));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, after_hn++));
+      if(ret) after_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_FS, LTT_EVENT_EXEC,
           0, 0, 0,
           after_fs_exec_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 14));
-      g_assert(!ret);
+          &g_array_index(hooks, LttvTraceHook, after_hn++));
+      if(ret) after_hn--;
 
       ret = lttv_trace_find_hook(ts->parent.t,
           LTT_FACILITY_STATEDUMP, LTT_EVENT_ENUM_PROCESS_STATE,
           LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
           after_event_enum_process_hook,
           events_request,
-          &g_array_index(hooks, LttvTraceHook, 15));
-      g_assert(!ret);
-
+          &g_array_index(hooks, LttvTraceHook, after_hn++));
+      if(ret) after_hn--;
 
+      hooks = g_array_set_size(hooks, after_hn);
 
 #if 0
       lttv_trace_find_hook(ts->parent.t, "core", "process_fork", "child_pid", 
-          NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, 7));
+          NULL, NULL, process_fork, &g_array_index(hooks, LttvTraceHook, hn++));
 
       lttv_trace_find_hook(ts->parent.t, "core", "process_exit", NULL, NULL, 
-          NULL, process_exit, &g_array_index(hooks, LttvTraceHook, 8));
+          NULL, process_exit, &g_array_index(hooks, LttvTraceHook, hn++));
 #endif //0
 
 
       
       /* Add these hooks to each event_by_id hooks list */
       /* add before */
-      for(k = 0 ; k < 11 ; k++) {
+      for(k = 0 ; k < before_hn ; k++) {
         hook = &g_array_index(hooks, LttvTraceHook, k);
         for(l=0;l<hook->fac_list->len;l++) {
           thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
@@ -429,7 +433,7 @@ void drawing_data_request(Drawing_t *drawing,
       }
 
       /* add after */
-      for(k = 11 ; k < 16 ; k++) {
+      for(k = before_hn ; k < after_hn ; k++) {
         hook = &g_array_index(hooks, LttvTraceHook, k);
         for(l=0;l<hook->fac_list->len;l++) {
           thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l);
This page took 0.037824 seconds and 4 git commands to generate.