Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEH exception with code 0xc0000005 thrown in the test body

I am writing a test using GoogleTest for the following class and I am getting the above error.

class Base {     // Other Functions;      CSig objSig[50]; } 

The Class CSig is as follows:

class CSig {     //... constructor, destructor(empty) and some functions     CMod *objMod;     CDemod *objDemod; }  CSig :: CSig {     bIsInitialised = false;      for (int i=0; i<MAX_NUM; i++)     {         PStrokePrev[i] = 0.0;     } } 

However, when I discard CSig objSig[50], the tests run fine.

What can I do to solve this issue? Also, I need to have CSig objSig[50] in the Base class.

like image 394
chintan s Avatar asked Oct 31 '12 12:10

chintan s


2 Answers

A SEH (Structured Exception Handling) exception is not a C++-exception that can be handled using c++-language constructs (try-catch) but it is raised from windows itself and points to some fundamental flaw. SEH-exceptions are very annoying because they do not cause normal stack unwinding which can lead to unclosed files or not-unlocked mutexes that should normally cleared by the destructors of the owning object. I have encountered SEH-exceptions when accessing memory that does not belong to the current process so I recommend looking at memory-related instructions in the constructor and destructor of CSig. You can read about SEH, for instance, here

like image 150
MadScientist Avatar answered Sep 17 '22 18:09

MadScientist


The way I just found the problem was that in Visual Studio I went to Debug->Exceptions, and checked everything in the first column. Then run/debug your unit tests, and it will throw an exception on the line that the problem is at. That's where you need to debug/fix it.

like image 37
Michele Avatar answered Sep 19 '22 18:09

Michele