-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
ELF class upgrades #798
ELF class upgrades #798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick first pass over lunch. Will have to look it over but it looks great!
- updated types of Phdr attributes - added `classproperty` decorator - updated deprecated ELF constants
- Added `_missing_` functions for `Shdr` and `Phdr` to get a generic case (we don't aim to be a complete elf parser)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two tiny comments. Looks great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a side note: I love how easy and quick it was to read the PR (considering the size of it) with the new syntax and type hints.
Just a few small remarks...
Also I wasn't able to mark this line in the review but in L8036 you still use the deprecated get_entry_point()
. It should be replaced with something like
- entry = get_entry_point()
- if entry is None:
- return
+ if not gef.binary:
+ return
+ entry = gef.binary.entry_point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on arm32, arm64, mipsel32 by loading and running a simple program. All works well so I think there's no issue with everything else.
Found some inconsistent whitespace but other than that all's good
Co-authored-by: Daniel Lim Wee Soong <[email protected]>
Description/Motivation/Screenshots
Bringing some more Python3.6 joy to the
Elf
class and subclass, also benefiting the type hinting, which allows to delete ~100 loc of string printing. Some details:enum.Enum
orenum.Flag
in theElf
,Phdr
andShdr
classesget_entry_point
can now be deprecated in favor ofgef.binary.entry_point
is_arch
,is_x86_*
) which are way faster now (one lookup and test vsgdb.execute
)set_arch
toreset_architecture
(doesn't return, the result was never used anyway)Elf
raise if the binary is corrupted (i.e. bad magic), any GDB won't process itElf.$arch : int
was kept but deprecated (since they are property we can't use the decorator, so if you have ideas 😄 )How Has This Been Tested?
make test
Checklist
dev
branch, notmaster
.