linuxgdbfutex

gdb wont break on "futex"


I'm running strace on my process to monitor performance and I see a lot of calls like so:

futex(0x3d89d68, FUTEX_WAKE_PRIVATE, 1) = 0
...

I'm trying to catch where this call is being done in gdb ( just like I do for other system calls ). However when I try to break on futex gdb doesnt recognize the symbol:

(gdb) b futex
Function "futex" not defined.
Make breakpoint pending on future shared library load? (y or [n])

Is there some special way to break on futex calls?


Solution

  • According to the futex syscall manual page:

    glibc provides no wrapper for futex()

    So instead of break, you’ll need to use the GDB command catch syscall futex to suspend the program when it starts that syscall.