Skip to content

Add serde support#10

Merged
mnemonikr merged 5 commits intomnemonikr:mainfrom
soruh:add-serde-support
Oct 17, 2025
Merged

Add serde support#10
mnemonikr merged 5 commits intomnemonikr:mainfrom
soruh:add-serde-support

Conversation

@soruh
Copy link
Copy Markdown
Contributor

@soruh soruh commented Oct 13, 2025

I would like to use the pcode instructions produced by this crate as an initial IR. As such I would like to persist intermediate steps to disk.

To make this possible, this PR adds the serde-derive macros to all exposed structs/enums if the serde feature is enabled.
This allows users to opt-into the serde dependency.

I have added some trivial tests.
I am not quite sure how the AddressSpacees / AddressSpaceIds behave across different instances of libsla but as far as I can see basically all structs/enums have only public fields anyways. So it was already possible to use possibly invalid address space ids before...

For the tests I have added derives for PartialEq, Eq to AssemblyInstruction and NativeDisassembly.

@mnemonikr
Copy link
Copy Markdown
Owner

Thanks for the contribution! You're right, doing so on these types right now introduces a subtle footgun, which is the deserialized data will not work correctly with Ghidra's Sleigh across executions. This is due to how libsla currently maps an address space for Ghidra by its address space id. So the footgun isn't due to this change, it's due to the subtle behavior of this mapping.

I believe we can move to using the address space name to avoid issues with Sleigh in those cases. Documented in #11. Will fix that, then we can land this.

@soruh soruh force-pushed the add-serde-support branch from 4fb3d76 to d533209 Compare October 16, 2025 19:25
@soruh
Copy link
Copy Markdown
Contributor Author

soruh commented Oct 16, 2025

I rebased this onto the current main and added a changelog entry.

@mnemonikr mnemonikr merged commit 4c17396 into mnemonikr:main Oct 17, 2025
1 check passed
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.

2 participants