0

I have a requirement to run a 'C'-module in gdb but this gdb should be involked by python script.

Sagar Gupta M.
  • 327
  • 1
  • 3
  • 5

2 Answers2

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

Community
  • 1
  • 1
rubik
  • 8,230
  • 7
  • 58
  • 87
0

Hacky solution as always: os.system.

os.system("gdb arg1 arg2 etc")

orlp
  • 106,415
  • 33
  • 201
  • 300