summaryrefslogtreecommitdiff
path: root/src/scripts/genEtwProvider.py
diff options
context:
space:
mode:
authorAndrew Au <andrewau@microsoft.com>2019-06-28 10:41:31 -0700
committerGitHub <noreply@github.com>2019-06-28 10:41:31 -0700
commit141d587472ee2fe6ab522c603c352936defeaac3 (patch)
treec80f5b472217508ba57c8231d9bd0079ae66c300 /src/scripts/genEtwProvider.py
parent7da8f885c6ee7dceabce393b1de5fd53f893dd4d (diff)
downloadcoreclr-141d587472ee2fe6ab522c603c352936defeaac3.tar.gz
coreclr-141d587472ee2fe6ab522c603c352936defeaac3.tar.bz2
coreclr-141d587472ee2fe6ab522c603c352936defeaac3.zip
Avoid the multiplication generated by mc.exe (#25454)
Diffstat (limited to 'src/scripts/genEtwProvider.py')
-rw-r--r--src/scripts/genEtwProvider.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/scripts/genEtwProvider.py b/src/scripts/genEtwProvider.py
index adc91bac0c..091b7b2240 100644
--- a/src/scripts/genEtwProvider.py
+++ b/src/scripts/genEtwProvider.py
@@ -22,7 +22,14 @@ clrxplat_filename = "clrxplatevents.h"
etw_dirname = "etw"
replacements = [
(r"EventEnabled", "EventXplatEnabled"),
- (r"\bPVOID\b", "void*")
+ (r"\bPVOID\b", "void*"),
+]
+counted_replacements = [
+ # There is a bug in the MC code generator that miscomputes the size of ETW events
+ # which have variable size arrays of variable size arrays. This occurred in our GCBulkType
+ # event. This workaround replaces the bad size computation with the correct one. See
+ # https://github.com/dotnet/coreclr/pull/25454 for more information"
+ (r"_Arg0 \* _Arg2_Len_", "_Arg2_Len_", 1)
]
stdprolog_cpp="""
@@ -54,6 +61,11 @@ def genProviderInterface(manifest, intermediate):
for pattern, replacement in replacements:
header_text = re.sub(pattern, replacement, header_text)
+ for pattern, replacement, expected_count in counted_replacements:
+ (header_text, actual_count) = re.subn(pattern, replacement, header_text)
+ if actual_count != expected_count:
+ raise Exception("The workaround for https://github.com/dotnet/coreclr/pull/25454 in src/scripts/genEtwProvider.py could not be applied. Has the generated code changed or perhaps the underlying issue has been fixed? ")
+
with open(path.join(provider_dirname, mcheader_filename), 'w') as mcheader_file:
mcheader_file.write(header_text)