I have installed GDB on Mac OS X and to test that it works I have used this following C program.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int *my_array = (int *) malloc(5 * sizeof(int));
int i;
for (i = 0; i < 1000000; i++) {
my_array[i] = i;
}
free(my_array);
return 0;
}
I have an error when compiling it, which is normal (segmentation fault)
However, when adding the -g flag in the compiling command and running gdb on my compiled program, I have this message after launching the command run
During startup program terminated with signal ?, Unknown signal.
Really don't know where it comes from. I have added a certificate to ensure that gdb works correctly on OS X but I have found nothing to fix this issue.
Best Answer
From this answer: https://stackoverflow.com/a/40437725/1060955
Sources
https://stackoverflow.com/a/40437725/1060955
https://discussions.apple.com/thread/7684629?start=0&tstart=0
Where is .gdbinit is located and how can I edit it?
https://sourceware.org/gdb/onlinedocs/gdb/Starting.html