csaf_distribution icon indicating copy to clipboard operation
csaf_distribution copied to clipboard

Document debugging

Open tschmidtb51 opened this issue 1 year ago • 1 comments

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

tschmidtb51 avatar Jun 30 '23 05:06 tschmidtb51

A few general hints:

  1. 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
  2. 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
  3. Usually attaching to the running process works like https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_attach.md
  4. Delve can be integrated with a number of editors, IDEs or other frondends: https://github.com/go-delve/delve/blob/master/Documentation/EditorIntegration.md

bernhardreiter avatar Jul 14 '23 12:07 bernhardreiter