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.
Resolve Context Trace Symbols
Description/Motivation/Screenshots
This PR is more of an opinion feature than an actual new feature. In
context_trace
, the function responsible for printing the backtrace of an execution, there is a line that will construct what is printed to gef when gdb can't find a name for the current context frame. In that case, GEF will always print an instruction; however, it does not attempt to resolve symbols again for that address.I purpose the change to call the very standard function
gdb_get_location_from_symbol
on the frame to check if gdb has knowledge of symbols. You may be asking, how can this branch ever trigger? It can trigger when the user manually adds his own symbols viaadd-symbol-file
. The effort to add it, and the execution overhead are minimal (on my testing).Lastly, this PR serves as a more robust way for external users to override how symbol resolving works in GEF. Take the case where a user overrides
gdb_get_location_from_symbol
, they now can have a custom symbol table that is architecture independent. Sincegdb_get_location_from_symbol
is used in nearly every other context function, it feels right to use it here as well.Here is an example of what this little fix can look like once a user knows a symbol (ignore symbols in code):
How Has This Been Tested?
make test
Checklist
dev
branch, notmaster
.