Skip to content

Update DacCompareNativeTypes - #1335

Merged
sdmaclea merged 1 commit into
dotnet:masterfrom
sdmaclea:DacCompareNativeTypes
Jul 10, 2020
Merged

sdmaclea merged 1 commit into
dotnet:masterfrom
sdmaclea:DacCompareNativeTypes

Conversation

@sdmaclea

@sdmaclea sdmaclea commented Jul 9, 2020

Copy link
Copy Markdown
Contributor

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()

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()
@sdmaclea
sdmaclea requested a review from hoyosjs July 9, 2020 23:23
@sdmaclea sdmaclea self-assigned this Jul 9, 2020

@hoyosjs hoyosjs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)(?!)))>)?");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sdmaclea
sdmaclea merged commit 0972a03 into dotnet:master Jul 10, 2020
@sdmaclea
sdmaclea deleted the DacCompareNativeTypes branch June 10, 2021 00:35
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants