Skip to content

Instantly share code, notes, and snippets.

@kevingosse
Created August 26, 2020 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevingosse/8c2d5b6301930d9dff9e613f7c980ec7 to your computer and use it in GitHub Desktop.
Save kevingosse/8c2d5b6301930d9dff9e613f7c980ec7 to your computer and use it in GitHub Desktop.
void Module::SetDynamicIL(mdToken token, TADDR blobAddress, BOOL fTemporaryOverride)
{
DynamicILBlobEntry entry = {mdToken(token), TADDR(blobAddress)};
// Lazily allocate a Crst to serialize update access to the info structure.
// Carefully synchronize to ensure we don't leak a Crst in race conditions.
if (m_debuggerSpecificData.m_pDynamicILCrst == NULL)
{
InitializeDynamicILCrst();
}
CrstHolder ch(m_debuggerSpecificData.m_pDynamicILCrst);
// Figure out which table to fill in
PTR_DynamicILBlobTable &table(fTemporaryOverride ? m_debuggerSpecificData.m_pTemporaryILBlobTable
: m_debuggerSpecificData.m_pDynamicILBlobTable);
// Lazily allocate the hash table.
if (table == NULL)
{
table = PTR_DynamicILBlobTable(new DynamicILBlobTable);
}
table->AddOrReplace(entry);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment