-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[cDAC] Implement SetCompilerFlags for cDAC #127244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e141af5
4b4bb02
187ffb1
261b9ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -315,7 +315,48 @@ public int GetCompilerFlags(ulong vmAssembly, Interop.BOOL* pfAllowJITOpts, Inte | |||||
| } | ||||||
|
|
||||||
| public int SetCompilerFlags(ulong vmAssembly, Interop.BOOL fAllowJitOpts, Interop.BOOL fEnableEnC) | ||||||
| => LegacyFallbackHelper.CanFallback() && _legacy is not null ? _legacy.SetCompilerFlags(vmAssembly, fAllowJitOpts, fEnableEnC) : HResults.E_NOTIMPL; | ||||||
| { | ||||||
| int hr = HResults.S_OK; | ||||||
| try | ||||||
| { | ||||||
| Contracts.ILoader loader = _target.Contracts.Loader; | ||||||
| Contracts.ModuleHandle handle = loader.GetModuleHandleFromAssemblyPtr(new TargetPointer(vmAssembly)); | ||||||
|
|
||||||
| Contracts.DebuggerAssemblyControlFlags controlFlags = loader.GetDebuggerInfoBits(handle); | ||||||
| controlFlags &= ~(Contracts.DebuggerAssemblyControlFlags.DACF_ALLOW_JIT_OPTS | Contracts.DebuggerAssemblyControlFlags.DACF_ENC_ENABLED); | ||||||
| controlFlags &= Contracts.DebuggerAssemblyControlFlags.DACF_CONTROL_FLAGS_MASK; | ||||||
|
|
||||||
| if (fAllowJitOpts == Interop.BOOL.TRUE) | ||||||
| { | ||||||
| controlFlags |= Contracts.DebuggerAssemblyControlFlags.DACF_ALLOW_JIT_OPTS; | ||||||
| } | ||||||
|
|
||||||
| if (fEnableEnC == Interop.BOOL.TRUE) | ||||||
| { | ||||||
| controlFlags |= Contracts.DebuggerAssemblyControlFlags.DACF_ENC_ENABLED; | ||||||
| } | ||||||
|
|
||||||
| loader.SetDebuggerInfoBits(handle, controlFlags); | ||||||
|
|
||||||
| // Check if EnC was requested but the module was not capable. | ||||||
|
||||||
| // Check if EnC was requested but the module was not capable. | |
| // Check if EnC was requested but was not successfully enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: prefer Marshal.GetExceptionForHR
Uh oh!
There was an error while loading. Please reload this page.