Пример #1
0
void jniLogException(C_JNIEnv* env, int priority, const char* tag,
		jthrowable exception) {
	JNIEnv* e = reinterpret_cast<JNIEnv*>(env);

	scoped_local_ref<jthrowable> currentException(env,
			(*env)->ExceptionOccurred(e));
	if (exception == NULL) {
		exception = currentException.get();
		if (exception == NULL) {
			return;
		}
	}

	if (currentException.get() != NULL) {
		(*env)->ExceptionClear(e);
	}

	char* buffer = getStackTrace(env, exception);
	if (buffer == NULL) {
		(*env)->ExceptionClear(e);
		buffer = getExceptionSummary(env, exception);
	}

	__android_log_write(priority, tag, buffer);
	free(buffer);

	if (currentException.get() != NULL) {
		(*env)->Throw(e, currentException.get()); // rethrow
	}
}
Пример #2
0
extern "C" std::string jniGetStackTrace(C_JNIEnv* env, jthrowable exception) {
    JNIEnv* e = reinterpret_cast<JNIEnv*>(env);

    scoped_local_ref<jthrowable> currentException(env, (*env)->ExceptionOccurred(e));
    if (exception == NULL) {
        exception = currentException.get();
        if (exception == NULL) {
          return "<no pending exception>";
        }
    }

    if (currentException.get() != NULL) {
        (*env)->ExceptionClear(e);
    }

    std::string trace;
    if (!getStackTrace(env, exception, trace)) {
        (*env)->ExceptionClear(e);
        getExceptionSummary(env, exception, trace);
    }

    if (currentException.get() != NULL) {
        (*env)->Throw(e, currentException.get()); // rethrow
    }

    return trace;
}
Пример #3
0
Deprecated::ScriptValue ScriptDebugServer::exceptionOrCaughtValue(JSC::ExecState* state)
{
    if (reasonForPause() == PausedForException)
        return Deprecated::ScriptValue(state->vm(), currentException());

    RefPtr<DebuggerCallFrame> debuggerCallFrame = currentDebuggerCallFrame();
    while (debuggerCallFrame) {
        DebuggerScope* scope = debuggerCallFrame->scope();
        if (scope->isCatchScope())
            return Deprecated::ScriptValue(state->vm(), scope->caughtValue(state));
        debuggerCallFrame = debuggerCallFrame->callerFrame();
    }

    return Deprecated::ScriptValue();
}
Пример #4
0
    //_______________________________________________________
    void ExceptionListWidget::up( void )
    {

        InternalSettingsList selection( model().get( m_ui.exceptionListView->selectionModel()->selectedRows() ) );
        if( selection.empty() ) { return; }

        // retrieve selected indexes in list and store in model
        QModelIndexList selectedIndices( m_ui.exceptionListView->selectionModel()->selectedRows() );
        InternalSettingsList selectedExceptions( model().get( selectedIndices ) );

        InternalSettingsList currentException( model().get() );
        InternalSettingsList newExceptions;

        for( InternalSettingsList::const_iterator iter = currentException.constBegin(); iter != currentException.constEnd(); ++iter )
        {

            // check if new list is not empty, current index is selected and last index is not.
            // if yes, move.
            if(
                !( newExceptions.empty() ||
                selectedIndices.indexOf( model().index( *iter ) ) == -1 ||
                selectedIndices.indexOf( model().index( newExceptions.back() ) ) != -1
                ) )
            {
                InternalSettingsPtr last( newExceptions.back() );
                newExceptions.removeLast();
                newExceptions.append( *iter );
                newExceptions.append( last );
            } else newExceptions.append( *iter );

        }

        model().set( newExceptions );

        // restore selection
        m_ui.exceptionListView->selectionModel()->select( model().index( selectedExceptions.front() ),  QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
        for( InternalSettingsList::const_iterator iter = selectedExceptions.constBegin(); iter != selectedExceptions.constEnd(); ++iter )
        { m_ui.exceptionListView->selectionModel()->select( model().index( *iter ), QItemSelectionModel::Select|QItemSelectionModel::Rows ); }

        setChanged( true );

        return;

    }