Skip to content

Use absolute paths in #line directives generated #9

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

Merged
merged 2 commits into from
Sep 23, 2015

Conversation

matthijskooijman
Copy link
Collaborator

Multiple .ino files in a sketch are concatenated together, adding #line
directives so error messages refer to the original filenames. However,
these directives used plain filenames, without a path. Since these
filenames end up in the debug info as-is, this complicates using a
debugger on the resulting .elf file. Using full pathnames fixes this.

This fixes arduino/Arduino#3746.

Signed-off-by: Matthijs Kooijman [email protected]

@ffissore
Copy link
Contributor

TestMergeSketch (file sketch_source_merger_test.go) now fails. Since it has to pass on different PCs and OSs, you should add a placeholder to merged_sketch.txt and replace it at test time using the actual absolute path sketch1.ino

@matthijskooijman
Copy link
Collaborator Author

@ffissore, is there any test already with similar placeholders to copy from / keep consistency with?

@ffissore
Copy link
Contributor

None. However there's an Abs helper func that you can use
Il 22/set/2015 17:40, "Matthijs Kooijman" [email protected] ha
scritto:

@ffissore https://github.com/ffissore, is there any test already with
similar placeholders to copy from / keep consistency with?


Reply to this email directly or view it on GitHub
#9 (comment)
.

Multiple .ino files in a sketch are concatenated together, adding #line
directives so error messages refer to the original filenames. However,
these directives used plain filenames, without a path. Since these
filenames end up in the debug info as-is, this complicates using a
debugger on the resulting .elf file. Using full pathnames fixes this.

This fixes arduino/Arduino#3746.

Signed-off-by: Matthijs Kooijman <[email protected]>
@matthijskooijman
Copy link
Collaborator Author

I pushed one more commit to fix the testcase. I ended up using the text/template package to allow interpolating anything from the context, which is (more than) sufficient for this usecase (and easier than implementing some string replace manually). If you think it's ok, I'll squash the commits together to prevent breaking the testcases in the first commit.

@matthijskooijman
Copy link
Collaborator Author

Oh, seems there's more testcases breaking, hold on.

@matthijskooijman
Copy link
Collaborator Author

Ok, pushed a few more fixes, all tests succeed again now.

@ffissore
Copy link
Contributor

Uhm are you sure? All tests from prototypes_adder_test.go are failing now

This uses the text/template package to process the sketch file, allowing
it access to the full context. This is a bit overkill, but it is easy
and might be useful for more complex testcases later.
@matthijskooijman
Copy link
Collaborator Author

Seems I did just git commit --amend and forgot the -a :-)

Fixed now.

ffissore added a commit that referenced this pull request Sep 23, 2015
Use absolute paths in #line directives generated
@ffissore ffissore merged commit 11d6b18 into arduino:master Sep 23, 2015
@ffissore
Copy link
Contributor

👍

@ffissore
Copy link
Contributor

Sorry @matthijskooijman, after I merged it I noticed your second commit was not signed off. I can't reopen this PR. Please make another one and ensure each of your commits is signed off. Might be worth installing this local git hook https://github.com/arduino/arduino-builder/wiki/Be-sure-your-commit-is-Signed-off-by

@matthijskooijman
Copy link
Collaborator Author

W00ps! I'll submit a new PR with signoff in a minute.

Perhaps it's also an idea to have github automatically check PRs for signoff lines? Seems github itself cannot do this, but it should be easy to use a webhook for this (see this example), or perhaps this can be added to ArduinoBot?

@ffissore
Copy link
Contributor

Yes, that's part of an infrastructure work I plan to do next week

@matthijskooijman
Copy link
Collaborator Author

Btw, I just realized I didn't sign off the commit because I wanted to squash it with the first commit (I left it as separate commits for easier review first). Also, this commit does have some side effects (like breaking errror highlighting and making the error display less clear, see https://github.com/arduino/Arduino/issues/3745#issuecomment-142365575), so some additional changes are needed in the IDE too. Let's track those in that issue, I'll re-open it.

I've also modified to hook in the wiki page to only give a warning about improper messages, without actually breaking the commit. This still allows committing things for testing without having to sign it off, or allows locally commiting other people's code that you can't sign off. Requiring signoff for all commits will actually reduce its value, since people will then just signoff everything, even if not appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arduino IDE compiler should generate full path for .ino file in .elf
2 participants