Record replay file conditionally in c program and reply it later

Andy Fan zhihui.fan1213@gmail.com
Sun Nov 28 13:54:40 GMT 2021


Hi:

Suppose we have code like this:

int res = a_very_complex_func();
assert(res > 0);   -- crashed.

And the above case is not easy to reproduce.  so I want to record and reply
to the situation later.

int res = a_very_complex_func();

if (res <= 0)
{
   record_gdb_file_start('/tmp/assert_gt_0');
   a_very_complex_func();  -- rerun this function.
   record_gdb_file_stop();
   Assert(res > 0) -- let is crash
}

Later, I can use gdb with /tmp/assert_gt_0 file to replay the workload.  Is
it something we can do now?

Thanks!

-- 
Best Regards
Andy Fan


More information about the Gdb mailing list