Dispatch (swift-corelibs-libdispatch) Debug Logging

I am trying to debug Dispatch to see what is causing a bug I’ve stumbled into.

I’ve actually got a debug build of libdispatch made and am able to step through it with lldb :tada: .

I was wondering how I go about enabling some of the logging in libdispatch.

I’m not sure what or how I would send to the Swift build-script to get that part of the compilation turned on.

I’ve added libdispatch-cmake-options=-DDISPATCH_ENABLE_ASSERTS=1 -DDISPATCH_DEBUG=1 -DDISPATCH_IO_DEBUG=1 to my .swift-build-presets and I see it showing up the arguments sent to the libdispatch compiler. Though I’m still not seeing any logs actually being written.

I think you need to set LIBDISPATCH_LOG in your environment when you are running the program as well.

https://github.com/apple/swift-corelibs-libdispatch/blob/a618b468b94ad6abb14a19af76e33018700af6bc/src/init.c#L687-#L705

1 Like

:tada:

LIBDISPATCH_LOG=stderr ./test

Thank you @dgrove-oss

Terms of Service

Privacy Policy

Cookie Policy