Skip to content

[debug] Support breakpoints on sketch libraries #601

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

Closed
spoenemann opened this issue Mar 4, 2020 · 4 comments
Closed

[debug] Support breakpoints on sketch libraries #601

spoenemann opened this issue Mar 4, 2020 · 4 comments
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@spoenemann
Copy link

Bug Report

See https://github.com/arduino/arduino-pro-ide/issues/217 for a detailed description of the problem.

Cause of this problem:
The CLI copies sketch libraries to a temp folder and compiles them from there. With this approach, the source path included in the debugging information is in the temp folder, not the original sketch folder, so breakpoints set on files in the sketch folder are not considered.

Possible solutions:

  • Don't copy sketch libraries to the temp folder.
  • Add #line compiler directives to the copied files like it's done by the .ino preprocessor. These directives are understood by gcc so it uses the correct source paths in the debugging information.
@matthijskooijman
Copy link
Collaborator

I was under the impression that #line directives are already added? At least the java IDE does so. IIUC the pro IDE uses arduino-cli to compile (whereas the java IDE uses arduino-builder which uses the legacy building code in arduino-cli), so maybe there is a difference between both compilation flows?

Did you check the generated .ino.cpp file to see if there are indeed no line directives in there?

@spoenemann
Copy link
Author

Did you check the generated .ino.cpp file to see if there are indeed no line directives in there?

The generated .ino.cpp does include the line directives, that's why setting breakpoints in the .ino file works out of the box. But additional .c / .cpp files used by the sketch are copied unchanged.

@matthijskooijman
Copy link
Collaborator

Ah, I totally misread your report, sorry.

Also see arduino/arduino-builder#323 which requests the same thing, and arduino/arduino-builder#325 which implements this in arduino-builder.

Also, I would really like it if we could change the build process to not require these copies at all (so just compile files directly from the sketch directory, rather than printing them), but I think it is tricky to get right (especially wrt getting #include "foo.h" directives to work as expected). I think I wrote a bit about this somewhere sometime, but I don't remember where :-p

@per1234
Copy link
Contributor

per1234 commented Sep 30, 2021

Closing as fixed by #1224

@per1234 per1234 closed this as completed Sep 30, 2021
@per1234 per1234 added conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement labels Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants