I’ve been starting to develop some plugins and I’m wondering what other folks do for debugging. Since I’m simultaneously learning C/C++ and the SC API, it would be very useful to have more info from the server when it crashes. My plugin sometimes crashes and it’s not always clear why.
I figure I can use
perf if I have to but I wonder if there’s some in-build SC functionality I can harness. Maybe some option when compiling from source?
cmake .. -DCMAKE_BUILD_TYPE=Debug or
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo (the default), and run scsynth in a debugger.
// in SC, get the scsynth options
-> -u 57110 -a 1024 -i 2 -o 2 -m 131072 -R 0 -l 1
// Linux, using gdb (in the terminal, not in SC):
$ gdb --args scsynth -u 57110 -a 1024 -i 2 -o 2 -m 131072 -R 0 -l 1
..... blah blah
..... blah blah
SuperCollider 3 server ready.
// back in SC:
Requested notification messages from server 'localhost'
localhost: server process's maxLogins (1) matches with my options.
localhost: keeping clientID (0) as confirmed by server process.
… and you’re running. Do something crashy and you can poke around in gdb.
Since we’re on the topic, I often get a SIGSEGV when trying to assign a buffer to a variable after getting it with the innards of
float* data = unit->m_buf->data;
I’m doing this in the constructor; is one not supposed to get the contents of a buffer in the constructor? I only need the contents of the buffer once and would like to avoid retrieving the same information on each
[EDIT: Solved. I was getting the bufnum incorrectly.]