Skip to content

Commit

Permalink
Goodbye goto
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlock committed Aug 31, 2022
1 parent bc25c99 commit b5c00bd
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions tracer/src/Datadog.Tracer.Native/cor_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,22 +684,33 @@ HRESULT CorProfiler::TryRejitModule(ModuleID module_id)
{
if (module_info.assembly.name.rfind(skip_assembly_pattern, 0) == 0)
{
bool is_included = false;
// The assembly matches the "skip" prefix, but check if it's specifically included
for (auto&& include_assembly : include_assemblies)
{
if (module_info.assembly.name == include_assembly)
{
Logger::Debug("ModuleLoadFinished matched module by pattern: ", module_id, " ", module_info.assembly.name,
"but assembly is explicitly included");
goto inject;
is_included = true;
break;
}
}
Logger::Debug("ModuleLoadFinished skipping module by pattern: ", module_id, " ", module_info.assembly.name);
return S_OK;

if (is_included)
{
Logger::Debug("ModuleLoadFinished matched module by pattern: ", module_id, " ",
module_info.assembly.name,
"but assembly is explicitly included");
break;
}
else
{
Logger::Debug("ModuleLoadFinished skipping module by pattern: ", module_id, " ",
module_info.assembly.name);
return S_OK;
}
}
}

inject:
if (module_info.assembly.name == managed_profiler_name)
{
// Fix PInvoke Rewriting
Expand Down

0 comments on commit b5c00bd

Please sign in to comment.