Search code examples
gdbpolling

Break from hanging poll with gdb


There is a process (I have the source) which stuck in an invalid state because its poll call waits for an invalid fd to become writable.

As this will never happen, the poll blocks forever.

Is it somehow possible to force this poll operation to quit?

Gdb is attached, and my desire is to see how would continue the app after the poll returns.

#0  0xb673e120 in poll () at ../sysdeps/unix/syscall-template.S:84

Is this something I can achieve without restarting the app?


Solution

  • Is it somehow possible to force this poll operation to quit?

    Yes, you can force current stack frame to return prematurely with return command. You can also choose any appropriate value as a function’s return value. See documentation here: https://sourceware.org/gdb/current/onlinedocs/gdb/Returning.html#Returning.