Merged
Conversation
example/jitter/memstruct.py
Outdated
Contributor
There was a problem hiding this comment.
It seems that memstruct are more related to miasm2.core, as DiGraph than analysis module, such as miasm2.analysis.depgraph.
Contributor
Author
There was a problem hiding this comment.
I agree, if it is ok with @serpilliere too, I will move it.
This commit is the first phase of the Type refactor. The PinnedType class has been separated from the more specific PinnedStruct class.
Doc is currently incoherent, impl will also be completed
Array access logic has moved to Array, Pinned(Sized)Array just contains the logic to interface with memory
MemStr.from_str allows to allocate and set a string automatically if ALLOCATOR is set. This avoids allocating a buffer and filling it later.
Shorthand for ("field", SomeMemStruct.get_type()) in a Struct or
MemStruct fields definition.
See the test addition for an example. A Struct, Union, or BitField field
with no name will be considered anonymous: all its fields will be added
to the parent Struct/Union/BitField. This implements this kind of C
declaration:
struct foo {
int a;
union {
int bar;
struct {
short baz;
short foz;
};
};
}
Also added tests and MemArray.get_offset
6892d3d to
b421c50
Compare
Contributor
Author
|
Ready to merge for me, as soon as tests pass. |
Contributor
|
Hey, Santa Claus brought another heavy gift! 🎅 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces an API to easily interact with C structures in miasm's sandbox.
The
example/jitter/memstruct.pyexample file may be the best introduction to this feature. As a spoiler, here is how a linked list can be represented with this API (extracted from the aforementioned file):Lots of FIXME/TODO are left there for now and lots of choices can be discussed, please tell me what you think!
-- Florent