PlatformIO Community

Debugger using huge amounts of CPU and battery until python is force quit

I’m trying to debug a native process crash issue on MacOS. What I’m finding is that whenever I do this, Python pegs the CPU at 100% and my battery starts rapidly draining. The only way I’m able to get this to stop is to kill Python. The process I’m trying to debug is crashing and I’m trying to narrow down the crash, so maybe this is causing some sort of race condition within the code that interfaces with gdb. This is really frustrating since whenever I’m done debugging I have to go make sure to manually kill Python to prevent excessive CPU drain.

Is this a known issue and is there anything I can do to help narrow down what’s going on here? (I’m not well versed in MacOS system tracing.)

Thanks!

Environment details

MacOS 11.6.2
VSCode: 1.63.2
PlatformIO extension: 2.4.0
PlatformIO Core: 5.2.4

Does this happen on the CLI too if you execute pio debug --interface=gdb -x .pioinit and then continue etc?

1 Like

That’s a great suggestion – I’ll give this a try and see if it repros there.

When using the CLI I am not seeing this problem occur. I can see the process segfaulting and I can get information from gdb manually. There’s no runaway CPU usage and when I quite gdb, the pio wrapper exits cleanly.

This appears to be something specific to how VSCode is interacting with gdb behind the scenes. When looking at VSCode’s task manager I don’t see any high usage from VSCode itself or from the PlatformIO extension.

If your issue only occurs within VSCode + PlatformIO, please file an issue in https://github.com/platformio/platformio-vscode-ide/issues. Debugging a segfaulting program might be an edge case in which it goes in an infinite loop somewhere. Provide the platformio.ini and minimal program too.

1 Like

Indeed. I’ve filed a bug on GitHub:

Hopefully this can lead to a fix. It’s pretty aggravating. :slight_smile: