Example #1
0
def test_arguments_passed_to_gdb(monkeypatch, test_argv, expected_gdb_args):
    def mock_setup_backend(*args, **kwargs):
        pass

    monkeypatch.setattr(gdbgui.backend, "setup_backend", mock_setup_backend)
    monkeypatch.setattr(sys, "argv", test_argv)
    gdbgui.backend.main()

    state = StateManager(gdbgui.backend.app.config)
    assert len(state.get_gdb_args()) == len(expected_gdb_args)
Example #2
0
            logger.warning("Received invalid csrf token. Aborting")
            abort(403)
        # call original request handler
        return f(*args, **kwargs)

    return wrapper


def add_csrf_token_to_session():
    if "csrf_token" not in session:
        session["csrf_token"] = binascii.hexlify(
            os.urandom(20)).decode("utf-8")


socketio = SocketIO()
_state = StateManager(app.config)


def setup_backend(
    serve=True,
    host=DEFAULT_HOST,
    port=DEFAULT_PORT,
    debug=False,
    open_browser=True,
    testing=False,
    private_key=None,
    certificate=None,
    LLDB=False,
):
    """Run the server of the gdb gui"""
    app.config["LLDB"] = LLDB