Skip to content

Commit 4e22db3

Browse files
committed
DPL: helper function to enable loggers from gdb / lldb
1 parent e89e409 commit 4e22db3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Framework/Core/COOKBOOK.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,3 +538,17 @@ perf script -i perf.data > profile.linux-perf.txt
538538
```
539539

540540
and then you can either upload it to https://www.speedscope.app or use chrome://tracing.
541+
542+
## Internal debug log streams
543+
544+
Debug log entries for several DPL components are now provided via the Signpost API.
545+
546+
Such streams can be enabled using the "Signpost" part of the Device Inspector GUI.
547+
548+
Alternatively for the case were the GUI is not available, you can attach to a process via GDB / LLDB and invoke the `o2_debug_log_set_stacktrace` function, passing it the log you want to enable and the amount of stacktrace you want to see. E.g. to enable a log created with `O2_DECLARE_DYNAMIC_LOG(completion)` you can use:
549+
550+
```
551+
p o2_debug_log_set_stacktrace(private_o2_log_completion, 1)
552+
```
553+
554+
If you are on a mac, you can also use Instruments to visualise your Signpost, just like any other macOS application. In order to do so you need to enable the "Signpost" instrument, making sure you add `ch.cern.aliceo2.completion` to the list of loggers to watch.

Framework/Foundation/include/Framework/Signpost.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,13 @@ void _o2_log_set_stacktrace(_o2_log_t* log, int stacktrace)
439439
{
440440
log->stacktrace = stacktrace;
441441
}
442+
// A C function which can be used to enable the signposts
443+
extern "C" {
444+
void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
445+
{
446+
log->stacktrace = stacktrace;
447+
}
448+
}
442449
#endif // O2_SIGNPOST_IMPLEMENTATION
443450

444451
#if defined(__APPLE__) || defined(O2_FORCE_SIGNPOSTS) || !defined(NDEBUG)

0 commit comments

Comments
 (0)