Debugging a .so file, compiled by cython

283 Views Asked by At

I have a .so file that has some functions in it (about inferencing model of deep learning) The .pyx file accidently got deleted during compile. I imported it in my python code regularly. I want to debug it with any tools possible even x64 Ida etc. I cannot access the .pyx or .pi nor any other meta file when compiled it anymore. Any kind of help would be appreciated.

As far as I know, the .so file is non managed C like code I want to debug it with x64 or Ida-pro (if it is possible with pdb or any high-level debugger). I've already tried to debug it with pdb and gdb without any success.

my code shown in below for trying pdb debugging:

import pdb
pdb.set_trace()

import sys
from pathlib import Path
sys.path.append(Path(__file__) / 'deepspeech.pytorch')

import inference_core
print(inference_core)

when I run it set_trace() stop the program for debugging. when I step into inference_core The information it gives me is just some frozen importlib with numbers:

(Pdb) next
next
> /opt/cpInfrenece/cpInference.py(5)<module>()
-> sys.path.append(Path(__file__) / 'deepspeech.pytorch')
(Pdb) next
next
> /opt/cpInfrenece/cpInference.py(7)<module>()
-> import inference_core
(Pdb) step
step
--Call--
   > <frozen importlib._bootstrap>(966)_find_and_load()
(Pdb) step
step
   > <frozen importlib._bootstrap>(968)_find_and_load()
(Pdb) step
step
   --Call--
   > <frozen importlib._bootstrap>(143)__init__()
(Pdb) 

I actually didn't surprised because of .so file's nature. after failing on this I'm trying to make my python file an exe file with PyInstaller. maybe it work's well with x64dbg or Ida. in the meantime any other kind of help would be appreciated.

0

There are 0 best solutions below