Repository navigation
Update DacCompareNativeTypes - #1335
Conversation
Adjust Regex expressions to match dwarfdump in Ubuntu 20.04. Latest version of dwarfdump dropped quotation marks off tyoe names. Remove unicode quotes from expression. Use closing group syntax to match opening '<' to closing '>'. Extend ignore list for libunwind types. CrossOS DAC is using a different version of libunwind (1.5+) than the Linux DAC (1.3). Also add dbi's Target_CLiteWeightStgdbRW Add stats output to Main() Add return exit code to Main()
hoyosjs
left a comment
There was a problem hiding this comment.
I'll believe you on the type regex 😄It's a case of crazy regex
| static Regex typeNameRegEx = new Regex(@"^<(?<nesting>\d+)><.*GOFF=0x(?<goff>[0-9a-fA-F]+)><DW_TAG_((class_type)|(structure_type)|(union_type)|(typedef))>(.*DW_AT_name<\u0022(?<name>.+?)\u0022>)?"); | ||
| // <1><0x9ad2 GOFF=0x1e17b22><DW_TAG_structure_type> DW_AT_name<"STORAGESIGNATURE"> DW_AT_byte_size<0x00000010> DW_AT_decl_file<0x00000014 /home/stmaclea/git/runtime/src/coreclr/src/md/inc/mdfileformat.h> DW_AT_decl_line<0x0000003f> | ||
| static Regex typeRegEx = new Regex(@"^<(?<nesting>\d+)><.*GOFF=0x(?<goff>[0-9a-fA-F]+)><DW_TAG_((class)|(structure)|(union))_type>(.*DW_AT_name<\u0022(?<name>.+?)\u0022>)?.*?DW_AT_decl_file"); | ||
| static Regex typeNameRegEx = new Regex(@"^<(?<nesting>\d+)><.*GOFF=0x(?<goff>[0-9a-fA-F]+)><DW_TAG_((class_type)|(structure_type)|(union_type)|(typedef))>(.*DW_AT_name<(?<name>[^<>]*(((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*(?(Open)(?!)))>)?"); |
There was a problem hiding this comment.
Why do you need the negated capture group? [^<>] . And I'll trust you on this one if you tested it. This named capture group with backreference doesn't fit in my head right now. I don't know what (((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*(?(Open)(?!)) is covering for, given without it your sample still gets STORAGESIGNATURE in name. Is it for a template instantiation?
There was a problem hiding this comment.
It is almost a direct copy from the sample in this section https://docs.microsoft.com/en-us/dotnet/standard/base-types/grouping-constructs-in-regular-expressions#balancing-group-definitions
See
The regular expression pattern is:
^[^<>]*(((?'Open'<)[^<>]*)+((?'Close-Open'>)[^<>]*)+)*(?(Open)(?!))$
The regular expression is interpreted as follows: ...
I read it briefly. I partially understood it, but since it was exactly what I needed for nested template names. I just copied the sample without the ^ prefix or $ suffix.
Adjust Regex expressions to match dwarfdump in Ubuntu 20.04.
Latest version of dwarfdump dropped quotation marks off tyoe names.
Remove unicode quotes from expression. Use closing group syntax to
match opening '<' to closing '>'.
Extend ignore list for libunwind types. CrossOS DAC is using a different version
of libunwind (1.5+) than the Linux DAC (1.3). Also add dbi's Target_CLiteWeightStgdbRW
Add stats output to Main()
Add return exit code to Main()