memleak: add backtrace to allocations.

We use the tal notifiers to attach a `backtrace` object on every
allocation.

This also means moving backtrace_state from log.c into lightningd.c, so
we can hand it to memleak_init().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-12-15 20:48:54 +10:30
committed by Christian Decker
parent c956d9f5eb
commit dfc132b2fe
8 changed files with 111 additions and 20 deletions

View File

@@ -48,7 +48,7 @@ void log_(struct log *log UNNEEDED, enum log_level level UNNEEDED, const char *f
void memleak_cleanup(void)
{ fprintf(stderr, "memleak_cleanup called!\n"); abort(); }
/* Generated stub for memleak_init */
void memleak_init(const tal_t *root UNNEEDED)
void memleak_init(const tal_t *root UNNEEDED, struct backtrace_state *bstate UNNEEDED)
{ fprintf(stderr, "memleak_init called!\n"); abort(); }
/* Generated stub for new_log */
struct log *new_log(const tal_t *ctx UNNEEDED, struct log_book *record UNNEEDED, const char *fmt UNNEEDED, ...)