diff --git a/src/ldc/eh/config.d b/src/ldc/eh/config.d new file mode 100644 index 0000000000..3b2e2c1c1f --- /dev/null +++ b/src/ldc/eh/config.d @@ -0,0 +1,11 @@ +module ldc.eh.config; + +import rt.config; + +package __gshared bool traceContext = true; + +shared static this() +{ + if (rt_configOption("traceContext") == "off") + traceContext = false; +} diff --git a/src/ldc/eh/libunwind.d b/src/ldc/eh/libunwind.d index 0b0dbfaa54..f2974a33e3 100644 --- a/src/ldc/eh/libunwind.d +++ b/src/ldc/eh/libunwind.d @@ -491,7 +491,8 @@ void _d_throw_exception(Object e) auto throwable = cast(Throwable) e; - if (throwable.info is null && cast(byte*)throwable !is typeid(throwable).init.ptr) + static import ldc.eh.config; + if (ldc.eh.config.traceContext && throwable.info is null && cast(byte*)throwable !is typeid(throwable).init.ptr) throwable.info = _d_traceContext(); auto exc_struct = ExceptionStructPool.malloc();