csaf_distribution
csaf_distribution copied to clipboard
Document debugging
Currently, it is hard to debug the csaf_provider
as it needs to be called (or at least it needs to think that it is called) through nginx. To aid in the development, we need to document, how debugging works without the web server but from an IDE (or how to debug with the web server but still being able to set custom breakpoints...)
A few general hints:
- a go application must be compiled with additional flags to aid a debugger, the hints to doing so are documented here: https://go.dev/doc/diagnostics#debugging
- to make the cgi application wait, one way could be to use a very slow curl command adding
--limit-rate 1
to a call like https://github.com/csaf-poc/csaf_distribution/blob/de27a668d1327a776f87ef6cd3d74abb3cfc5aed/docs/scripts/setupProviderForITest.sh#L105 - Usually attaching to the running process works like https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_attach.md
- Delve can be integrated with a number of editors, IDEs or other frondends: https://github.com/go-delve/delve/blob/master/Documentation/EditorIntegration.md