Debugging is an inseparable part of the development process. People make mistakes, so our code doesn’t do what we expect once in a while. Often such problems happen at the worst possible time. That’s why it’s a good idea to master debugging techniques and skills to more precisely isolate the source code of a problem and fix it in a timely manner.
In the Debugging with PlatformIO series, we will be exploring the debugging capabilities of the PlatformIO ecosystem. Read more
Hi,
Thanks for this great article. It helps a lot. It works perfectly when I use Visual Studio Code but I get an popup window with an error message when I try to use the debugger with VSCodium.
The error message I am getting is : Failed to load symbols from executable file: ENOENT: no such file or directory, scandir
I have not found a hit in google yet. Is there something particular I need to configure in VSCodium ?
Any suggestion on how to progress to fine what is wrong will be greatly appreciated.
Best regards
Bruno
This is a great article and it works perfectly for me. I have a question though…
I have a library project I have written which I include in many of my Arduino projects. I would now like to add unit tests to this library project, however I am confused about the use of src/include/lib folders. My library project uses src/include folders for the code. All the examples I have seen for creating unit tests require the source code to be in the lib folder. This implies either:
I shouldnt be using the src/include folders for the code in my library project, I should put it in lib
…or…
I can’t have unit tests in the same project as my library code. I.e. I must create a dedicated test project and copy the source code from my library project into the lib folder of the test project.
I cant send a link because It is a private library. However my question was for a very simple generalised case, for any library written for Arduino. Assuming the src/include folders are being used for the library source files (multiple h/cpp files each for a class of single responsibility), is it possible to use the “test” folder in that same project to write unit tests for those classes? It seems I have to create a new project where the source for the system under test resides within the lib folder.
So my library project is structured like this (showing how I would LIKE the test folder to be used):
Hello, I tried to follow the article, but I’m stuck at the " Working with Debugger’ step …
When I try to start the debugger, it doesn’t work. I do not get the debug view with the control actions and so on. Everything is empty. All I get is an error message in the debug console :
It seems to be related to python more than platformio directly. But pyhton is correctly running on my computer and I tried upgrading it but it is already the last version.
So I don’t know how to solve the problem.
My computer is a macbook with a M2 processor. Since this is an ARM architecture maybe It can cause some troubles. I don’t know …
Yes, I have no problems for the build. It is only the debug part which has a problem.
Processing native (platform: native)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/native/src/main.o
Linking .pio/build/native/program
========================================================================================= [SUCCESS] Took 0.29 seconds =========================================================================================
* Terminal will be reused by tasks, press any key to close it.
After checking, gdb is not installed on my computer. And it seems to be impossible to install it on a arm processor. When i try to install it manually, I get :
gdb: The x86_64 architecture is required for this software.
Error: gdb: An unsatisfied requirement failed this build.
From what I could see on the internet, lldb should be used instead of gdb on mac m1 and m2 :
lldb is already installed on my computer : lldb-1500.0.22.8
But I don’t know if the platformio debugger can work with it instead of gdb.
@guillaume.costes Yeah LOL I just looked up my projects and it was more or less only once I really made a debug session and I can’t find a trace. Hopefully I’ll find the time to reconstruct it stll this year…