Skip to content
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

Issue when renaming x26 #1

Closed
cryptax opened this issue May 30, 2024 · 2 comments
Closed

Issue when renaming x26 #1

cryptax opened this issue May 30, 2024 · 2 comments

Comments

@cryptax
Copy link

cryptax commented May 30, 2024

This is the initial disassembly:

[0x003f5d18]> pdf
┌ 48: dart.entry0 ();
│           0x003f5d18      fd79bfa9       stp x29, x30, [x15, -0x10]!
│           0x003f5d1c      fd030faa       mov x29, x15
│           0x003f5d20      501f40f9       ldr x16, [x26, 0x38]
│           0x003f5d24      ff0110eb       cmp x15, x16
│       ┌─< 0x003f5d28      c9000054       b.ls 0x3f5d40
│       │   ; CODE XREF from dart.entry0 @ 0x3f5d44(x)
│      ┌──> 0x003f5d2c      07000094       bl 0x3f5d48
│      ╎│   0x003f5d30      e00316aa       mov x0, x22
│      ╎│   0x003f5d34      ef031daa       mov x15, x29
│      ╎│   0x003f5d38      fd79c1a8       ldp x29, x30, [x15], 0x10
│      ╎│   0x003f5d3c      c0035fd6       ret
│      ╎└─> 0x003f5d40      b2f0ff97       bl 0x3f2008
└      └──< 0x003f5d44      faffff17       b 0x3f5d2c

I want to rename x26 by THR. Okay?
I issue this command:

[0x003f5d18]> e asm.pseudo=true
[0x003f5d18]> afen THR x26

The result is erroneous:

[0x003f5d18]> pdf
┌ 48: dart.entry0 ();
│           0x003f5d18      fd79bfa9       [x15 - 0x10]! = (x29, 2)
│           0x003f5d1c      fd030faa       x29 = x15
│           0x003f5d20      501f40f9       x16 = [x26 + 0x38]
│           0x003f5d24      ff0110eb       if (x15 == x16)
│       ┌─< 0x003f5d28      c9000054       b.ls 0x3f5d40
│       │   ; CODE XREF from dart.entry0 @ 0x3f5d44(x)
│      ┌──> 0x003f5d2c      07000094       0x3f5d48 ()
│      ╎│   0x003f5d30      e00316aa       x0 = x22
│      ╎│   0x003f5d34      ef031daa       x15 = x29
│      ╎│   0x003f5d38      fd79c1a8       (x29, 2) = 3
│      ╎│   0x003f5d3c      c0035fd6       
│      ╎└─> 0x003f5d40      b2f0ff97       0x3f2008 ()
└      └──< 0x003f5d44      faffff17       goto 0x3f5d2c

Same type of issue if I try to rename anything on this platform (arm64). I have no issue with x86-64.

I attach the zipped binary.
libapp.so.zip

@satk0
Copy link
Owner

satk0 commented Jun 1, 2024

Ooh, thanks for submitting the issue. I checked afen only against x86-64. I will try to make it unique.

@satk0
Copy link
Owner

satk0 commented Jun 23, 2024

Allright, I fixed it, It works right now for any type of file. I've just incorrectly connected my parser to the rcore api.
You should launch my plugin like in a following matter:

r2 -e asm.parser=afen -e asm.pseudo=true <file>

Let me know if it works.

I am rn waiting to have my PR accepted so that the changes would take an affect.

Thanks for making the issue, let me know if there are more of them 😄

@satk0 satk0 closed this as completed Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants