Most WDT's usually have a method to restart , so you just issue restarts at convenient places in your code.
Are you sure the WDT will trigger if your code fails now? Not sure how you would test this, without modify code
with HANG [ branch on self]
struct rst_info* reset_info;
reset_info = system_get_rst_info();
os_printf("Boot-Cause: %d\n", reset_info->reason);
where reason is a ENUM you can find in the SDKs documentation:
enum rst_reason {
REANSON_DEFAULT_RST = 0,
REANSON_WDT_RST = 1,
REANSON_EXCEPTION_RST = 2,
REANSON_SOFT_WDT_RST = 3,
REANSON_SOFT_RESTART = 4,
REANSON_DEEP_SLEEP_AWAKE = 5,
REANSON_EXT_SYS_RST = 6,
};
So I called the above in user_init and I got an output 1 which is a REANSON_WDT_RST. So I assume the watchdog triggered the reset. Also I found some threads on the ESP Arduino forum describing compareable poblems using global static or volatile variables instead of passing the data by reference or value to the specific callback.