Skip to content

Commit

Permalink
DPL: helper function to enable loggers from gdb / lldb
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Jan 17, 2024
1 parent e89e409 commit 4e22db3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Framework/Core/COOKBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,17 @@ perf script -i perf.data > profile.linux-perf.txt
```

and then you can either upload it to https://www.speedscope.app or use chrome://tracing.

## Internal debug log streams

Debug log entries for several DPL components are now provided via the Signpost API.

Such streams can be enabled using the "Signpost" part of the Device Inspector GUI.

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:

```
p o2_debug_log_set_stacktrace(private_o2_log_completion, 1)
```

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.
7 changes: 7 additions & 0 deletions Framework/Foundation/include/Framework/Signpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,13 @@ void _o2_log_set_stacktrace(_o2_log_t* log, int stacktrace)
{
log->stacktrace = stacktrace;
}
// A C function which can be used to enable the signposts
extern "C" {
void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
{
log->stacktrace = stacktrace;
}
}
#endif // O2_SIGNPOST_IMPLEMENTATION

#if defined(__APPLE__) || defined(O2_FORCE_SIGNPOSTS) || !defined(NDEBUG)
Expand Down

0 comments on commit 4e22db3

Please sign in to comment.