gdb.execute('file a.out', to_string=True)


class MyBreakpoint(gdb.Breakpoint):

    def stop(self):
        gdb.write('MyBreakpoint\n')
return False
return True
MyBreakpoint('main')
gdb.execute('run')
Adding breakpoint command lists in GDB controlled from Python script