I recently started working on an existing project written in C++ Builder. The application consists of a MainModule that loads lots of modules (DLLs). The MainModule itself is a DLL (there is a small loader (.exe) that starts the MainModule).
The MainModule should not crash if a problem appears in any of the loaded modules (DLLs). So, it is imperative that the exceptions will not leave the module(s). Therefore, in each DLL there is a global try/catch that traps all exceptions inside.
To make the code more compact, exceptions are used everywhere for
- flow control
- signaling things
- error logging (when something wrong happens, the exception handler will output a message to the console)
The debugging is done based on the messages shown in the console and also
printf lines are inserted in code to see if the program reaches a certain point in a function or not.
I wonder, how could I debug those DLLs?
The problem is that when an access violation happens in one of those plugins/DLLs, the global try/catch will catch the exception. It will never reach the main application/debugger.
Note: The code is reviewed. Therefore, it is also imperative to do as little changes as possible to the existing code!