You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use PtPython with IPython inside the GDB integrated python console.
I wrote this GDB command to bring up a PtPython REPL within GDB:
ptpython_cmd.py
importsysimportgdbfromptpython.ipythonimportembedclassPtPythonCommand(gdb.Command):
def__init__(self) ->None:
super().__init__("ptpython", gdb.COMMAND_USER)
definvoke(self, arg: str, from_tty: bool):
self.dont_repeat()
ifnotfrom_tty:
raiseException("PtPython can only be launched from the TTY")
stdout=sys.stdoutstderr=sys.stderrstdin=sys.stdintry:
sys.stdout=sys.__stdout__sys.stderr=sys.__stderr__sys.stdin=sys.__stdin__embed()
exceptSystemExitase:
ife.code!=0:
print("ptpython exited with code", e.code)
finally:
sys.stdout=stdoutsys.stderr=stderrsys.stdin=stdinPtPythonCommand()
Run gdb -ex "source ptpython_cmd.py" -ex ptpython to load the script and launch the custom command.
The shell is very broken and it doesn't display the TUI. However, if I use the regular PtPython embed, it works great (replace the embed import with from ptpython import embed to reproduce that).
I suppose there could be something wrong with the IPython embed. I'm not aware of any differences in the GDB python interpreter vs regular Python, but I suspect they might be messing with the asyncio event loop. I haven't found proof of this, though.
The text was updated successfully, but these errors were encountered:
I'm trying to use PtPython with IPython inside the GDB integrated python console.
I wrote this GDB command to bring up a PtPython REPL within GDB:
ptpython_cmd.py
Run
gdb -ex "source ptpython_cmd.py" -ex ptpython
to load the script and launch the custom command.The shell is very broken and it doesn't display the TUI. However, if I use the regular PtPython embed, it works great (replace the
embed
import withfrom ptpython import embed
to reproduce that).I suppose there could be something wrong with the IPython embed. I'm not aware of any differences in the GDB python interpreter vs regular Python, but I suspect they might be messing with the
asyncio
event loop. I haven't found proof of this, though.The text was updated successfully, but these errors were encountered: