DDEBUG
This commit is contained in:
parent
8e5f90436a
commit
7b1951bf85
4
Makefile
4
Makefile
@ -6,7 +6,7 @@
|
||||
# By: qmennen <qmennen@student.codam.nl> +#+ #
|
||||
# +#+ #
|
||||
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
|
||||
# Updated: 2025/02/23 13:34:57 by willem ######## odam.nl #
|
||||
# Updated: 2025/02/25 18:15:50 by whaffman ######## odam.nl #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -38,7 +38,7 @@ endif
|
||||
BUILD_CONFIGS = release debug asan tsan
|
||||
|
||||
release_CFLAGS = -Wall -Werror -Werror -O2
|
||||
debug_CFLAGS = -Wall -Werror -Werror -g3
|
||||
debug_CFLAGS = -Wall -Werror -Werror -g3 -DDEBUG
|
||||
asan_CFLAGS = -Wall -Werror -Werror -fsanitize=address,leak,undefined -g3
|
||||
tsan_CFLAGS = -Wall -Werror -Werror -fsanitize=thread -g3
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ A lot of amazing shell stuff
|
||||
|
||||
## TODO
|
||||
- [x] Find absolute path for command input ('/', './', 'cmd')
|
||||
- Add heredoc to tokenizer
|
||||
- [x]Add heredoc to tokenizer
|
||||
- [x] Environment to `t_list`
|
||||
- [x] Get environment array (export)
|
||||
- [x] Set environment variable (export)
|
||||
|
||||
@ -45,6 +45,12 @@
|
||||
# define PROMPT RESET "🐚" GREEN "minishell" RESET ": "
|
||||
# define PROMPT_LEN 51
|
||||
|
||||
# ifdef DEBUG
|
||||
# define DEBUG 1
|
||||
# else
|
||||
# define DEBUG 0
|
||||
# endif // DEBUG
|
||||
|
||||
void token_print(void *param);
|
||||
|
||||
#endif
|
||||
|
||||
@ -17,6 +17,8 @@ void print_commands(void *param)
|
||||
t_command *command;
|
||||
int i;
|
||||
|
||||
if (!DEBUG)
|
||||
return ;
|
||||
command = (t_command *)param;
|
||||
if (!command)
|
||||
return ;
|
||||
@ -46,6 +48,8 @@ void token_print(void *param)
|
||||
{
|
||||
t_token *token;
|
||||
|
||||
if (!DEBUG)
|
||||
return ;
|
||||
token = (t_token *)param;
|
||||
printf("token type %i, value %s\n", token->type, token->value);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/02/25 15:46:03 by whaffman #+# #+# */
|
||||
/* Updated: 2025/02/25 15:55:41 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/02/25 18:17:13 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,6 +17,8 @@ void print_freelist(t_minishell *minishell)
|
||||
t_list *freelist;
|
||||
int i;
|
||||
|
||||
if (!DEBUG)
|
||||
return ;
|
||||
i = 0;
|
||||
freelist = minishell->freelist;
|
||||
while (freelist)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/02/25 15:09:34 by whaffman #+# #+# */
|
||||
/* Updated: 2025/02/25 17:35:39 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/02/25 18:06:06 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,26 +16,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Obtain a backtrace and print it to stdout. */
|
||||
void
|
||||
print_trace (void)
|
||||
{
|
||||
void *array[10];
|
||||
char **strings;
|
||||
int size, i;
|
||||
|
||||
size = backtrace (array, 10);
|
||||
strings = backtrace_symbols (array, size);
|
||||
if (strings != NULL)
|
||||
{
|
||||
|
||||
printf ("Obtained %d stack frames.\n", size);
|
||||
for (i = 0; i < size; i++)
|
||||
fprintf (stderr, "%s\n", strings[i]);
|
||||
}
|
||||
|
||||
free (strings);
|
||||
}
|
||||
|
||||
void free_safe(t_minishell *minishell, void **ptr)
|
||||
{
|
||||
@ -62,7 +42,6 @@ void free_safe(t_minishell *minishell, void **ptr)
|
||||
current = current->next;
|
||||
}
|
||||
error_msg("free_safe", "pointer not found in freelist");
|
||||
// print_trace();
|
||||
}
|
||||
*ptr = NULL;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user