- saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a,
- LTTV_STATE_SAVED_STATES);
- min_pos = -1;
- max_pos = lttv_attribute_get_number(saved_states_tree) - 1;
- mid_pos = max_pos / 2;
- while(min_pos < max_pos) {
- type = lttv_attribute_get(saved_states_tree, mid_pos, &name, &value);
- g_assert(type == LTTV_GOBJECT);
- saved_state_tree = *((LttvAttribute **)(value.v_gobject));
- type = lttv_attribute_get_by_name(saved_state_tree, LTTV_STATE_TIME,
- &value);
- g_assert(type == LTTV_TIME);
- if(ltt_time_compare(*(value.v_time), t) < 0) {
- min_pos = mid_pos;
- closest_tree = saved_state_tree;
+ if(tcs->recompute_state_in_seek) {
+ if(tcs->saved_state_available) {
+ saved_states_tree = lttv_attribute_find_subdir(tcs->parent.t_a,
+ LTTV_STATE_SAVED_STATES);
+ min_pos = -1;
+ max_pos = lttv_attribute_get_number(saved_states_tree) - 1;
+ mid_pos = max_pos / 2;
+ while(min_pos < max_pos) {
+ type = lttv_attribute_get(saved_states_tree, mid_pos, &name, &value);
+ g_assert(type == LTTV_GOBJECT);
+ saved_state_tree = *((LttvAttribute **)(value.v_gobject));
+ type = lttv_attribute_get_by_name(saved_state_tree, LTTV_STATE_TIME,
+ &value);
+ g_assert(type == LTTV_TIME);
+ if(ltt_time_compare(*(value.v_time), t) < 0) {
+ min_pos = mid_pos;
+ closest_tree = saved_state_tree;
+ }
+ else max_pos = mid_pos - 1;
+
+ mid_pos = (min_pos + max_pos + 1) / 2;
+ }
+
+ /* restore the closest earlier saved state */
+ if(min_pos != -1) lttv_state_restore(tcs, closest_tree);
+
+ /* there is no earlier saved state, restart at T0 */
+ else {
+ restore_init_state(tcs);
+ lttv_process_trace_seek_time(&(tcs->parent), ltt_time_zero);
+ }
+
+ /* There is no saved state yet we want to have it. Restart at T0 */
+ else {
+ restore_init_state(tcs);
+ lttv_process_trace_seek_time(&(tcs->parent), ltt_time_zero);