pygdbmi icon indicating copy to clipboard operation
pygdbmi copied to clipboard

Interrupt GDB

Open c4deszes opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

#26 This method has since been removed.

#42 The resolution of this issue may not be applicable in every scenario and not all GDB targets support it, while my use case can be solved using -gdb-set target-async on I still feel there should be a method for interrupting execution that works on all platforms.

Describe the solution you'd like

A method that works consistently in all environments with most GDB implementations.

Also the GdbController constructor should have an argument that controls how the process is going to be started with regards to the child process' group.

Describe alternatives you've considered

Currently this line works, sort of:

self.gdbmi.gdb_process.send_signal(signal.CTRL_C_EVENT)

However the issue is that the Signal is also received by Python itself, which in my case causes Pytest to end abruptly in a KeyboardInterrupt exception.

This problem can be fixed by changing the signal handler, or the better way is to assign a new group to the child process, on Unix it's os.setgpid(pid, gid) and on Windows subprocess.Popen(command, ..., creationflags=subprocess.CREATE_NEW_PROCESS_GROUP).

Environment:

  • OS: Windows 10
  • pygdbmi version: 0.10.0.0

c4deszes avatar Aug 31 '20 13:08 c4deszes

If you would like to put together a PR I would be open to this change

cs01 avatar May 20 '21 05:05 cs01