From: Willy Tarreau Date: Thu, 8 Aug 2019 14:53:40 +0000 (+0200) Subject: REORG: trace: rename trace.c to calltrace.c and mention it's not thread-safe X-Git-Tag: v2.1-dev2~197 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9eebd8a9782fb52a23b304d74e9e068a095caced;p=thirdparty%2Fhaproxy.git REORG: trace: rename trace.c to calltrace.c and mention it's not thread-safe The function call tracing code is a quite old and was never ported to support threads. It's not even sure whether it still works well, but at least its presence creates confusion for future work so let's rename it to calltrace.c and add a comment about its lack of thread-safety. --- diff --git a/Makefile b/Makefile index 419d3ea1e4..e19e5494fd 100644 --- a/Makefile +++ b/Makefile @@ -785,7 +785,7 @@ EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o $(EBTREE_DIR)/eb32sctree.o \ $(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o ifneq ($(TRACE),) -OBJS += src/trace.o +OBJS += src/calltrace.o endif ifneq ($(EXTRA_OBJS),) @@ -837,7 +837,7 @@ objsize: haproxy # rebuild it every time .PHONY: src/version.c -src/trace.o: src/trace.c $(DEP) +src/calltrace.o: src/calltrace.c $(DEP) $(cmd_CC) $(TRACE_COPTS) -c -o $@ $< src/haproxy.o: src/haproxy.c $(DEP) diff --git a/include/common/standard.h b/include/common/standard.h index ffebac8ee7..f0167d31aa 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -1275,9 +1275,9 @@ char *env_expand(char *in); */ void debug_hexdump(FILE *out, const char *pfx, const char *buf, unsigned int baseaddr, int len); -/* this is used to emit traces when building with TRACE=1 */ +/* this is used to emit call traces when building with TRACE=1 */ __attribute__((format(printf, 1, 2))) -void trace(char *fmt, ...); +void calltrace(char *fmt, ...); /* used from everywhere just to drain results we don't want to read and which * recent versions of gcc increasingly and annoyingly complain about. diff --git a/src/trace.c b/src/calltrace.c similarity index 98% rename from src/trace.c rename to src/calltrace.c index ab23a74eda..1a03709f4b 100644 --- a/src/trace.c +++ b/src/calltrace.c @@ -1,5 +1,6 @@ /* * Function call tracing for gcc >= 2.95 + * WARNING! THIS CODE IS NOT THREAD-SAFE! * * Copyright 2012 Willy Tarreau * @@ -29,7 +30,7 @@ * * where is '>' when entering a function and '<' when leaving. * - * It is also possible to emit comments using the trace() function which uses + * It is also possible to emit comments using the calltrace() function which uses * the printf() format. Such comments are then inserted by replacing the caller * pointer with a sharp ('#') like this : * @@ -257,7 +258,7 @@ void __cyg_profile_func_exit(void *to, void *from) * # */ __attribute__((format(printf, 1, 2))) -void trace(char *fmt, ...) +void calltrace(char *fmt, ...) { va_list ap;