Re: APP cannot be interrupted to gdb console by contrl+c, if APP enters into kernel mode via ioctl.

Paul Koning via Gdb
2021-02-02T13:47:18Z

> On Feb 2, 2021, at 7:13 AM, He Leon via Gdb <gdb@sourceware.org> wrote:
>
> Hi all,
>
> I meet an issue while debugging APP by gdb.
>
> I have a very simple APP and a very simple Kernel Mode Driver. APP accesses Kernel Mode Driver via IOCTL.
>
> When I debug APP in User Mode by gdb, I found if APP enters and stays inside IOCTL, the APP cannot be interrupted to gdb console by control+C.
>
> The issue is quite easy to be reproduced. I have reproduced it over different versions of kernel or gdb.
>
> Is there such limitation for: gdb doesn't work if APP enters and stays in kernel mode?

Of course, and that is true for every debugger. Debugger interrupt works by delivering a signal to the process. If the process is in a state where a signal can't be delivered to it (such as in a driver operation which you have coded not to be interruptable) then the signal remains pending until the blocking operation finishes.

You probably need to do some kernel mode debugging to fix your driver first.

paul