wargio / r2dec-js

radare2 plugin - converts asm to pseudo-C code.
511 stars 48 forks source link

[arm64] #267

Closed RomanSilinenko closed 2 years ago

RomanSilinenko commented 2 years ago

Describe the bug r2 crashes when trying to launch r2dec decompiler.

Component

Reproduce via JSON (pddi)

$ r2pm -i r2dec
Already up to date.
Install Done For r2dec
make: Entering directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make build
make[1]: Entering directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make[1]: Nothing to be done for 'build'.
make[1]: Leaving directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make: Leaving directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make: Entering directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make[1]: Entering directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make[1]: Leaving directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
make: Leaving directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p'
ubuntu@pihole:~/.local/share/radare2/r2pm/git/r2dec
$ r2 -A /tmp/tryharder.org 
[x] Analyze all flags starting with sym. and entry0 (aa)
[x] Analyze function calls (aac)
[x] Analyze len bytes of instructions for references (aar)
[x] Check for objc references
[x] Check for vtables
[x] Type matching analysis for all functions (aaft)
[x] Propagate noreturn information
[x] Use -AA or aaaa to perform additional experimental analysis.
[0x004012b0]> pddi 
r2: symbol lookup error: /home/ubuntu/.local/share/radare2/plugins/core_pdd.so: undefined symbol: r2dec_jsc
ubuntu@pihole:~/.local/share/radare2/r2pm/git/r2dec
$ 
trufae commented 2 years ago

try r2pm -ci to ensure a clean rebuild

RomanSilinenko commented 2 years ago

Still something wrong. Sorry, cant figure out what exactly.

$ r2pm -ci r2dec Cleaning r2dec... Already up to date. clean Done For r2dec /home/ubuntu/.local/share/radare2/r2pm/db/r2dec TGZ= Cleaning up /home/ubuntu/.local/share/radare2/r2pm/git//r2dec... sh: 0: getcwd() failed: No such file or directory Cloning into 'r2dec'... remote: Enumerating objects: 115, done. remote: Counting objects: 100% (115/115), done. remote: Compressing objects: 100% (110/110), done. remote: Total 115 (delta 20), reused 36 (delta 2), pack-reused 0 Receiving objects: 100% (115/115), 1.07 MiB | 169.00 KiB/s, done. Resolving deltas: 100% (20/20), done. Install Done For r2dec make: Entering directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p' awk '{if(/@JSC_SOURCES@/)exit;print}' < r2dec_jsc.c.in > r2dec_jsc.c python make_jsc.py .. >> r2dec_jsc.c /bin/sh: 1: python: not found make: *** [Makefile:53: r2dec_jsc.c] Error 127 make: Leaving directory '/home/ubuntu/.local/share/radare2/r2pm/git/r2dec/p' ubuntu@pihole:~/.local/share/radare2/r2pm/git/r2dec/p $ python --version Python 3.8.10

trufae commented 2 years ago

Where's your python installed that r2pm loses its path? The version looks good

RomanSilinenko commented 2 years ago

OK. Indeed it was due to python. I did alias, but seems somewhere in scripts there's the absolute path to /usr/bin/python. So i have to create a link file.

trufae commented 2 years ago

@wargio i think p/Makefile should use PYTHON?=python instead of directly calling python to let the users and package manager to override the path without patching

wargio commented 2 years ago

it does. https://github.com/wargio/r2dec-js/blob/master/p/Makefile#L53