예제 #1
0
    void Debugger::traceLine(int line)
    {
        if (in_trace) return;
        in_trace = true;

        // callback trace
        AvmAssert(line != 0);
        if (trace_callback && astrace_callback >= TRACE_METHODS_AND_LINES)
            traceCallback(line);

        // console level trace
        if (astrace_console >= TRACE_METHODS_AND_LINES)
        {
            Stringp file = core->callStack->filename();

            // WARNING: don't change the format of output since outside utils depend on it
            uint64_t delta = VMPI_getTime() - astraceStartTime;
            core->console << (uint32)(delta) << " AVMINF: LINE ";
            if (file)
                core->console << "   " << line << "\t\t " << file << "\n";
            else
                core->console << "   " << line << "\t\t ??? \n";
        }
        in_trace = false;
    }
예제 #2
0
    void Debugger::traceMethod(MethodInfo* fnc, bool ignoreArgs)
    {
        if (in_trace) return;
        in_trace = true;

        // callback trace
        if (trace_callback && fnc && astrace_callback > TRACE_OFF)
            traceCallback(0);

        if (astrace_console > TRACE_OFF)
        {
            if (fnc)
            {
                // WARNING: don't change the format of output since outside utils depend on it
                uint64_t delta = VMPI_getTime() - astraceStartTime;
                core->console << (uint32)(delta) << " AVMINF: MTHD ";
                Stringp fname = fnc->getMethodName();
                if (fname && (fname->length() > 0) )
                    core->console << fname;
                else
                    core->console << "<unknown>";

                core->console << " (";

                if (!ignoreArgs && core->callStack && (astrace_console == TRACE_METHODS_WITH_ARGS || astrace_console == TRACE_METHODS_AND_LINES_WITH_ARGS))
                    core->console << traceArgumentsString();

                core->console << ")\n";
            }
        }
        in_trace = false;
    }
예제 #3
0
    ProgramClass::ProgramClass(VTable *cvtable)
        : ClassClosure(cvtable)
    {
        ShellCore* core = (ShellCore*)this->core();
        if (core->programClass == NULL) {
            core->programClass = this;
        }

        createVanillaPrototype();

        // initialTime: support for getTimer
        // todo note this is currently routed to the performance counter
        // for benchmark purposes.
        initialPerfTime = VMPI_getPerformanceCounter();
        initialTime = VMPI_getTime();
    }
예제 #4
0
 unsigned ProgramClass::getTimer()
 {
     return (uint32_t)(VMPI_getTime() - initialTime);
 }