Example #1
0
void handle_tracepoint(int tp_id)
{
    action * current_action;
    frame_buffer *current_frame_buffer;

    if (get_tracepoint_status(tp_id)==TRACEPOINT_STEPPING)
    {
        //find the while stepping action
        current_action=skyeye_ice.tps[tp_id].actions;
        while (current_action->type!=ACTION_WHILE)
        {
            if (current_action->sibling !=NULL)
            {
                current_action=current_action->sibling;
            } else
            {
                return;
            }
        }
        current_frame_buffer= add_frame_buffer();
        current_frame_buffer->tp_number=skyeye_ice.tps[tp_id].number;
        //current action is a while action
        do_action_list (tp_id,current_action,current_frame_buffer);
        return;
    }
    if (get_tracepoint_status(tp_id)==TRACEPOINT_ENABLED)
    {
        if (skyeye_ice.tps[tp_id].pass_count!=0)
        {
            if (skyeye_ice.tps[tp_id].remaining_pass!=0)
            {
                //decrease the remaining_pass
                skyeye_ice.tps[tp_id].remaining_pass--;
            }
            else
            {
                //remaining_pass ==0, don't collect tracess
                return;
            }
        }
        current_frame_buffer= add_frame_buffer();
        current_frame_buffer->tp_number=skyeye_ice.tps[tp_id].number;
        do_action_list (tp_id,skyeye_ice.tps[tp_id].actions,current_frame_buffer);
    }
}
Example #2
0
int sieve_execute_bytecode(sieve_execute_t *exe, sieve_interp_t *interp,
			   void *script_context, void *message_context) 
{
    action_list_t *actions = NULL;
    notify_list_t *notify_list = NULL;
    /*   notify_action_t *notify_action;*/
    action_t lastaction = -1;
    int ret;
    char actions_string[ACTIONS_STRING_LEN] = "";
    const char *errmsg = NULL;
    strarray_t imapflags = STRARRAY_INITIALIZER;
    
    if (!interp) return SIEVE_FAIL;

    if (interp->notify) {
	notify_list = new_notify_list();
	if (notify_list == NULL) {
	    return do_sieve_error(SIEVE_NOMEM, interp,
				  script_context, message_context, &imapflags,
				  actions, notify_list, lastaction, 0,
				  actions_string, errmsg);
	}
    }

    actions = new_action_list();
    if (actions == NULL) {
	ret = do_sieve_error(SIEVE_NOMEM, interp,
			     script_context, message_context, &imapflags,
			     actions, notify_list, lastaction, 0,
			     actions_string, errmsg);
    }
    else {
	ret = sieve_eval_bc(exe, 0, interp,
			    script_context, message_context,
			    &imapflags, actions, notify_list, &errmsg);

	if (ret < 0) {
	    ret = do_sieve_error(SIEVE_RUN_ERROR, interp,
				 script_context, message_context, &imapflags,
				 actions, notify_list, lastaction, 0,
				 actions_string, errmsg);
	}
	else {
	    ret = do_action_list(interp,
				 script_context, message_context, 
				 &imapflags, actions, notify_list,
				 actions_string, errmsg);
	}
    }

    strarray_fini(&imapflags);

    return ret;
}
Example #3
0
void do_action_list (unsigned int tp_id, action* actions, frame_buffer * fb)
{
    frame_buffer *current_frame_buffer;
    action * current_action;

    current_frame_buffer =fb;
    current_action =actions;
    while (current_action !=NULL)
    {
        switch (current_action->type)
        {
        case ACTION_COLLECT:
        {
            do_action(tp_id,current_action,current_frame_buffer);
            fprintf (stderr," tracepoint : %x, remaining pass : %x, action collect \n",skyeye_ice.tps[tp_id].number,skyeye_ice.tps[tp_id].remaining_pass);
            current_action=current_action->sibling;
        }
        break;
        case ACTION_WHILE:
        {
            if (current_action->action_data.wa.remaining_steps !=0)
            {
                set_tracepoint_status(tp_id, TRACEPOINT_STEPPING);
                current_action->action_data.wa.remaining_steps--;
                do_action_list(tp_id,current_action->child,current_frame_buffer);

                fprintf (stderr," tracepoint : %x, remaining pass : %x, action stepping \n",skyeye_ice.tps[tp_id].number,skyeye_ice.tps[tp_id].remaining_pass);

            }
            if (current_action->action_data.wa.remaining_steps ==0)
            {
                set_tracepoint_status(tp_id, TRACEPOINT_ENABLED);
                current_action->action_data.wa.remaining_steps=current_action->action_data.wa.step_count;
                fprintf (stderr," tracepoint : %x, action stepping end \n",skyeye_ice.tps[tp_id].number);
            }
            current_action=current_action->sibling;
        }
        break;
        }
    }
}