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

Conversation

kinke
Copy link
Member

@kinke kinke commented Jan 15, 2017

This should be more or less what @rainers suggested here. Seems to work after a single quick test. Should probably be upstreamed.

@rainers
Copy link

rainers commented Jan 16, 2017

Yeah, that's what I meant. The name of the option doesn't really describe its purpose, though. exceptionsCaptureCallStack would be clearer but a little verbose ;-)

On second thought: as there are little dependencies on this module, putting the initialization into a shared constructor executes it in arbitrary order with other shared constructors. So if there is an exception in an earlier constructor, the option still has its default. A user supplied shared constructor that sets the traceHandler would have the same effect.

I think it would behave more consistent with an explicit eh_init call from within rt_init. Instead of an additional boolean, Runtime.setTraceHandler could be used aswell.

BTW: Some time in the past I even hacked around the execution of the initializer in core.sys.windows.stackstrace because loading dbghelp.dll added considerable startup overhead. See https://github.com/dlang/visuald/blob/master/c2d/cpp2d_main.d#L830 (not sure if this still works, though).

@kinke
Copy link
Member Author

kinke commented Jan 20, 2017

The name of the option doesn't really describe its purpose, though.

To be defined (upstream then), incl. value string (off). ;)

as there are little dependencies on this module, putting the initialization into a shared constructor executes it in arbitrary order with other shared constructors. So if there is an exception in an earlier constructor, the option still has its default. I think it would behave more consistent with an explicit eh_init call from within rt_init.

I looked into rt_init() first, then wasn't sure when it was safe to use rt.config, and finally decided that I don't really care about unwanted stack traces attached to exceptions thrown at startup before checking the DRT option and thus went for the simplest approach.

Instead of an additional boolean, Runtime.setTraceHandler could be used aswell.

Absolutely, I was also thinking about something like this (checking in _d_traceContext()), as it's simpler when supporting a multitude of platforms with different EH implementions.

I'll keep this PR here for the time being just so that we don't forget about this potential performance booster.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants