Development Topics > Plugin Development

Vector problems?

(1/1)

dhbenson:
Hi there,

I'm trying write a Vamp plugin and I'm running into a strange problem. 

My plugin needs to store audio samples from one processing call to the next, so I want to include a vector of floats as a class member.

I've followed the tutorial, have installed the sdk, and can compile the example (MyPlugin) without any problems.

Things go wrong when I declare a vector in the protected: section of the header file.

>>

--- Code: ---protected:
std::vector<float> test;
};
--- End code ---
>>


When I add this single line, the plugin still compiles, but then generates a bunch of errors culminating in a segmentation fault when I run the plugin tester.   Console output and the error log and pasted below.

I'm on mac os 10.6.6.

Do you have any idea what the problem might be? 

I'm new to C++, so if this is a simple syntax error, please accept my apologies for asking about it here. 

Thanks so much for you help,


Dave

>>
Error log:
>>
--- Quote ---Process:         vamp-plugin-tester [3367]
Path:            /Users/davebenson/tutorial/vamp-plugin-tester
Identifier:      vamp-plugin-tester
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [409]

Date/Time:       2011-01-25 23:37:25.450 -0500
OS Version:      Mac OS X 10.6.6 (10J567)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000fffffffc
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libstdc++.6.dylib                0x9848ed85 std::string::_Rep::_M_dispose(std::allocator<char> const&) + 31
1   libstdc++.6.dylib                0x9848f5c1 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() + 29
2   vamp-plugin-tester               0x0001a197 __gnu_cxx::new_allocator<std::string>::destroy(std::string*) + 17 (new_allocator.h:107)
3   vamp-plugin-tester               0x0001a1b4 void std::_Destroy<std::string*, std::allocator<std::string> >(std::string*, std::string*, std::allocator<std::string>) + 26 (stl_construct.h:173)
4   vamp-plugin-tester               0x0001a3ec std::vector<std::string, std::allocator<std::string> >::~vector() + 58 (stl_vector.h:273)
5   vamp-plugin-tester               0x000034f2 main + 1930 (vamp-plugin-tester.cpp:156)
6   vamp-plugin-tester               0x0000261a _start + 216
7   vamp-plugin-tester               0x00002541 start + 41

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0xffffffff  ebx: 0x9848ed6f  ecx: 0xfffffff4  edx: 0xfffffffc
  edi: 0x00000001  esi: 0x00000006  ebp: 0xbffff808  esp: 0xbffff804
   ss: 0x0000001f  efl: 0x00010293  eip: 0x9848ed85   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0xfffffffc

Binary Images:
    0x1000 -    0x34fff +vamp-plugin-tester ??? (???) /Users/davebenson/tutorial/vamp-plugin-tester
0x8fe00000 - 0x8fe4162b  dyld 132.1 (???) <A4F6ADCC-6448-37B4-ED6C-ABB2CD06F448> /usr/lib/dyld
0x91f68000 - 0x91f6bfe7  libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <1622A54F-1A98-2CBE-B6A4-2122981A500E> /usr/lib/system/libmathCommon.A.dylib
0x97672000 - 0x97819ff7  libSystem.B.dylib 125.2.1 (compatibility 1.0.0) <62291026-D016-705D-DC1E-FC2B09D47DE5> /usr/lib/libSystem.B.dylib
0x9845f000 - 0x984c9fe7  libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <411D87F4-B7E1-44EB-F201-F8B4F9227213> /usr/lib/libstdc++.6.dylib
0xffff0000 - 0xffff1fff  libSystem.B.dylib ??? (???) <62291026-D016-705D-DC1E-FC2B09D47DE5> /usr/lib/libSystem.B.dylib

--- End quote ---


>>


Console output:
>>
--- Quote ---vamp-plugin-tester: Running...
Testing plugin: test:myplugin
 -- Performing test: A1 Invalid identifiers
 -- Performing test: A2 Empty metadata fields
 ** WARNING: Plugin description is empty
 ** WARNING: Plugin maker is empty
 ** WARNING: Plugin copyright is empty
 ** WARNING: Plugin parameter "parameter" description is empty
 ** WARNING: Plugin output "output" description is empty
 -- Performing test: A3 Inappropriate value extents
 -- Performing test: B1 Output number mismatching
 ** NOTE: No results returned for output "output"
 -- Performing test: B2 Invalid or dubious timestamp usage
 -- Performing test: C1 Normal input
 -- Performing test: C2 Empty input
 -- Performing test: C3 Short input
 -- Performing test: C4 Absolutely silent input
 -- Performing test: C5 Input beyond traditional +/-1 range
 -- Performing test: C6 Random input
 -- Performing test: D1 Consecutive runs with separate instances
 -- Performing test: D2 Consecutive runs with a single instance using reset
 -- Performing test: D3 Simultaneous interleaved runs in a single thread
 -- Performing test: D4 Consecutive runs with different start times
vamp-plugin-tester(3367) malloc: *** error for object 0x300fa0: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
 ** WARNING: Consecutive runs with different starting timestamps produce the same result
 -- Performing test: E1 Inconsistent default program
 -- Performing test: E2 Inconsistent default parameters
vamp-plugin-tester(3367) malloc: *** error for object 0x301410: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
 -- Performing test: F1 Different sample rates
vamp-plugin-tester(3367) malloc: *** error for object 0x301650: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
vamp-plugin-tester(3367) malloc: *** error for object 0x301710: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
vamp-plugin-tester(3367) malloc: *** error for object 0x301630: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
 -- Performing test: F2 Lengthy constructor
vamp-plugin-tester: All tests succeeded for this plugin

vamp-plugin-tester: All tests succeeded, with 6 warning(s) and 1 other note(s)
Segmentation fault
--- End quote ---
>>


dhbenson:
Hmm... I tried switching over to Linux to see if that would help.  I'm getting the same behaviour in Ubuntu 8.04. 

Also, I've noticed that this plugin, and other plugins that I've written, run fine in other hosts, even though they crash the Vamp Plugin Tester.  Is there possibly a bug in in the Plugin Tester?

cannam:
Hello there -- I was sure I'd replied to your question, but my reply clearly isn't there -- maybe I composed it but forgot to post it.

My first suggestion in a situation like this would always be to run "make clean" and make again.  I realise that you may have done this already (perhaps many times!) but it's by far the most common cause of this sort of problem -- you change a header but the Makefile lacks the necessary dependencies to rebuild all of the files that include the header when you next run "make", so that two object files end up having different ideas about the size of a particular object.

I'm not sure how that squares with your later comment that you've already tried it on more than one machine, though.  I just thought I should ask anyway.

(I wonder if we could improve the skeleton Makefile from the SDK to help with this situation.)

It _is_ expected that a plugin may crash in the tester but apparently run fine in other hosts -- the idea of the tester is to test the plugin in some situations that other hosts would not necessarily exercise, so that you can get better test coverage before you release and you won't suddenly find that it fails to run in some later version of a host that works differently in some way.  And I'm afraid this is more likely to indicate a bug in the plugin than in the tester -- not that I believe the tester to be bug-free, but it has been reasonably widely tested.


Chris

Navigation

[0] Message Index

Go to full version