Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

WIP: Allow disabling exception trace info via --DRT-traceContext=off #86

Open
wants to merge 1 commit into
base: ldc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ldc/eh/config.d
Original file line number Diff line number Diff line change
@@ -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;
}
3 changes: 2 additions & 1 deletion src/ldc/eh/libunwind.d
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down