aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-09-25 23:03:41 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2021-09-30 15:07:19 +0200
commited3ec7343b7d104a3285336fbfc1e4719719f9b6 (patch)
tree6953149589798af518e0a53f1956fa26f037fd87 /libphobos
parent0111153234120de7f87b050df78f0d9819ca4214 (diff)
downloadgcc-ed3ec7343b7d104a3285336fbfc1e4719719f9b6.zip
gcc-ed3ec7343b7d104a3285336fbfc1e4719719f9b6.tar.gz
gcc-ed3ec7343b7d104a3285336fbfc1e4719719f9b6.tar.bz2
libphobos: Print stacktrace before terminating program due to uncaught exception.
By default, D run-time has a top level exception handler to catch anything that was uncaught by user code. However when the `rt_trapExceptions' flag is cleared, this handler would not be enabled, and this termination would occur, aborting the program, but without any information about the exception. libphobos/ChangeLog: * libdruntime/gcc/deh.d (_d_print_throwable): Declare. (_d_throw): Print stacktrace before terminating program due to uncaught exception.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/libdruntime/gcc/deh.d5
1 files changed, 5 insertions, 0 deletions
diff --git a/libphobos/libdruntime/gcc/deh.d b/libphobos/libdruntime/gcc/deh.d
index eb83751c..a7eb37c 100644
--- a/libphobos/libdruntime/gcc/deh.d
+++ b/libphobos/libdruntime/gcc/deh.d
@@ -34,6 +34,7 @@ extern(C)
{
int _d_isbaseof(ClassInfo, ClassInfo);
void _d_createTrace(Object, void*);
+ void _d_print_throwable(Throwable t);
}
/**
@@ -510,7 +511,11 @@ extern(C) void _d_throw(Throwable object)
// things, almost certainly we will have crashed before now, rather than
// actually being able to diagnose the problem.
if (r == _URC_END_OF_STACK)
+ {
+ __gdc_begin_catch(&eh.unwindHeader);
+ _d_print_throwable(object);
terminate("uncaught exception", __LINE__);
+ }
terminate("unwind error", __LINE__);
}