Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion dependencies/debugbreak
21 changes: 21 additions & 0 deletions doc/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@ and run the test with ``continue``

To use a different port use ``--debug --debug-transport=<protocol>:<port>``

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
--------------------------------------

Expand Down
12 changes: 10 additions & 2 deletions src/core/runner_coroutine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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 = "<unknown>";
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;
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion subprojects/boxfort.wrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wrap-git]
directory = boxfort
url = https://github.com/Snaipe/BoxFort.git
revision = 46cfaebead74bd1d2898afb66a06ec6badce4326
revision = fe06439edd619ef574cf897195f0976bb60e4781