Record replay file conditionally in c program and reply it later

Andy Fan via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAKU4AWrjD_TjFkDPUYZH32o-WjTPy+qV05=f3gW7Uo5xfgVhcA@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.