Beispiel #1
0
void trace_logger_log0(int line_number, char *name, char *bbid, char *instid, int opcode)
{
    if(!initp) {
        trace_logger_init();
        initp=1;
    }
    fprintf(full_trace_file, "\n0,%d,%s,%s,%s,%d\n", line_number, name, bbid, instid, opcode);
}
Beispiel #2
0
void trace_logger_log0(int line_number, char *name, char *bbid, char *instid,
                       int opcode, bool is_tracked_function, bool is_toplevel_mode) {
    if (!initp) {
        trace_logger_init();
        initp = 1;
    }

    if (inst_count == 0 && is_tracked_function)
        track_curr_inst = true;
    else
        track_curr_inst = track_next_inst;

    /*
     * If we are in top level mode:
     *   1. Start tracking if the function is tracked and we're not currently.
     *   tracking.  Otherwise, don't change what we're doing (for the rest of the
     *   parameter lines).
     *
     *   2. Stop tracking if the function is tracked, the opcode is a RETURN,
     *   and we're currently tracking. We'll finish the current op but we won't
     *   track the next one.
     *
     *   3. Otherwise, do whatever we were currently doing (tracking or not).
     *
     * If we are NOT in top level mode, then track if the function is tracked
     * (obviously).
     */
    if (is_toplevel_mode) {
        if (is_tracked_function) {
            if (opcode == RET_OP && track_curr_inst) {
                track_next_inst = false;
            } else {
                track_next_inst = true;
            }
        }
    } else {
        track_next_inst = true;
    }

    if (!track_curr_inst)
        return;

    gzprintf(full_trace_file, "\n0,%d,%s,%s,%s,%d,%d\n", line_number, name, bbid,
             instid, opcode, inst_count);
    inst_count++;
}