From 0d7a57a7bc14831d6d7076ccb0ea7a7213ddd7fb Mon Sep 17 00:00:00 2001 From: Dominik Kaiser <141638109+dpu-kaiser@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:03:28 +0200 Subject: [PATCH] Add debug tools * Add dbg() function and debug make rule * Add panic() debug function --- Makefile | 12 ++++++++++-- include/debug_tools.h | 24 ++++++++++++++++++++++++ include/minishell.h | 6 +++++- src/debug_tools.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 include/debug_tools.h create mode 100644 src/debug_tools.c diff --git a/Makefile b/Makefile index fb679ae..6fe15b6 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ LIBS = -L $(LIB_DIR)/libft -lft HEADERS = -I include -I $(LIB_DIR)/libft VPATH := src -SRC := main.c +SRC := main.c debug_tools.c OBJ_DIR := _obj OBJ := $(addprefix $(OBJ_DIR)/, $(SRC:%.c=%.o)) @@ -51,7 +51,15 @@ fclean: clean re: fclean all -.PHONY: all clean fclean re libs +debug: CFLAGS += -g +debug: CFLAGS += -fsanitize=address -fsanitize=undefined \ + -fno-sanitize-recover=all -fsanitize=float-divide-by-zero \ + -fsanitize=float-cast-overflow -fno-sanitize=null \ + -fno-sanitize=alignment +debug: CFLAGS += -DDEBUG=1 +debug: clean all + +.PHONY: all clean fclean re libs debug ################################################################################ ################################################################################ diff --git a/include/debug_tools.h b/include/debug_tools.h new file mode 100644 index 0000000..e831ecc --- /dev/null +++ b/include/debug_tools.h @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* debug_tools.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser