Force debug/trace mode to interupt after x seconds if I assume endless loop?

To find some error in a more or less complex predicate which loops endless I search for some way to force the debugger or tracer to interrupt the debugging after x seconds of debug or after some similar more general exit point. Is their some way to do that?

Hi,

If your looping predicate is static, you can use set_breakpoint/4 followed by set_breakpoint_condition/2 and set the break condition to something like:

start_time(Start),
timeout_seconds(Timeout),
get_time(Current),
Current > Start + Timeout

Where start_time/1 and timeout_seconds/1 are populated before calling the looping predicate.

1 Like