summaryrefslogtreecommitdiff
path: root/base/memento.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-06-14 18:26:18 +0100
committerRobin Watts <robin.watts@artifex.com>2016-06-14 18:30:13 +0100
commit3c889ceed3b9a78da16ea2387f3b8029e25aa15b (patch)
tree1521fe438bba73454e32f732b74801732621eaf9 /base/memento.h
parent3bc51652cc962f0256acdf37f52d0a7d98b20ed1 (diff)
downloadghostpdl-3c889ceed3b9a78da16ea2387f3b8029e25aa15b.tar.gz
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.
Diffstat (limited to 'base/memento.h')
-rw-r--r--base/memento.h2
1 files changed, 2 insertions, 0 deletions
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 */