How to use gdbgui - 10 common examples

To help you get started, we’ve selected a few gdbgui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cs01 / gdbgui / tests / test_main.py View on Github external
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)
github cs01 / gdbgui / tests / test_app.py View on Github external
def test_connect(self):
        app = backend.app
        socketio = SocketIO()

        @socketio.on("connect")
        def on_connect():
            send({"connected": "foo"}, json=True)

        socketio.init_app(app, cookie="foo")
        client = socketio.test_client(app)
        received = client.get_received()
        self.assertEqual(len(received), 1)
        self.assertEqual(received[0]["args"], {"connected": "foo"})
github cs01 / gdbgui / tests / test_main.py View on Github external
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)
github cs01 / gdbgui / tests / test_app.py View on Github external
Unit tests

Run from top level directory: ./tests/test_app.py

See more on testing Flask apps: http://flask.pocoo.org/docs/0.11/testing/
"""

import unittest
from gdbgui import backend
import sys
from flask_socketio import send, SocketIO  # type: ignore


PYTHON3 = sys.version_info.major == 3

backend.setup_backend(testing=True)
socketio = backend.socketio


class TestWebsockets(unittest.TestCase):
    @classmethod
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_connect(self):
        app = backend.app
        socketio = SocketIO()

        @socketio.on("connect")
github cs01 / gdbgui / tests / test_main.py View on Github external
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)
github cs01 / gdbgui / tests / test_app.py View on Github external
def setUp(self):
        """Built-in to unittest.TestCase"""
        self.app = backend.app.test_client()
github cs01 / gdbgui / tests / test_app.py View on Github external
def test_same_port(self):
        backend.setup_backend(testing=True)
github cs01 / gdbgui / tests / test_app.py View on Github external
Run from top level directory: ./tests/test_app.py

See more on testing Flask apps: http://flask.pocoo.org/docs/0.11/testing/
"""

import unittest
from gdbgui import backend
import sys
from flask_socketio import send, SocketIO  # type: ignore


PYTHON3 = sys.version_info.major == 3

backend.setup_backend(testing=True)
socketio = backend.socketio


class TestWebsockets(unittest.TestCase):
    @classmethod
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_connect(self):
        app = backend.app
        socketio = SocketIO()

        @socketio.on("connect")
        def on_connect():
github cs01 / gdbgui / tests / test_main.py View on Github external
            GDB_MI_FLAG + ["--nx", "--tty=/dev/ttys002", "mybin", "-myargs"],
        ),
        (
            ["gdbgui", "-n", "--args", "mybin", "-myargs"],
            GDB_MI_FLAG + ["--args", "mybin", "-myargs"],
        ),
    ],
)
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)
github cs01 / gdbgui / gdbgui / backend.py View on Github external
def main():
    """Entry point from command line"""
    parser = get_parser()
    args = parser.parse_args()

    if args.debug:
        logger.setLevel(logging.NOTSET)

    if args.version:
        print(__version__)
        return

    cmd = args.cmd or args.args

    if args.no_browser and args.browser:
        print("Cannot specify no-browser and browser. Must specify one or the other.")
        exit(1)

    app.config["initial_binary_and_args"] = cmd
    app.config["gdb_args"] = shlex.split(args.gdb_args)
    app.config["rr"] = args.rr
    app.config["gdb_path"] = args.gdb
    app.config["gdbgui_auth_user_credentials"] = get_gdbgui_auth_user_credentials(
        args.auth_file, args.user, args.password
    )
    app.config["project_home"] = args.project