When testing C++ code, if the global variable is of class type, abnormal termination may occur in the constructor of the class.

In this case, you should check the following:

  1. If the __get_errno_ptr() function is made of stubs, add the following to the stub body.
    • int* x = (int *)calloc(1, sizeof(int)); return x;
  2. If you are using a debug utility or a utility related to shm (shared memory), you need to make sure that the file path is not hardcoded. If it is hard coded, you should create system functions (fprintf, etc.) to access the file as stubs.
  3. You need to make sure that you do exit code at initialization time. If you run the exit code, you must generate the exit code as a stub.
  4. You need to check if the constructor stub has a throw. If there is a throw, it should be removed.

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.