Thanks for the debugging information. I followed your instructions and came up with similar errors when running:
valgrind pd rvbap-help.pd
ie.
==4000== Invalid write of size 4 ==4000== at 0x4034D0F: rvbap_bang (rvbap.c:619) ==4000== by 0x80B7362: outlet_bang (in /usr/bin/pd) ==4000== Address 0x49df6ec is 4 bytes before a block of size 16 alloc'd ==4000== at 0x4025315: calloc (vg_replace_malloc.c:467) ==4000== by 0x80B8710: getbytes (in /usr/bin/pd) ==4000==
this corresponds to the following block of code and the last statement in this "final_gs[ls[i]-1]=g[i];", is line 619 cited above.
static void rvbap_bang(t_rvbap *x)
// top level, vbap gains are calculated and outputted
{
t_atom at[MAX_LS_AMOUNT];
float g[3];
long ls[3];
long i;
float *final_gs, overdist, oversqrtdist;
final_gs = (float *) getbytes(x->x_ls_amount * sizeof(float));
if(x->x_lsset_available ==1){
vbap(g, ls, x);
for(i=0;i<x->x_ls_amount;i++)
final_gs[i]=0.0;
for(i=0;i<x->x_dimension;i++){
final_gs[ls[i]-1]=g[i];
}
.........
My C programming is very rusty to say the least and I've not been able to fix it.
If it's obvious to anyone else - please let me know.
Best,
Iain
On Wed, 2011-10-05 at 21:13 -0400, Mathieu Bouchard wrote:
Le 2011-10-05 à 14:59:00, Iain Mott a écrit :
I'm having problems already cited elsewhere with rvbap - whereby it crashes with a "Signal 6" when adjusting the azimuth and having first configured the external with a 2D speaker array (eg. with a message: "define_loudspeakers 2 -45 45 0 180"). I've tried this with pdextended on linux (i'm using ubuntu 11.04) and also by compiling the external with this source: http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/externals/vbap/ Same thing. Does anyone have any suggestions?
When you compile the external from source, you have the possibility to enable debug. I edited Makefile (with an uppercase) to change that, but debugging info was already enabled (-g). I changed the optimisation flags though (-O1 instead of -O6 -fomit-frame-pointer).
btw, the use of those flags is misleading, as -O6 is completely the same as -O3, and -fomit-frame-pointer (which hinders debugging) is already included in -O2 and -O3 (in -O1 it depends, see manpage).
-funroll-loops, however, has no impact on debuggability...
Then if you run :
valgrind pd vbap-help.pd
and click around a bit, you get :
==10071== Invalid read of size 4 ==10071== at 0x4F42667: additive_vbap (vbap.c:419) ==10071== by 0x4F43527: vbap_bang (vbap.c:526) ==10071== by 0x4F45217: choose_ls_tuplets (define_loudspeakers.c:757) ==10071== by 0x4F45664: vbap_def_ls (define_loudspeakers.c:62) ==10071== by 0x80C7498: pd_typedmess (m_class.c:716) ==10071== by 0x3FFFFFFF: ??? ==10071== Address 0x43886bc is 4 bytes before a block of size 16 alloc'd ==10071== at 0x4024F12: calloc (vg_replace_malloc.c:467) ==10071== by 0x80CB2BC: getbytes (m_memory.c:24) ==10071== by 0x4F45217: choose_ls_tuplets (define_loudspeakers.c:757) ==10071== by 0x4F45664: vbap_def_ls (define_loudspeakers.c:62) ==10071== by 0x80C7498: pd_typedmess (m_class.c:716) ==10071== by 0x3FFFFFFF: ???
which is a lot more informative when it can report function names, rather than just the library names...
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC