debugger icon indicating copy to clipboard operation
debugger copied to clipboard

Add support for LLDB scripts.

Open tur11ng opened this issue 3 years ago • 8 comments

When trying to run an LLDB script I get the following :

(LLDB) command script import ~/lldbinit.py
error: module importing failed: This script interpreter does not support importing modules.
(LLDB) script

In the first case it doesn't import the script while in the second it doesn't show the Python interpreter.

tur11ng avatar Jun 24 '22 15:06 tur11ng

Currently the lldb is built without python support. I will address this in a future release

xusheng6 avatar Jun 25 '22 03:06 xusheng6

Okay perfect, personally I don't find a reason on not having python support. I don't know if there is a deeper reason from your side.

tur11ng avatar Jun 25 '22 16:06 tur11ng

There is no deep reason on this. I just tried to compile LLDB with the most basic things initially to make it work. So I did not even think about Python at that time.

When I think about it now, I do see a potential problem is that BN already loads a python module. I am not sure whether the two can live with each other peacefully.

xusheng6 avatar Jun 27 '22 04:06 xusheng6

I will try to compile lldb with Python support to see if it works or what error it throws.

tur11ng avatar Jun 27 '22 16:06 tur11ng

I built lldb 14.0.6 from git with python support and it crashed when I tried to import a python script. I was able to build and replace all the files inside the plugins/lldb preexisting folder but for some reason I couldn't find the lldb-server executable so I used the one you provided.

tur11ng avatar Jun 27 '22 21:06 tur11ng

The lldb-server is not used for regular debugging right now. We will need it in the future when we do remote debugging.

For LLDB, we are building 14.0.0. Not sure if the difference is causing the crash. Also, since the debuggercore is linking with the LLDB API, there might be ABI compatibility issues as well.

You mentioned that it crashes when importing a python script. Does it work normally if you just do the debugging as usual?

xusheng6 avatar Jun 28 '22 02:06 xusheng6

Yes, if I remember correctly it works normally when you debug as usual

tur11ng avatar Aug 10 '22 14:08 tur11ng

Are there any plans for this issue? In particular, the LLDB APIs regarding allocating memory within the target process would be helpful for my research, and only seem reachable from the lldb script interface.

Thank you.

dinosaurlover38 avatar Aug 19 '25 17:08 dinosaurlover38