Information on seeing source info of Numba jit code in radare2.
@njit(debug=True)
def foo():
...
# Trigger compilation
foo()
# Get CodeLibrary
ov = foo.overloads[foo.signatures[0]]
lib = ov.library
# Write out the compiled object file
with open("out.o", 'wb') as fout:
fout.write(lib._get_compiled_object())The following instructions work on radare2 5.3.
It's easiest to a recent radare2 prebuilt binary from a recent centos docker image
and just yum install radare2.
For some unknown reason, radare2 cannot read the object file directly. We need to make a shared object first:
$ gcc -g -O0 -shared -o out.so out.oThen, we can invoke radare2 on the out.so:
$ radare2 -e io.cache=true -e asm.dwarf=true out.soRadare2 commands needed:
aaaaa- enables some analysisv- visual modeV- graph mode