-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
deref: added option to use reference address for offset calculation #676
Merged
Conversation
This file contains 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
theguy147
commented
Jul 20, 2021
theguy147
commented
Jul 20, 2021
theguy147
commented
Jul 20, 2021
theguy147
commented
Jul 20, 2021
theguy147
commented
Jul 20, 2021
Grazfather
reviewed
Jul 20, 2021
Grazfather
reviewed
Jul 20, 2021
This reverts commit d7669c5.
sorry for all the tiny commits! :/ i'm done now (unless you want me to change other stuff) |
No problem, we will squash, I just have to test this out. |
I did a simple test, works well, nice stuff 👍 |
Happy to merge when squashed, it looks like a good command (couldn't test yet). |
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.
Added Option for custom offset calculations for
deref
commandDescription/Motivation/Screenshots
This patch allows to set a different base address for offset calculation for the
dereference
command while not breaking previous usage. This allows quicker identification of relevant memory addresses in some cases. A common use case is usingebp
/rbp
as a reference on the stack inx86
architecture (see e.g the very old issue #67): That waygef
sdereference
command output can e.g. be compared easier to most, if not all, disassembler and decompiler outputs for stack variables.This is how the new usage looks like:
The new offset reference starts with a
r
-prefix followed by aLOCATION
.Technically the patch just adds an reference argument to the
dereference
command that is used to calculate the difference to the start_address and this difference is added/subtracted to the outputted offset.How Has This Been Tested?
make tests
No testing has been done because no other features of
gef
have been touched and also the new base address is an optional argument topprint_dereferenced()
.Checklist
dev
branch, notmaster
.EDIT:
An important change to the earlier version in terms of having offsets on the stack reference
rbp
/ebp
is that now also negative offsets are possible as usual with disassemblers/decompilers as well. Also the command can be used in other places than the stack and is not tied to the architecture (as it would be in the solution suggested in the above linked issue)