longld / peda

PEDA - Python Exploit Development Assistance for GDB
Other
5.84k stars 801 forks source link

Ctrl+c not working with remote targets #132

Open jcorina opened 5 years ago

jcorina commented 5 years ago

When trying to send a SIGINT via Ctrl+c, nothing happens. If I end the program being debugged I get the following:

gdb-peda$ c
Continuing.
^C^C

^C
[Inferior 1 (process 17834) exited normally]
Python Exception <type 'exceptions.KeyboardInterrupt'> : 
Error while running hook_stop:
Could not convert arguments to Python string.

If I disable peda it works as expected. It also works fine in peda if the target is local. GDB version is 8.2.1, though it was also happening on 8.1.0.

Byzero512 commented 5 years ago

this just happend in gdb 8.2

Byzero512 commented 5 years ago

When trying to send a SIGINT via Ctrl+c, nothing happens. If I end the program being debugged I get the following:

gdb-peda$ c
Continuing.
^C^C

^C
[Inferior 1 (process 17834) exited normally]
Python Exception <type 'exceptions.KeyboardInterrupt'> : 
Error while running hook_stop:
Could not convert arguments to Python string.

If I disable peda it works as expected. It also works fine in peda if the target is local. GDB version is 8.2.1, though it was also happening on 8.1.0.

you can comment the code between line-6112 to line-6118 in peda.py. (but i don't confirm what effect will caused by this change)

Byzero512 commented 5 years ago

or change the code between line-6112 and line-6118 to

#handle SIGINT / Ctrl-C
def sigint_handler(event):
    # warning_msg("Got Ctrl+C / SIGINT!")
    gdb.execute("set logging off")
    peda.restore_user_command("all")
#     raise KeyboardInterrupt
# signal.signal(signal.SIGINT, sigint_handler)
gdb.events.stop.connect(sigint_handler)