-
-
Notifications
You must be signed in to change notification settings - Fork 741
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
correct parsing in gdb_get_location_from_symbol #1037
Conversation
Hi @Angelo942 , with this, I believe the |
although this means we are missing test case..... do you mind to help update the test case: |
I'll look into it |
@r12f, I wrote it, but I have a problem. If I do |
It could be worth checking for a more native way to handle symbols than string parsing. The |
Right now I'm worried about this part from the tests: |
Hi @Angelo942 , for your question below:
how $pc is set is platform dependent. why you are seeing it, is very likely because you are running on an ARM64-based machine, which $pc will be set to 8 bytes after the breakpoint. "+4" would work on CISC arch machines, like x64. I did a quick change on this branch and looks like it works for me: https://github.com/r12f/gef/tree/user/r12f/xinfo-offset. so instead of checking "+4", we can assert against "Symbol: B<TraitA, TraitB>::Run()+", just to ensure offset is indeed parsed. (still with |
@r12f, I found the problem. "The difference is that b *main breaks on the first instruction of main, while b main breaks on the first instruction after the function prologue." I changed the command we use to set the breakpoint so that now it is indeed on the first instruction of the function and $pc+4 works. But regarding ARM, are you sure that the check would fail ? |
I see. That makes sense. for the ARM question, although I don't have a working arm board at hand to validate right now, but at least that's what ARM doc says: Register-relative and PC-relative expressions.
|
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.
LGTM
self.assertNoException(res) | ||
self.assertIn("Symbol: B<TraitA, TraitB>::Run", res) | ||
self.assertIn("Symbol: B<TraitA, TraitB>::Run()+4", res) |
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.
🔥
Description
As stated in the comments
info symbol
returns "<symbol_name> + <offset>
" with spaces around the+
. The current split leaves a space in front of the offset which makes .isdigit() return False.@r12f, do you think we still need the
.strip()
forsym[0]
?