Skip to content
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

Skip empty symbol names while attempting to parse json #204

Merged
merged 2 commits into from Oct 21, 2020

Conversation

MathiasKoch
Copy link
Sponsor Contributor

Avoid Error: EOF while parsing a value at line 1 column 0 if .defmt section should contain a symbol with empty name.

This might occur if you run arm-none-eabi-objcopy ${IN} ${OUT}, where IN is the output ELF of cargo build.

@japaric
Copy link
Member

japaric commented Oct 21, 2020

Thanks for the PR! Could you describe in more detail how to cause the error that this is fixing? Does the error come from objcopy? Or you running objcopy on a single ELF file before passing that to probe-run?

@MathiasKoch
Copy link
Sponsor Contributor Author

Ahh, yeah. After reading my description again, I can see how it might be a bit ambiguous.

If i compile a device side firmware file using defmt, and then run that ELF file through ? objcopy, the resulting ELF file looks 100% identical when looking at it with nm and objdump, but it contains "" (empty string name) symbols in the .defmt section among others. I still don't understand why this happens though?!

@japaric
Copy link
Member

japaric commented Oct 21, 2020

Thanks for clarifying. I'll reproduce the issue locally to get a better understanding at what objcopy is doing. (Mostly because I'm curious)

I'm OK with this PR. Could you add a comment to the source code indicating why we are skipping empty symbol names? (i.e. "they may be added by objcopy")

@MathiasKoch
Copy link
Sponsor Contributor Author

MathiasKoch commented Oct 21, 2020

Yeah sure. If you end up figuring out why it produces these empty strings, please let me know somewhere :) eg Matrix..

In case it matters, I have seen it using

> arm-none-eabi-objcopy --version
GNU objcopy (GNU Binutils) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

I have spent the better part of two full days trying to find out what happened, and have split my entire firmware to pieces in the process 🕵️

Copy link
Member

@japaric japaric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@japaric japaric merged commit 91f33fc into knurling-rs:main Oct 21, 2020
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.

None yet

2 participants