public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Record replay file conditionally in c program and reply it later
@ 2021-11-28 13:54 Andy Fan
  0 siblings, 0 replies; only message in thread
From: Andy Fan @ 2021-11-28 13:54 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-28 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-28 13:54 Record replay file conditionally in c program and reply it later Andy Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).