I want to use python to create some interactive script for gdb. It works well in gdb, but it doesn't work if I invoke gdb from emacs.
For example, the python script (test.py) is like below. It simply print what it gets.
def testInput():
n = raw_input('(gdb) ')
print n
It works in gdb:
% gdb
GNU gdb (GDB) 7.2.50.20110217
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) source test.py
(gdb) python testInput()
(gdb) 1
1
(gdb) q
But in emacs, it will just hang in "raw_input" and could never get the input:
(gdb) source test.py
(gdb) python testInput()
(gdb) 1
2
...
Is there anyway to make it work just as in gdb?