I have some code that works fine from the debugger, but does not run without the debugger. I would like to attach the debugger to see what is going on. However, I don't see an option in VSCode to attach to a running process? How is that done?
I have some code that works fine from the debugger, but does not run without the debugger. I would like to attach the debugger to see what is going on. However, I don't see an option in VSCode to attach to a running process? How is that done?
Hello!
As far as I know this is not possible, as you'll have to start the program in debug mode in order to use the debugger.
But the fact that your code works in debug mode is a good lead towards figuring out what's wrong. I would assume the issue has to do with power or clock configurations, as these are very different when running in debug mode.
What exactly is your code supposed to do that isn't working?
Best regards,
Einar
Hello!
As far as I know this is not possible, as you'll have to start the program in debug mode in order to use the debugger.
But the fact that your code works in debug mode is a good lead towards figuring out what's wrong. I would assume the issue has to do with power or clock configurations, as these are very different when running in debug mode.
What exactly is your code supposed to do that isn't working?
Best regards,
Einar
Rowley Crossworks has the capability to attach the debugger to a running process. That is the IDE I have been using before the required switch to NCS & VSCode. That is the functionality that I'm looking for. Hard to believe this isn't possible in VSCode as it seems a pretty common thing to need to do.
In my case the code never gets to my main. So it seems that it is stuck in the zephyr startup sequence somewhere.
Then I assume there's an issue with how you set up power or clock, it would help with more details on what you're doing.
I can look into attaching the debugger.
The attach mode does not seem to automatically load the debug info from the elf. If I manually load then I can debug. Is that a bug? Seems like the nRF VSCode extension should also have an "Attach" button (similar to the "Debug" button) that does all this automatically.
Here is what I have in launch.json using a post attach command: