Can't catch Phobos exceptions
Iain Buclaw
ibuclaw at gdcproject.org
Mon Mar 17 11:18:56 PDT 2014
On 17 March 2014 18:13, Demetri <Supernova2003dh at yahoo.com> wrote:
> I wrote a small D program. When compiled with DMD, it works fine, but
> neither GDC nor LDC2 can catch exceptions thrown from Phobos (proven by
> GDB). How do I fix this?
>
> Example code:
>
> import std.process;
> void main(){
> try
> {
> spawnProcess(["/dev/null"]);
> }
> catch (Throwable p)
> {
> return;
> }
> }
>
> which dies with SIGABRT when compiled and executed, even though the catch
> block should catch the ProcessException.
>
> Compiler: ldc2 based on LLVM 3.3 and DMD 2.063.2 (invoked via ldmd2 -O
> -inline -release), but also happens with gdc 4.8.2 (invoked via gdmd -O
> -inline -release). The execption is caught when I use dmd -O -inline
> -release to compile, even when I only catch ProcessException and not
> Throwable.
SIGABRT is normally a sign of an assert(false) in release code in GDC.
Try running a backtrace on the application.
More information about the D.gnu
mailing list