GNOME Bugzilla – Bug 376645
Win32: Fatal warnings abort application even if IsDebuggerPresent is true
Last modified: 2006-12-28 14:48:06 UTC
Fatal warnings, i.e. all warnings if the application is started with --g-fatal-warnings, abort the application on Windows even if run in a debugger like gdb or WinDBG. If glib has debugging symbols, a breakpoint is added but abort is called nonetheless. I would like to see glib not to abort if I start my apps in gdb and have glib with debugging symbols. The attached patch does this for me. For non-debug glibs this would mean that applications do not abort if run in gdb, too. I do not have a strong opinion about that case, feel free to change the patch to handle it differently.
Created attachment 76805 [details] [review] Do not abort if IsDebuggerPresent is true
I don't understand what you mean with "if glib has debugging symbols"? Nothing in the Win32 code (or your patch) checks if there are debugging symbols or not, if that would even be possible. (The meaning of G_ENABLE_DEBUG is not whether glib has been compiled with debugging symbols or not. One can have compiled with -g in CFLAGS even if G_ENABLE_DEBUG is undefined. And correspondingly, one can have stripped away debugging symbols even if G_ENABLE_DEBUG is defined. And anyway, G_ENABLE_DEBUG doesn't affect the G_OS_WIN32 branch of the code in g_logv().) Anyway, the patch you suggest might indeed make sense. (Although, if debugging, it isn't that hard to then just skip the abort() call when the G_BREAKPOINT() is hit.) One cannot directly compare to what the non-Win32 code does, as there is no way for that code to know whether it is being run under a debugger or not.
OK, I have mixed up two issues and got the second incorrect... just ignore what I said about debugging symbols. The bug stays valid though :) At least I think so, right now...
Patch applied to HEAD: 2006-12-28 Tor Lillqvist <tml@novell.com> * glib/gmessages.c (g_logv): On Win32, if we get a fatal error message while being debugged we break into the debugger with G_BREAKPOINT(). Don't call abort() if the user is foolhardy enough to continue after the breakpoint. The user presumably knows what he is doing and deserves what he gets. (#376645, Andreas Köhler)