How can i invoke gdb using python to run a module [closed]
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this questionI have a requirement to run a 'C开发者_开发技巧'-module in gdb but this gdb should be involked by python script.
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
Hacky solution as always: os.system.
os.system("gdb arg1 arg2 etc")
精彩评论