Skip to content

Retain unstripped ELF file for debugging #165

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 1 commit into from
May 11, 2016

Conversation

bbaltz505
Copy link
Contributor

In order to debug with JTAG, an unstripped ELF file is needed. This change creates two ELF files: stripped and unstripped

@bbaltz505
Copy link
Contributor Author

@SidLeung @kmsywula please review. I verified that the ARC gdb can read the unstripped ELF file created by the IDE.

@SidLeung
Copy link
Contributor

@bbaltz505 @calvinatintel Is there any reason you can think of that the elf file should not be created every time a Sketch is compiled? I vote to merge the change into the main trunk.

@bbaltz505
Copy link
Contributor Author

These files normally get deleted after flashing. In the Linux IDE, there is an option in preferences to keep the binaries. I don't think it hurts to always keep a debug binary around.

@SidLeung
Copy link
Contributor

@bbaltz505 Will that option in "Preferences" affects the elf file too? If so, the user has a choice. Let's merge it.

@bbaltz505
Copy link
Contributor Author

Windows seems to always keep the temporary build folder (e.g., C:\Users\babaltz\AppData\Local\Temp\build5a12ec7801f914e3a9c773f3624a5617.tmp/BarometricPressureSensor.ino.elf)
On the next sketch compile, that folder seems to get cleared out and used again.

@SidLeung
Copy link
Contributor

I think it is a new folder created and the old one deleted. Not the same folder. At least the number part of the folder is changed. Am I correct?

@bbaltz505
Copy link
Contributor Author

I believe the folder location is created when the IDE starts up. If you close and reopen your browser, it will use a new temp folder.

@bbaltz505
Copy link
Contributor Author

adding @bigdinotech for review

@bigdinotech
Copy link
Contributor

looks good to me. @calvinatintel please merge

@bbaltz505
Copy link
Contributor Author

I wonder if I should save the debug ELF somewhere more accessible - like the sketch folder? Otherwise the user has to have verbose compilation turned on and then copy the lengthy ELF path to use with the debugger.

@bigdinotech
Copy link
Contributor

That's a good idea to place the elf file in the same folder where the user saved it.
Only thing is they can write a sketch with out saving it and in that case where would we save the elf file?

@SidLeung
Copy link
Contributor

Yeah! Save it to the Sketch directory. Like it. If the user does save the Sketch... Well, the elf doesn't mean much to the user anyway.

@bbaltz505
Copy link
Contributor Author

Sorry Sidney. Actually now I don't like the idea of ELF files being left around in the sketch folder. That could be confusing to beginning users. Only advanced users are going to be debugging so they'll know how to find the ELF (via compile messages in the console window).

@SidLeung
Copy link
Contributor

How about a sub-directory under the user sketch folder, say, gdb_info?

@bbaltz505
Copy link
Contributor Author

According to Martino, the IDE does not have a pointer to the sketch folder. For now, I think its best to save the file in the build folder.
I updated the commit to just to copy the unstripped ELF before it's stripped. The command should support cross-platform.

@bbaltz505
Copy link
Contributor Author

@facchinm here is the config to save a debug ELF

@bbaltz505
Copy link
Contributor Author

@SidLeung ready for review. This change saves the debug elf file as {build.path}/../arduino101_sketch.debug.elf
e.g., C:\users\babaltz\appdata\local\temp\arduino101_sketch.debug.elf

@SidLeung
Copy link
Contributor

@bbaltz505 @calvinatintel Looks good. BTW, what the location for Ubuntu? Please merge.

@bbaltz505
Copy link
Contributor Author

I believe temporary build folders are in /tmp so the debug ELF file would be:
/tmp/arduino101_sketch.debug.elf
These debug ELF files are not automatically cleaned up when the IDE closes and are overwritten on each sketch build.

@bbaltz505
Copy link
Contributor Author

rebased onto latest master

@bbaltz505 bbaltz505 merged commit 2bea587 into arduino:master May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants