Closed vancaho closed 5 years ago
Hi @vancaho , you can try by adding the following two lines at the point where you want to stop your script:
import pdb
pdb.set_trace()
That will open a python debugger.
Another option, if what you need is to run pyrebox commands, is to add the following two lines:
from ipython_shell import start_shell
start_shell()
This second alternative will spawn an ipython shell in an environment where you can read guest memory and registers, execute pyrebox commands, or to use any of the python API functions exported by pyrebox.
Hope this helps,
Xabier.
Can I use a IDE e.g. PyCharm to debug it?
I never did it, but did you try this? https://blog.jetbrains.com/pycharm/2015/02/feature-spotlight-python-debugger-and-attach-to-process/
After some work on Pycharm, I can debug the scripts with pycharm. From the [Run] menu, choose the [Edit configuration], then click "+" button and choose 'python remote debug'. From the dialog box, we can see instructions for remote debugging. Follow the instructions in the dialog, then we can debug the scripts. We can refer the following url https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html
Hi,
I'm glad you found the solution!
Hi, I want to write a script for pyrebox. Because the function is a little complex, so I want to debug it when special activity happens in the guest machine. Is there a way to break the execution of the script and then retrive some values of the variables? Thanks very much.