I want to debug a process with gdb into Linux system, but the problem is that process pings /dev/watchdog
so when I tried to debug it, it stop the process for longer than the watchdog interval so the system is rebooting.
One solution is to patch the binary so it will not use /dev/watchdog
and than reboot the system so the "new" binary will run.
But sometime I can't do this solution because I don't want to reboot the system. And I don't control on system's startup script(that activate the watchdog)
Is there another solution?
/dev/watchdog
. Suppose it'sopen
for a second. In this case you could overwrite it and open your own "whatever" (return some magic number) and overwriteread
/write
as appropriate. The - by far - simplest solution would be to useLD_PRELOAD
and provide your own mock versions of those functions. Depends...LD_PRELOAD
(ab)uses the fact that symbols defined by a shared object take precedence by load order. And therefore if you preload a particular custom shared object you can hook functions used by a binary or (other) shared object./dev/watchdog
would be an issue it won't inside a namespace or without the capability to reboot the system. Either way, if you don't control the startup script (of what .../etc/rc
?) what do you control?