-
-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GDB debugger support for native platform #980
Comments
Since there is no progress on this for (close to) 3 years, I'll provide my hotfix for linux (might work on mac as well, haven't tested that):
If you want to change the file, change its permissions back to (f.e.) 666, change the contents and change the permissions back to 444. |
Does that means currently I can not use the windows_x86 platform and debug via mingw gdb? |
To be honest, I haven't thought of windows. You can try generating a configuration automatically from within vscode (there should be a button when you open the |
I tried this
But my miDebuggerPath seems to bad according to the pop up message. |
worst-case you can always use gdb directly (optionally with a custom .gdbinit such as pwndbg). |
Yes, that would really be the worst-case. :-) Having a nice looking IDE and using gdb on console. LOL |
@ivankravets hey there - is there any chance to get this feature in the next time? Atm i'm playing around with jumper.io 's virtual Lab. Adding in the |
Sorry, currently we do not have plans to implement this. It is still in our TODO list :( |
Is there another way to configure this manually and prevent PIO for overwritting this every time? EDIT: |
I see, haven't looked at this much. Won't this break with every platformIO update, however? (as, I think, that overwrites your penv folder) |
@qwerty123443 Yes i think you're right - that maybe get lost after an update :( |
Thanks for this hint - I'll try this. Is there a way to use a other (local installed) gdb with EDIT:
Am i right, that this option will prevent from building all - also the intellisense (auto-complete) ? I just can't believe that I can't tap an external debugger with platformIO - thats a really common usecase in the real world, that i want to debug a running system over a simple GDB <-> GDBServer connection. |
Hey, great project, congrats! |
To be honest - it's a little bit disappointing that there is no progress in this issue after more than 3 years. This feature would be really helpful. |
I have had success getting the VSCode debugger to launch by pasting the right values into {
"name": "Launch Sim",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.pio/build/simulator/TheSimulator",
"miDebuggerPath": "/usr/local/bin/gdb",
"MIMode": "gdb",
"cwd": "${workspaceFolder}/.pio/build/simulator"
} For the native build option in our project we only need support for native |
Thanks all for your ideas. Yes, it makes sense to use directly |
Not sure what's possible on macOS, where gdb no longer works. I'm always forced to move to Linux for debugging a native build - this is obviously not PIO's fault, but I'd be nice to get some sort of of cmd-line based debugging going - some day. PS. This not a statement about macos vs linux, the former just happens to be my main dev environment :) |
What's interesting is that I did get the debugger in VSCode working at one point through However, in my more recent testing I have not been able to get the debugger to run reliably in VSCode, and in fact now it always gets hung up when trying to start the process, regardless of how I launch Maybe I just had a brief spot of good weather, but I'll continue to experiment and see whether any reliable debugging is possible on this system with some version of |
I have this config working on VSCode on Mac. It's generated by default using "add configuration button" and selecting "(lldb) Launch" option.
|
I am using command palette (Ctrl-Shift-P) and select 'C/C++: Build and Debug Active File' -> 'gcc build and debug active file' to start debugger. Works on Win10 and remote WSL:Ubuntu environment. |
If you make any edit to the As a side topic, I would like to hear from developers on macOS who have gotten either the I went through the system rigamarole to give I'll be sure to ask around the PlatformIO community forum next time I'm on that task. |
Here's a tip to automatically build before starting a session, and to get working stack traces. First, put the following in [env:simulator]
platform = native
build_type = debug Then, add the following section to your {
"name": "Debug simulator",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.pio/build/simulator/program",
"args": [],
"environment": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": "PlatformIO: Build (simulator)"
} Note the There is no need to clear out any other debug configurations, just add yours to the existing ones, but as others noted, you'll have to do this every time you make a change to |
Debugging for native (desktop) applications is implemented. Please note that there are some issues with our VSCode extension. We will fix them soon. See platformio/platformio-vscode-ide#2447 In any case, using this configuration as @thinkyhead proposed is a good idea:
The latest PlatformIO Core does not overwrite |
To follow up on an old comment: native debugging on macOS with gdb still doesn't work for me, but UPDATE: I haven't trid the latest changes mentioned above. Maybe it all works now. Just wanted to mention |
I'm on the macOS. The screen above is mine. I used GDB from |
Great! I've been doing a lot of remote debugging lately in the CLI and it'll be great to get back into proper GUI mode. |
@thinkyhead please note that the latest PIO Core also has support for native debugging :) See https://github.com/platformio/platformio-core/blob/develop/HISTORY.rst P.S: Happy to see how PlatformIO helps other open-source projects. Marlin is a great example!!! Great job! 🚀 |
Magic - just tried this and it worked first time with zero additional configuration! |
Some of my projects include shared components targeting desktop machines as well as microcontrollers. It would be extremely helpful to have the PIO debugger integrated with GDB to enable local native debugging.
The text was updated successfully, but these errors were encountered: