norm: remove print_backtrace

This commit is contained in:
Khaïs COLIN 2025-03-04 15:19:38 +01:00 committed by Khaïs COLIN
parent d30db395a0
commit f3a38fb430
3 changed files with 0 additions and 51 deletions

View file

@ -19,7 +19,6 @@ ifeq ($(CFLAGS),)
endif endif
export CFLAGS export CFLAGS
srcs = \ srcs = \
src/print_backtrace.c \
src/buffer/buffer.c \ src/buffer/buffer.c \
src/env/env.c \ src/env/env.c \
src/env/env_convert.c \ src/env/env_convert.c \

View file

@ -1,32 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_backtrace.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/03 11:56:35 by khais #+# #+# */
/* Updated: 2025/03/03 13:02:28 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#define _GNU_SOURCE // Important for dladdr
#include <stdio.h>
#include <stdlib.h>
#include <execinfo.h>
#include <dlfcn.h>
#include <string.h>
void print_backtrace() {
void* buffer[100];
int num_addresses = backtrace(buffer, 100);
Dl_info info;
printf("Backtrace:\n");
for (int i = 0; i < num_addresses; i++) {
if (dladdr(buffer[i], &info)) {
printf("\t%s (%s:%p)\n", info.dli_sname, info.dli_fname, buffer[i]);
} else {
printf("0x%p\n", buffer[i]);
}
}
}

View file

@ -1,18 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_backtrace.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/03 11:56:54 by khais #+# #+# */
/* Updated: 2025/03/03 12:15:50 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef BACKTRACE_H
#define BACKTRACE_H
void print_backtrace();
#endif // BACKTRACE_H