Using a makefile, it's something like:
Code: Select all
# enalbe GDB on for debugging
GDB = -g -O0
all: spaceshuttle.c
gcc $(GDB) -Wall -o spaceshuttle.exe functions.c encryptionlib.c -lspacelib -lpthread
clean:
$(RM) spaceshuttle.exe
Next, use gdb to get a stack trace:
bash$ gdb spaceshuttle.exe
gdb> run arguments
(cc1 will stop at the segmentation fault)
gdb> where
gdb> list