de-bugging tips please
-
- KVRist
- Topic Starter
- 64 posts since 29 Oct, 2003 from London
Hello again,
I'm debugging my VST and having problems. As I've said previously I'm new to Delphi having had my only true development/programming experience in PL/SQL. A world apart.
So I'm debugging my VST running it in cubase SX2. It works fine feeding into the a1 synth (it's an arp type thing) but crashes if I play Trilogy 'live' at the same time. It also crashes with other synths.
Clearly I've messed something up but can't find it. The Cubase error report I get doesn't mean anything to me really - except that my plug-in is to blame.
Could anybody suggest some debugging tips what's the best way to go about it - any documentation to help me understand the cubase error log etc.
Cheers in advance,
I'm debugging my VST and having problems. As I've said previously I'm new to Delphi having had my only true development/programming experience in PL/SQL. A world apart.
So I'm debugging my VST running it in cubase SX2. It works fine feeding into the a1 synth (it's an arp type thing) but crashes if I play Trilogy 'live' at the same time. It also crashes with other synths.
Clearly I've messed something up but can't find it. The Cubase error report I get doesn't mean anything to me really - except that my plug-in is to blame.
Could anybody suggest some debugging tips what's the best way to go about it - any documentation to help me understand the cubase error log etc.
Cheers in advance,
-
- KVRian
- 922 posts since 26 Mar, 2003 from Guildford, England
What sort of crash? Access violation? akways a bitch to track down these kind of bugs.
If it is access violating, then check that you're not crapping on any memory you don't own.
Check any array boundaries, and pointers that could be writing where they shouldn't, paying careful attention to null-terminated strings that might get un-null terminated by accident.
not sure how you do memory management in delphi, but double check any allocations and deallocations. check that you don't deallocate more than once, and make sure that you're setting any pointers to null where you should be.
If you can (again I'm looking on from a C++ perspective), put a liberal sprinkling of assert()'s into your code to check pointers etc.
If it is access violating, then check that you're not crapping on any memory you don't own.
Check any array boundaries, and pointers that could be writing where they shouldn't, paying careful attention to null-terminated strings that might get un-null terminated by accident.
not sure how you do memory management in delphi, but double check any allocations and deallocations. check that you don't deallocate more than once, and make sure that you're setting any pointers to null where you should be.
If you can (again I'm looking on from a C++ perspective), put a liberal sprinkling of assert()'s into your code to check pointers etc.
-
- KVRist
- 33 posts since 15 Jan, 2003
not sure if it works w/ delphi but i use GDB successfully with win32 audio apps & vst plugins, it tells you exactly which function caused the problem.....just type 'where' after the bug peeps its head out, microsofts debugger is just a bloody mess in comparison. but check if some sort of debugger came with your delphi tools..
-
- KVRian
- 922 posts since 26 Mar, 2003 from Guildford, England
If its anything like the debugger in BCB, then it will probably crash more than your plugin.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Write tests!!
As soon as you write something, you must have some tests that verifies that function you wrote does what it has to do and not more.
I'm starting using this method for a little ASIO host, and this method has detected some little bugs that would have been nasty to find.
Check Refactoring Improving the Design of Existing Code, it's a must.
As soon as you write something, you must have some tests that verifies that function you wrote does what it has to do and not more.
I'm starting using this method for a little ASIO host, and this method has detected some little bugs that would have been nasty to find.
Check Refactoring Improving the Design of Existing Code, it's a must.
-
- KVRian
- 922 posts since 26 Mar, 2003 from Guildford, England
Thats a good thing to do - you can often test a class in relative isolation from a console app.Miles1981 wrote:Write tests!!
As soon as you write something, you must have some tests that verifies that function you wrote does what it has to do and not more.
-
- KVRist
- Topic Starter
- 64 posts since 29 Oct, 2003 from London
Thanks for your tips. I've commented out all my code added to the Delphi te,plate and brought it back bit by bit until I found the cause of the problem.
Which leads me to my next poost - which I'll start a new thread for to make the subject more relevant.
thanks all for help so far.
Which leads me to my next poost - which I'll start a new thread for to make the subject more relevant.
thanks all for help so far.