I have a requirement to run a 'C'-module in gdb but this gdb should be involked by python script.
Asked
Active
Viewed 929 times
0
-
the `subprocess` module, which according to [http://www.python.org/dev/peps/pep-0324/] is to replace the os.system call (among other things) – Jan 13 '11 at 12:57
-
W_P are there any existing commands in gdb enabled python. – Sagar Gupta M. Jan 18 '11 at 11:40
2 Answers
2
I think the best way to do this is to use subprocess:
subprocess.Popen(['gdb', 'arg1', 'arg2', 'etc'])
If you are using Python 2.x and you only want to record the output, you can use commands, but it is deprecated since 2.6.
You might want to check Invoke and control GDB from Python
-
-
-
-
Are you familear with this python enaled with gdb. If so how to import gdb in python. – Sagar Gupta M. Jan 18 '11 at 11:41
-
0
-
-
2the `subprocess` module makes this inappropriate for the majority of use cases. – Jan 13 '11 at 12:58