Fix seek n backward that did not check the end of a trace
authorYannick Brosseau <yannick.brosseau@gmail.com>
Fri, 21 Dec 2012 15:07:59 +0000 (10:07 -0500)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Fri, 21 Dec 2012 15:07:59 +0000 (10:07 -0500)
lttv/lttv/traceset-process.c

index a41edc2a9c3cb4c73d13335b453670f2517d5904..dc45b17d3a88c043f23f5bdfed06ceae150b7f4f 100644 (file)
@@ -276,10 +276,20 @@ guint lttv_process_traceset_seek_n_backward(LttvTraceset *ts,
                 count = 0;
                 do {
                         if((ret = lttv_traceset_position_compare(currentPos,initialPos)) == 1){       
-                                bt_iter_next(bt_ctf_get_iter(ts->iter));
-                                lttv_traceset_destroy_position(currentPos);
-                                currentPos = lttv_traceset_create_current_position(ts);
-                                count++;
+                               if(bt_iter_next(bt_ctf_get_iter(ts->iter)) == 0) {
+                                       if(bt_ctf_iter_read_event(ts->iter) != NULL) {
+                                       lttv_traceset_destroy_position(currentPos);
+                                       currentPos = lttv_traceset_create_current_position(ts);
+                                       count++;
+                                       } else  {
+                                               break;
+                                       }
+                                       
+                               } else {
+
+                                       //No more event available
+                                       break;
+                               }
                         }
                 }while(ret != 0);
                 
This page took 0.024975 seconds and 4 git commands to generate.