I would like to replace any standard error-dialog with throw
or debug-break
(with standard I mean anything which is not explicitly written by me) since like in the reason-section described, it would cause debugging of a Windows-Service sometimes to be impossible.
to accomplish this I did try defining something like:
-D "_HAS_ITERATOR_DEBUGGING=0"
but above did just disable the error-dialogs and is really not enough to track down the issues, so I would like it to throw-exception
or to debug-break
instead of showing the error-dialog.
is there anything else you would suggest me to define or do?
Reason:
While developing a Windows-Service, I had some hard times to find a bug which was causing the server to crash:
- there was an Off-by-one error in
std::unordered_map
usage - the App's crash-dump feature was prevented by
std::unordered_map
which tried to show an error message-box (since compiled in debug-mode) - but the program did crash without giving any feedback, basically because a windows-service is not allowed to show any error-dialog (except by using "WTSSendMessage(...)")
- even when the debugger was attached, still nothing...
- Only using
git
history and rechecking all recent changes was it possible to find the issue
Reproduce:
by running below in a service (compiled in debug-mode) you can reproduce this issue:
#include <unordered_map>
// will cause crash by trying to increment iterator pointing to end
inline static void simulateCrash() {
typedef std::unordered_map<quint32, quint32> Hash;
Hash list;
list[0xC001] = 0xDEAD;
Hash::iterator it = list.begin();
it = list.erase(it);
++it; // should crash here
}