Outputting a full log via the serial port when debugging can sometimes be really helpful, because it contains all sorts of state information.
idf.py menuconfig
In the VS Code “TERMINAL” window, enter: idf.py menuconfig
(You may need to use CTRL + ] to end its current mode and get its command prompt first)
This will bring up the menuconfig UI within the terminal window.
Use the J & K keys for UP/Down
Enable the verbose debug level: “Component config -> Log output -> Default log verbosity” and set it to “Verbose” (instead of its default level “Info”).
Save and quit
Then build the project again and launch it.
You will now see all sorts of extra information in the terminal window output.
Things to be aware of
You may introduce a new stack overflow error when using the ‘Verbose’ verbosity level, because it consumes extra memory.
For instance, if the thing that’s causing the problem is created using xTaskCreate() consider adding 1024 or 2048 bytes of extra stack in the xTaskCreate() call.