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

C-ABI: Add method to create symbolic archive from bytes buffer #250

Merged
merged 3 commits into from
Jun 25, 2020

Conversation

unclead
Copy link
Contributor

@unclead unclead commented Jun 24, 2020

It would be nice to have the method to create an archive from bytes buffer.

For instance, I have a zip archive with dSYM files and I have to unpack the zip archive to a temp directory, then call the method symbolic_archive_open for each file in order to get symbolic archive instance.

Instead of it, I want to just read the slice of bytes from the zip archive and create the symbolic archive instance from it without the necessity to save the buffer to a temporary file to open it further using current exposed methods

p.s. I've tried to generate heard file calling make file command but it failed due to rust compilation error, so I just added the new method to the file manually (I'm not good in rust to fix such errors)

@unclead unclead requested a review from a team June 24, 2020 18:04
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

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

Thanks, this features makes a lot of sense.
No worries about the header, I'll try to convert and try to address compilation errors if I encounter any


archive = Archive.from_bytes(buf)
obj = archive.get_object(arch="x86_64")
assert obj.features == set(["symtab", "unwind"])
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding a test! Would you mind moving this into a separate test function to keep the concerns separated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

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

Thank you!

I took the liberty to run cbindgen on my machine to recreate the header.

@jan-auer jan-auer merged commit 281fd3b into getsentry:master Jun 25, 2020
@@ -28,7 +28,7 @@ enum SymbolicErrorCode {
SYMBOLIC_ERROR_CODE_OBJECT_ERROR_UNSUPPORTED_OBJECT = 2101,
SYMBOLIC_ERROR_CODE_OBJECT_ERROR_BAD_BREAKPAD_OBJECT = 2102,
SYMBOLIC_ERROR_CODE_OBJECT_ERROR_BAD_ELF_OBJECT = 2103,
SYMBOLIC_ERROR_CODE_OBJECT_ERROR_BAD_MACH_OOBJECT = 2104,
SYMBOLIC_ERROR_CODE_OBJECT_ERROR_BAD_MACH_O_OBJECT = 2104,
Copy link
Member

Choose a reason for hiding this comment

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

heads up! I manually reverted this line when working on proguard

Copy link
Member

Choose a reason for hiding this comment

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

👍 Thanks. I evaluated this again and thought it's OK to change this now. WDYT?

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

3 participants