Using Windbg to debug D applications and unittests

Basile B. b2.temp at gmx.com
Mon Feb 27 12:09:50 UTC 2023


On Saturday, 25 February 2023 at 15:55:33 UTC, solidstate1991 
wrote:
> I had a lot of trouble trying to get Visual Studio to catch 
> handled exceptions, which would have been mandatory for 
> debugging unittests, but I either forgot how to do it, or 
> something have changed in either the newer versions of VS or 
> the D compilers I use (LDC, DMD).
> [...]

You must break on `_d_throwc` (windows), `_d_throwdwarf` (linux), 
`_d_throw_exception` (ldc).

They are defined in

- https://github.com/dlang/dmd/blob/master/druntime/src/rt/deh.d
- 
https://github.com/dlang/dmd/blob/master/druntime/src/rt/deh_win32.d
- 
https://github.com/dlang/dmd/blob/master/druntime/src/rt/deh_win64_posix.d

At least this is what is done for the Dexed GDB widget, so that 
gdb breaks automatically when an Error or an Exception is new'd 
(https://gitlab.com/basile.b/dexed/-/blob/master/src/u_gdb.pas#L2072).


More information about the Digitalmars-d-learn mailing list