Invoke and control GDB from Python

后端 未结 2 1999
清酒与你
清酒与你 2020-12-01 06:26

I am running a Python GUI application. I want to invoke and control GDB from it, like load an executable file, set breakpoints etc. I see that GDB has a command line interfa

相关标签:
2条回答
  • 2020-12-01 07:19

    Yes, you can control GDB from Python. The Python documentation is at http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html#Python.

    If you want an example of some scripting, take a look at http://tromey.com/blog/?p=548

    0 讨论(0)
  • 2020-12-01 07:21

    pygdbmi is what you want.

    With it I was able to reset an embedded target from Python using the following:

    from pygdbmi.gdbcontroller import GdbController
    if __name__ == '__main__':
        gdbmi = GdbController()
        response = gdbmi.write('b main')
        response = gdbmi.write('target remote localhost:2331')
        response = gdbmi.write('mon reset 0')
        response = gdbmi.write('c')
    

    gdbgui provides a much cooler example.

    0 讨论(0)
提交回复
热议问题