Gcc

GCC debugging

gcc -rdynamic -g -Wall -Wextra shell.c -o shell -lreadline
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <readline/readline.h>
#include <readline/history.h>

#include <execinfo.h>

#define MAX_N_PROGS 100

static void dump_trace() {
        void * buffer[255];
        const int calls = backtrace(buffer, sizeof(buffer) / sizeof(void *));
        backtrace_symbols_fd(buffer, calls, 1);
        exit(EXIT_FAILURE);
}