feat: add overlap()
to merge 2 FileStructure
objects
#2635
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #2634
What does this PR add?
This PR adds an
overlap()
method to the existingFileStructure
class which allows the user to merge 2FileStructure
objects. This is particularly useful when we have overlapping structs linked via the->chain
field.Apart from the main
overlap()
method, for convenience, this PR also introduces 2 new methods:from_bytes()
- a class method which allows the user to create aFileStructure
object from a byte stringoffsets()
- exports the architecture-specific offsets for all fields of the struct. This will also be very helpful in case the user wants to manually construct the fields withflat()
, and use sane names likeoffsets['vtable']
instead of hard-coded numbers like216
Does this PR modify any existing code?
No