Skip to content

[debug] Support breakpoints on sketch libraries #601

Closed
@spoenemann

Description

@spoenemann

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.

Activity

matthijskooijman

matthijskooijman commented on Mar 4, 2020

@matthijskooijman
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

spoenemann commented on Mar 4, 2020

@spoenemann
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

matthijskooijman commented on Mar 4, 2020

@matthijskooijman
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

per1234 commented on Sep 30, 2021

@per1234
Contributor

Closing as fixed by #1224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      [debug] Support breakpoints on sketch libraries · Issue #601 · arduino/arduino-cli