Hi Frank,
glad to have you here. Allocating the buffer itself should not give you a segmentation fault, however if the allocation fails, then a segfault will happen as soon as you try to access the memory. Can you check that all the all the *alloc()
calls return a non-null pointer? Or use mallopt(3)
to debug failed calls. A failed C++ allocation (e.g.: new ...
) should return an exception. One problem you may have is if you are trying to store large objects on the stack: Xenomai does not allow the stack to grow automatically. Stack size is currently pre-set to 2MB for the audio thread (defined in core/RTAudioCommandLine.cpp
).
You can also try to run the compiled program inside gdb
(the executable file will be located at /root/Bela/projects/projectname/projectname
). By default, debugging symbols are disabled when building, but you can clean your project and then compile passing CPPFLAGS=-g -Og
and CFLAGS=-g -Og
to make
. From the terminal:
cd ~/Bela
make projectclean PROJECT=projectname
make PROJECT=projectname CPPFLAGS="-g -Og" CFLAGS="-g -Og"
gdb /root/Bela/projectname/projectname
if it turns out that the segfault takes place in the core code, you will have to rebuild that, too with debug symbols:
make coreclean
make PROJECT=projectname CPPFLAGS="-g -Og" CFLAGS="-g -Og"