From 3c889ceed3b9a78da16ea2387f3b8029e25aa15b Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 14 Jun 2016 18:26:18 +0100 Subject: Memento: Add Memento_tick() Sometimes it can be useful to be able to run a program repeatedly and stop it at a given place, just before a problem occurs. Suppose you know that the problem occurs in the 'foo' function, but only after a number of runs. Insert a call to Memento_tick() at the top of foo, rebuild and run in the debugger. When the problem occurs, consult memento.sequence to see what event number we are on; suppose it's 1000. Then you can rerun the debugger with breakpoints on Memento_inited and Memento_breakpoint. When the program stops at Memento_inited, call Memento_breakAt(1000) and continue execution. The program will then stop in Memento_breakpoint within the Memento_tick call just before the problem occurs, enabling you to step forward and see what goes wrong. --- base/memento.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'base/memento.h') diff --git a/base/memento.h b/base/memento.h index 722c000ea..ec830b41f 100644 --- a/base/memento.h +++ b/base/memento.h @@ -214,6 +214,7 @@ void Memento_listNewBlocks(void); size_t Memento_setMax(size_t); void Memento_stats(void); void *Memento_label(void *, const char *); +void Memento_tick(void); void *Memento_malloc(size_t s); void *Memento_realloc(void *, size_t s); @@ -265,6 +266,7 @@ void *Memento_reference(void *blk); #define Memento_takeRef(A) (A) #define Memento_dropRef(A) (A) #define Memento_reference(A) (A) +#define Memento_tick() do {} while (0) #endif /* MEMENTO */ -- cgit v1.2.1