Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sudo apt-get -qq install --no-install-recommends --allow-unauthenticated -yy \
valgrind \
wget \
xsltproc \
systemtap-sdt-dev \
zlib1g-dev

echo "tester ALL=(root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/tester
Expand Down
25 changes: 24 additions & 1 deletion common/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,15 @@ static inline void trace_check_tree(void) {}
static void trace_init(void)
{
const char *dev_trace_file;
const char notleak_name[] = "struct span **NOTLEAK**";

if (active_spans)
return;

active_spans = notleak(tal_arrz(NULL, struct span, 1));
active_spans = tal_arrz(NULL, struct span, 1);
/* We're usually too early for memleak to be initialized, so mark
* this notleak manually! */
tal_set_name(active_spans, notleak_name);

current = NULL;
dev_trace_file = getenv("CLN_DEV_TRACE_FILE");
Expand Down Expand Up @@ -232,10 +237,28 @@ static struct span *trace_span_slot(void)

/* In the unlikely case this fails, double it */
if (!s) {
/* Adjust current and parents when we reallocate! */
size_t num_active = tal_count(active_spans);
size_t current_off COMPILER_WANTS_INIT("11.4.0-1ubuntu1~22.04 -03");
size_t parent_off[num_active];
if (current)
current_off = current - active_spans;
for (size_t i = 0; i < num_active; i++) {
if (!active_spans[i].parent)
continue;
parent_off[i] = active_spans[i].parent - active_spans;
}
TRACE_DBG("%u: out of %zu spans, doubling!\n",
getpid(), tal_count(active_spans));
tal_resizez(&active_spans, tal_count(active_spans) * 2);
s = trace_span_find(0);
if (current)
current = active_spans + current_off;
for (size_t i = 0; i < num_active; i++) {
if (!active_spans[i].parent)
continue;
active_spans[i].parent = active_spans + parent_off[i];
}
}
assert(s->parent == NULL);

Expand Down
3 changes: 0 additions & 3 deletions lightningd/test/run-find_my_abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@ void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
/* Generated stub for trace_span_end */
void trace_span_end(const void *key UNNEEDED)
{ fprintf(stderr, "trace_span_end called!\n"); abort(); }
/* Generated stub for trace_span_resume_ */
void trace_span_resume_(const void *key UNNEEDED, const char *lbl UNNEEDED)
{ fprintf(stderr, "trace_span_resume_ called!\n"); abort(); }
/* Generated stub for trace_span_start_ */
void trace_span_start_(const char *name UNNEEDED, const void *key UNNEEDED)
{ fprintf(stderr, "trace_span_start_ called!\n"); abort(); }
Expand Down
1 change: 1 addition & 0 deletions plugins/bkpr/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ BOOKKEEPER_TEST_COMMON_OBJS := \
common/key_derive.o \
common/memleak.o \
common/node_id.o \
common/pseudorand.o \
common/setup.o \
common/trace.o \
common/timeout.o \
Expand Down
3 changes: 0 additions & 3 deletions plugins/bkpr/test/run-bkpr_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,6 @@ bool param_check(struct command *cmd UNNEEDED,
const char *buffer UNNEEDED,
const jsmntok_t tokens[] UNNEEDED, ...)
{ fprintf(stderr, "param_check called!\n"); abort(); }
/* Generated stub for pseudorand_u64 */
uint64_t pseudorand_u64(void)
{ fprintf(stderr, "pseudorand_u64 called!\n"); abort(); }
/* Generated stub for toks_alloc */
jsmntok_t *toks_alloc(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "toks_alloc called!\n"); abort(); }
Expand Down
3 changes: 0 additions & 3 deletions plugins/bkpr/test/run-recorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ bool param_check(struct command *cmd UNNEEDED,
const char *buffer UNNEEDED,
const jsmntok_t tokens[] UNNEEDED, ...)
{ fprintf(stderr, "param_check called!\n"); abort(); }
/* Generated stub for pseudorand_u64 */
uint64_t pseudorand_u64(void)
{ fprintf(stderr, "pseudorand_u64 called!\n"); abort(); }
/* Generated stub for toks_alloc */
jsmntok_t *toks_alloc(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "toks_alloc called!\n"); abort(); }
Expand Down
Loading