2

I have a Django project up and running. I'd like to provide a user to interactively use JDB through the web app to debug an application. I want that the user can issue a command such as

stop in [function name]
next

And that he would get the back the response and then can proceed.

When I use os.system however, like so:

def AttachDebugger(pid):
    # enable port forwarding
    adb = ADB()
    adb.set_adb_path('~/Library/Android/sdk/platform-tools/adb')
    adb.forward_socket('tcp:8001', 'jdwp:' + pid)
    # attaching
    os.system('jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8001')

then it opens up a JDB session in the background, but it freezes there and doesn't return control to the python code except stopping it via CTRL+C. Is there any way to provide such an interactive session?

What I would like to have is similar to the GITHUB-Tutorial-Page here: https://try.github.io/levels/1/challenges/1 where the user can interact with the JDB instance

Thanks in advance.

Phoebus
  • 311
  • 2
  • 17

1 Answers1

0

I got it done with the pexpect module.

Phoebus
  • 311
  • 2
  • 17