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.
This commit is contained in:
Willy Tarreau 2019-08-08 16:53:40 +02:00
parent 32c24552e4
commit 9eebd8a978
3 changed files with 7 additions and 6 deletions

View File

@ -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)

View File

@ -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.

View File

@ -1,5 +1,6 @@
/*
* Function call tracing for gcc >= 2.95
* WARNING! THIS CODE IS NOT THREAD-SAFE!
*
* Copyright 2012 Willy Tarreau <w@1wt.eu>
*
@ -29,7 +30,7 @@
*
* where <dir> 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)
* <timestamp> <level> # <string>
*/
__attribute__((format(printf, 1, 2)))
void trace(char *fmt, ...)
void calltrace(char *fmt, ...)
{
va_list ap;