-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Arduino IDE compiler should generate full path for .ino file in .elf #3746
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
Arduino IDE compiler should generate full path for .ino file in .elf #3746
Comments
I get this working with a small workaround. Looks like if there is any reference to .ino file in the produced .elf the debugging IDE gets all mixed up. Would it be possible to make this an option in the preferences ? Here's the workaround: myblink.ino file contains only this line:
and myblink2.cpp contains the actual program.
|
Can you suggest an alternative? Is there a gcc macro/define/pragma to add to the sketch such information? Or maybe a gcc param? |
That is a good question! I don't know the answer. I will need some more time to investigate this issue and possible solution. I found out that Compiler.java contains code that writes that "#line" into the .ino. I guess I could try to download Arduino sources and modify that part and try something. I'm thinking to modify it so that it adds full path of .ino into the .cpp. Do you know if that is possible ? Maybe that will help but I don't believe it is enough. It might be hard to come up with proper solution without breaking existing functionality. But let's see. |
processing\app\debug\Compiler.java
In line 1386 we should ensure that sc.getFileName() returns full path. At least for .ino. Now it returns only filename (e.g. Blink.ino) and not the full path. How does this sound ? |
Try hard coding a path that's valid on your pc and try |
I modifed Arduino IDE so that it does not print #line directives at all into preprocessed .cpp file. I changed some lines in PrePDEProcessor.java and Compiler.java. Only a few small changes. Then it works okay. It did not help the original problem if I hardcoded full path. Can we make this as an advanced option in preferences? 'disable creating #line directives' or something like that. If you accept or can consider this kind of option in preferences I am ready to make all the necessary changes and commits to git for that. Thanks. |
we can't remove line directives: they are used by gcc to report errors at the actual line in the actual file. test it with a sketch made of 2 .ino files and insert an error in the second one (like omittin a |
@maichaell have you found a solution which doesn't break existing features? |
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]>
I just modified arduino-builder to output full paths instead of just filenames. The changes are simple, see arduino/arduino-builder#9. So far, I've found three consequences of doing so:
I haven't done any thorough testing yet, but I'll be running with the change applied for a while. |
Matthijs, thanks. This is pretty nice fix. Let's hope you can address the other issues too like the error highlighting you mentioned. I haven't tried this fix yet but it is pretty much what I was going after in the beginning. |
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]>
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. The tests are updated to expect full paths as well. 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. This fixes arduino/Arduino#3746. Signed-off-by: Matthijs Kooijman <[email protected]>
Fix will be available with next hourly build http://www.arduino.cc/en/Main/Software#hourly |
Arduino IDE compiler generates wrong path information for .ino file in .elf and GDB shows incorrect path. Actually there's no path at all in the .elf file for .ino. This results the path to be resolved relative to 'arduino.exe' process. The path to .ino should probably be hardcoded in the generated (.ino to .cpp) .cpp file.
I am using Arduino IDE 1.6.5 but I tried this with Arduino Nightly build and it has the same problem
Looking at generated .elf file with GBD shows that path is: C:\Program Files (x86)\Arduino/Blink.ino
This results in error when debugging the file in Eclipse
C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q3\bin>arm-none-eabi-gdb d:\Users\me\AppData\Local\Temp\build321087032653580089.tmp\Blink.cpp.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140731-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from d:\Users\me\AppData\Local\Temp\build321087032653580089.tmp\Blink.cpp.elf...done.
(gdb) info source
No current source file.
(gdb) info sources
Source files for which symbols have been read in:
Source files for which symbols will be read in on demand:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\hooks.c, C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp,
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\wiring_digital.c,
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\wiring.c, C:\Program Files (x86)\Arduino/Blink.ino,
D:\Users\me\AppData\Local\Temp\build321087032653580089.tmp\Blink.cpp
(gdb)
The text was updated successfully, but these errors were encountered: