fix unexisting trace error path
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 22 Aug 2005 18:24:52 +0000 (18:24 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 22 Aug 2005 18:24:52 +0000 (18:24 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1046 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/ltt/trace.h
ltt/branches/poly/ltt/tracefile.c
ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/tracecontext.c

index 970e291833d5fd8d1a169c9bb770008d5838595c..bb586320270f15cb04af62ac776a52ada9fa46f5 100644 (file)
@@ -150,6 +150,7 @@ void ltt_tracefile_copy(LttTracefile *dest, const LttTracefile *src);
 
 void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname);
 
+/* May return a NULL tracefile group */
 GData **ltt_trace_get_tracefiles_groups(LttTrace *trace);
 
 typedef void (*ForEachTraceFileFunc)(LttTracefile *tf, gpointer func_args);
index d7b72d62e9049dabe579d5b305cba008513d8304..0d03c07d54b28efeb5962910b6fa562ed840e6c8 100644 (file)
@@ -986,8 +986,10 @@ LttTrace *ltt_trace_open(const gchar *pathname)
 
   /* Open all the tracefiles */
   g_datalist_init(&t->tracefiles);
-  if(open_tracefiles(t, abs_path, ""))
+  if(open_tracefiles(t, abs_path, "")) {
+    g_warning("Error opening tracefile %s", abs_path);
     goto open_error;
+  }
   
   /* Prepare the facilities containers : array and mapping */
   /* Array is zeroed : the "exists" field is set to false by default */
@@ -1327,7 +1329,7 @@ int ltt_tracefile_seek_time(LttTracefile *tf, LttTime time)
         else if(ret) goto fail;
 
         if(ltt_time_compare(time, tf->event.event_time) >= 0)
-          break;
+          goto found;
       }
 
     } else if(ltt_time_compare(time, tf->buffer.begin.timestamp) < 0) {
@@ -1624,14 +1626,14 @@ static gint map_block(LttTracefile * tf, guint block_num)
   tf->buffer.begin.timestamp = ltt_get_time(LTT_GET_BO(tf),
                                               &header->begin.timestamp);
   tf->buffer.begin.timestamp.tv_nsec *= NSEC_PER_USEC;
-  g_warning("block %u begin : %lu.%lu", block_num,
+  g_debug("block %u begin : %lu.%lu", block_num,
       tf->buffer.begin.timestamp.tv_sec, tf->buffer.begin.timestamp.tv_nsec);
   tf->buffer.begin.cycle_count = ltt_get_uint64(LTT_GET_BO(tf),
                                               &header->begin.cycle_count);
   tf->buffer.end.timestamp = ltt_get_time(LTT_GET_BO(tf),
                                               &header->end.timestamp);
   tf->buffer.end.timestamp.tv_nsec *= NSEC_PER_USEC;
-  g_warning("block %u end : %lu.%lu", block_num,
+  g_debug("block %u end : %lu.%lu", block_num,
       tf->buffer.end.timestamp.tv_sec, tf->buffer.end.timestamp.tv_nsec);
   tf->buffer.end.cycle_count = ltt_get_uint64(LTT_GET_BO(tf),
                                               &header->end.cycle_count);
index 7dc1771cfefc828dab813003fe26c5c4828916d0..1db159c5280e280844303ea8e10ee9f44b894966 100644 (file)
@@ -99,8 +99,11 @@ static void lttv_trace_option(void __UNUSED__ *hook_data)
   LttTrace *trace;
 
   trace = ltt_trace_open(a_trace);
-  if(trace == NULL) g_critical("cannot open trace %s", a_trace);
-  lttv_traceset_add(traceset, lttv_trace_new(trace));
+  if(trace == NULL) {
+    g_critical("cannot open trace %s", a_trace);
+  } else {
+    lttv_traceset_add(traceset, lttv_trace_new(trace));
+  }
 }
 
 static double get_time() 
index 76d018b937f9d7f61d79492799460465ff287211..4dd8e3a18de3bb8590b41fb6ae6e08ad99a06849 100644 (file)
@@ -165,7 +165,7 @@ static void init_tracefile_context(LttTracefile *tracefile,
 static void
 init(LttvTracesetContext *self, LttvTraceset *ts)
 {
-  guint i, j, nb_trace, nb_control, nb_per_cpu, nb_tracefile;
+  guint i, j, nb_trace;
 
   LttvTraceContext *tc;
 
@@ -192,13 +192,14 @@ init(LttvTracesetContext *self, LttvTraceset *ts)
                         sizeof(LttvTracefileContext*), 10);
 
     tracefiles_groups = ltt_trace_get_tracefiles_groups(tc->t);
+    if(tracefiles_groups != NULL) {
+      args.func = (ForEachTraceFileFunc)init_tracefile_context;
+      args.func_args = tc;
 
-    args.func = (ForEachTraceFileFunc)init_tracefile_context;
-    args.func_args = tc;
-
-    g_datalist_foreach(tracefiles_groups, 
-                          (GDataForeachFunc)compute_tracefile_group,
-                          &args);
+      g_datalist_foreach(tracefiles_groups, 
+                            (GDataForeachFunc)compute_tracefile_group,
+                            &args);
+    }
       
 #if 0
     nb_control = ltt_trace_control_tracefile_number(tc->t);
This page took 0.029863 seconds and 4 git commands to generate.