Zur Fehlersuche kannst du "-g" zu deinen CFLAGS hinzufügen und das Programm mit valgrind starten:
Code: Alles auswählen
$ valgrind ./ipc 2 executables/executable1
==7021== Memcheck, a memory error detector
==7021== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7021== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==7021== Command: ./ipc 2 executables/executable1
==7021==
Es werden 2 Prozesse gestartet!
memcpy for msgs[0]
memcpy for msgs[1]
memcpy for msgs[2]
memcpy for msgs[3]
memcpy for msgs[4]
memcpy for msgs[5]
memcpy for msgs[6]
memcpy for msgs[7]
memcpy for msgs[8]
memcpy for msgs[9]
memcpy for msgs[10]
memcpy for msgs[11]
memcpy for msgs[12]
memcpy for msgs[13]
memcpy for msgs[14]
memcpy for msgs[15]
memcpy for msgs[16]
memcpy for msgs[17]
memcpy for msgs[18]
memcpy for msgs[19]
memcpy for msgs[20]
memcpy for msgs[21]
memcpy for msgs[22]
memcpy for msgs[23]
memcpy for msgs[24]
memcpy for msgs[25]
memcpy for msgs[26]
memcpy for msgs[27]
memcpy for msgs[28]
==7021== Invalid write of size 8
==7021== at 0x4C319B3: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7021== by 0x4013A6: ipc_init (Starter.c:126)
==7021== by 0x4015DC: main (Starter.c:178)
==7021== Address 0x4026000 is not stack'd, malloc'd or (recently) free'd
==7021==
==7021==
==7021== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==7021== Access not within mapped region at address 0x4026000
==7021== at 0x4C319B3: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7021== by 0x4013A6: ipc_init (Starter.c:126)
==7021== by 0x4015DC: main (Starter.c:178)
==7021== If you believe this happened as a result of a stack
==7021== overflow in your program's main thread (unlikely but
==7021== possible), you can try to increase the size of the
==7021== main thread stack using the --main-stacksize= flag.
==7021== The main thread stack size used in this run was 8388608.
==7021==
==7021== HEAP SUMMARY:
==7021== in use at exit: 0 bytes in 0 blocks
==7021== total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==7021==
==7021== All heap blocks were freed -- no leaks are possible
==7021==
==7021== For counts of detected and suppressed errors, rerun with: -v
==7021== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1] 7021 segmentation fault (core dumped) valgrind ./ipc 2 executables/executable1
