diff --git a/.gitmodules b/.gitmodules index 77d80d84..88ddbb2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/attractivechaos/klib.git [submodule "dependencies/debugbreak"] path = dependencies/debugbreak - url = https://github.com/scottt/debugbreak + url = https://github.com/MrAnno/debugbreak.git diff --git a/ChangeLog b/ChangeLog index 747cfa08..8878193b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,11 +55,14 @@ * Fix: fixed crash when passing an empty string to cr_log_info (Ersikan). * Fix: fixed compilation errors on macOS (Kare Nuorteva, László Várady). * Fix: fixed --debug flag aborting runner with gdbserver >= 8.3. + * Fix: fixed gdb stepping issue with '--debug' on macOS (Apple silicon). * Misc: various documentation fixes (Oleksii Vilchanskyi, Sam Zaydel, Karim - Dridi, Florent Poinsard, Tim Gates, László Várady). + Dridi, Florent Poinsard, Tim Gates, László Várady, Japroz Saini). * Misc: various updates to dependencies (László Várady). * Misc: various build system fixes (Tomasz Sieprawski, László Várady). * Misc: various fixes to the autotools example (Bruno Belany). + * Misc: from now on, --debug will fall back to the idle method in case no + debugger can be found. The full git changelog may be accessed with `git log v2.3.3..v2.4.0`. diff --git a/dependencies/debugbreak b/dependencies/debugbreak index 6b79ec8d..83bf7e93 160000 --- a/dependencies/debugbreak +++ b/dependencies/debugbreak @@ -1 +1 @@ -Subproject commit 6b79ec8d8f8d4603111f580a0537f8f31c484c32 +Subproject commit 83bf7e933311b88613cbaadeced9c2e2c811054a diff --git a/doc/debug.rst b/doc/debug.rst index 42a1c2f5..ef380da9 100644 --- a/doc/debug.rst +++ b/doc/debug.rst @@ -63,6 +63,27 @@ and run the test with ``continue`` To use a different port use ``--debug --debug-transport=:`` +Debugging on macOS +------------------ + +macOS has its own LLVM-based debugger called ``debugserver``. +Make sure the debugger server is available in your PATH (by default, it is not). + +You will probably need sudo privileges as well: + +.. code-block:: bash + + $ sudo ./test --debug + Listening to port 1234 for a connection from *... + +In another terminal, connect to the debug session: + +.. code-block:: bash + + $ sudo lldb ./test + (lldb) gdb-remote localhost:1234 + + Debugging with an unsupported debugger -------------------------------------- diff --git a/src/core/runner_coroutine.c b/src/core/runner_coroutine.c index fb79142e..b78150e5 100644 --- a/src/core/runner_coroutine.c +++ b/src/core/runner_coroutine.c @@ -325,6 +325,10 @@ static bxf_instance *run_test(struct run_next_context *ctx, default: break; } } + + if (criterion_options.debug == CR_DBG_NATIVE) + BXF_DBG_ENABLE_FALLBACK(debugger); + if (!debugger) cr_panic("Could not choose the debugger server for an " "unknown compiler"); @@ -347,7 +351,7 @@ static bxf_instance *run_test(struct run_next_context *ctx, if (rc < 0) { if (rc == -ENOENT && criterion_options.debug) { const char *dbgname = ""; - switch (sp.debug.debugger) { + switch (BXF_DBG_GET_DEBUGGER(sp.debug.debugger)) { case BXF_DBG_GDB: dbgname = "gdbserver"; break; case BXF_DBG_LLDB: dbgname = "lldb-server"; break; case BXF_DBG_WINDBG: dbgname = "windbg"; break; @@ -364,8 +368,12 @@ static bxf_instance *run_test(struct run_next_context *ctx, bxf_context_term(inst_ctx); + if (criterion_options.debug == CR_DBG_NATIVE && instance->status.stopped) { + criterion_pinfo(CRITERION_PREFIX_DEBUG, "Default debugger can not be found, falling back to \"idle\" mode\n"); + } + /* TODO: integrate this to the logger after refactor */ - if (criterion_options.debug == CR_DBG_IDLE) { + if (criterion_options.debug == CR_DBG_IDLE || instance->status.stopped) { criterion_pinfo(CRITERION_PREFIX_DEBUG, _(msg_print_pid), ctx->test->category, ctx->test->name, diff --git a/subprojects/boxfort.wrap b/subprojects/boxfort.wrap index b2f83619..04355472 100644 --- a/subprojects/boxfort.wrap +++ b/subprojects/boxfort.wrap @@ -1,4 +1,4 @@ [wrap-git] directory = boxfort url = https://github.com/Snaipe/BoxFort.git -revision = 46cfaebead74bd1d2898afb66a06ec6badce4326 +revision = fe06439edd619ef574cf897195f0976bb60e4781