I have created a python script which starts an python console "pythonstart.py" import sys import subprocess subprocess.call(['/usr/bin/python']) I am sourcing it from inside gdb gdb# source pythonstart.py It gives an python console. Problem: When I exit from python console, it returns to gdb, if I press "ENTER" again it again goes back to python console. I am not sure why its happening. Once I have quit the python console then why its coming back. There is another situation: After exit from python, if I don't press "ENTER" on gdb but execute any command and then press "ENTER", problem does not appear. (gdb) (gdb) source pythonstart.py Python 2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>> exit() (gdb) <---- Pressing Enter here Python 2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> I want to stop this from falling back to python console after pressing enter key. Please help. Continue reading...