-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10.08.2013 17:25, Martin Mitáš wrote:
>>
>> The difference between using abort() and using a debug break is that
>> debug break, if it goes unhandled, won't print the usual "requrested to
>> terminate blahblahblah" stuff, and the exception code that WER shows
>> will change from 0x40000015 to 0x80000003.
> 
> That would mean that when not under debugger, user would have no idea 
> what has happened and why his process just disappeared. I recommend to 
> use __debugbreak()/DebugBreak() only when being debugged. Fortunately, 
> Win32API has a function for detecting that:
> 
>     if(IsDebuggerPresent())
>        __debugbreak();
>     else
>        abort();
> 
> (I use similar construction in my assert-like macros for my projects and 
> I can confirm it really makes my debugging experience much easier.)

1) abort() is not very informative either (no stack trace, no nothing).
2) Reproducing the output that abort() produces is not a problem (just
print some text - how hard could it be?)
3) One could even add useful data (replace plain abort() call with
printf-with-explicit-reason-for-aborting + abort(); or add backtraces,
or both, although backtraces might require support code that's too big -
getting backtraces outside of gdb on W32 proved to be unusually difficult).

IsDebuggerPresent() is used by glib that way in some places.

Dunno, it's probably ok to do the IsDebuggerPresent().

That said, ktietz pointed out that all of that might be problematic when
developing for restricted W32 API subsets.

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJSBkXIAAoJEOs4Jb6SI2CwC8kH/1jkMkyzSMkoVSV/ZuVzM6bI
J1mVgALIhmHRjjiCTubIB5Qyctth2LySv0sMb3iXNKe7E6yhhMAhhaLhAewaozBE
mBXxmsJ7Rg09QJ+d2kQFirMQVJbwvtf5CEJoS+hG4qlTHUdK0aGO7TAqc00ePql6
sjXlecVa8aMb8nKBi7QX4QgBDYLrg2cbzKYucVA4Is82Yx0JitS8M57k0GwlIcei
H6eZinrpu61Q6Ep/B2V6jd4IrhDzeCQiw4IIyO5qs6SpFHSNBg1dAEFSNvvLSoXT
7EEQo5dP/kCu9wl7n2Dymm4MiXMVvU9Dx4v1tDOqcI5Ak8U3v/6WEuG+OPkbugw=
=NJun
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to