This is an archive of the discontinued LLVM Phabricator instance.

Generalize DWARF tests that expect DW_FORM_strp
ClosedPublic

Authored by Jake-Egan on Oct 21 2021, 5:59 PM.

Details

Summary

The modified tests were failing on AIX because DWARF on AIX uses inline strings by default, but the tests check for DW_FORM_strp.

This patch removes DW_FORM_strp so both forms will pass the check.

Diff Detail

Event Timeline

Jake-Egan requested review of this revision.Oct 21 2021, 5:59 PM
Jake-Egan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2021, 5:59 PM
Jake-Egan edited the summary of this revision. (Show Details)Oct 21 2021, 6:02 PM
Jake-Egan added a reviewer: shchenz.

Maybe we could split this patch into two:
1: for the space and tab
2: for -dwarf-inlined-strings=Disable

The second one looks reasonable to me.
But for the first one, do we know why on AIX it generates a tab instead of space? Is it caused by llvm-dwarfdump on AIX? If so, maybe we need to change llvm-dwarfdump to make it generate space also on AIX?

Maybe we could split this patch into two:
1: for the space and tab
2: for -dwarf-inlined-strings=Disable

The second one looks reasonable to me.
But for the first one, do we know why on AIX it generates a tab instead of space? Is it caused by llvm-dwarfdump on AIX? If so, maybe we need to change llvm-dwarfdump to make it generate space also on AIX?

^ agreed. Would be good to understand why llvm-dwarfdump is doing anything different in terms of whitespace on AIX... I can't think of any reason that should be the case.

Jake-Egan added a comment.EditedOct 24 2021, 4:22 PM

Here is an example for the differing output with file llvm/test/DebugInfo/Generic/varargs.ll

On Linux:

DW_AT_name [DW_FORM_strp]^I( .debug_str[0x00000065] = "a")$

On AIX:

DW_AT_name [DW_FORM_string]^I("a")$

I will create a new patch for the white space issue and convert this patch to add the -dwarf-inlined-strings=Disable option.

Jake-Egan updated this revision to Diff 381807.EditedOct 24 2021, 4:26 PM
Jake-Egan edited the summary of this revision. (Show Details)

Update patch for -dwarf-inlined-strings=Disable option.

Jake-Egan retitled this revision from Adapt DWARF tests for AIX to Add -dwarf-inlined-strings=Disable option to DWARF tests that expect DW_FORM_strp.Oct 24 2021, 4:29 PM
Jake-Egan edited the summary of this revision. (Show Details)
shchenz accepted this revision.Oct 24 2021, 8:06 PM

LGTM. Thanks

This revision is now accepted and ready to land.Oct 24 2021, 8:06 PM

I think probably generalizing the tests to not care about the string encodings is probably the right thing, rather than forcing indirect strings?

I think these tests are overly specific - they don't look like they should care about the string encoding (& Probably an artifact of older techniques in writing these debug info tests - improvements to the dumper to print strings inline, skip forms, etc)

Here is an example for the differing output with file llvm/test/DebugInfo/Generic/varargs.ll

On Linux:

DW_AT_name [DW_FORM_strp]^I( .debug_str[0x00000065] = "a")$

On AIX:

DW_AT_name [DW_FORM_string]^I("a")$

I will create a new patch for the white space issue and convert this patch to add the -dwarf-inlined-strings=Disable option.

Thanks for showing the difference - I think these can probably most often be tested with CHECK: DW_AT_name {{.*}}"a" is probably fine - or if the tests don't need -v output (doesn't dump forms, etc), it'll probably be simpler, may even be exactly the same output between strp and str encodings.

I think probably generalizing the tests to not care about the string encodings is probably the right thing, rather than forcing indirect strings?

I think these tests are overly specific - they don't look like they should care about the string encoding (& Probably an artifact of older techniques in writing these debug info tests - improvements to the dumper to print strings inline, skip forms, etc)

I agree generalizing the test is probably the better option if DW_FORM_strp isn't necessary for the purpose of the test.

@shchenz I will update the patch if you have no objection.

I think probably generalizing the tests to not care about the string encodings is probably the right thing, rather than forcing indirect strings?

I think these tests are overly specific - they don't look like they should care about the string encoding (& Probably an artifact of older techniques in writing these debug info tests - improvements to the dumper to print strings inline, skip forms, etc)

I agree generalizing the test is probably the better option if DW_FORM_strp isn't necessary for the purpose of the test.

@shchenz I will update the patch if you have no objection.

Sounds good to me

Jake-Egan updated this revision to Diff 382170.Oct 25 2021, 8:20 PM

Update patch to generalize the tests instead.

Jake-Egan retitled this revision from Add -dwarf-inlined-strings=Disable option to DWARF tests that expect DW_FORM_strp to Generalize DWARF tests that expect DW_FORM_strp.Oct 25 2021, 8:23 PM
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan edited the summary of this revision. (Show Details)Oct 25 2021, 8:27 PM
dblaikie added inline comments.Oct 25 2021, 8:57 PM
llvm/test/DebugInfo/Generic/containing-type-extension.ll
8

I'd drop the "= " here (& elsewhere in the patch), like it's done elsewhere

Jake-Egan added inline comments.Oct 26 2021, 6:17 AM
llvm/test/DebugInfo/Generic/containing-type-extension.ll
8

I was going to do that in a separate patch for the whitespace. I think it's more related to the whitespace issue do you think? The patch would remove both = and spaces.

dblaikie accepted this revision.Oct 26 2021, 9:48 AM
dblaikie added inline comments.
llvm/test/DebugInfo/Generic/containing-type-extension.ll
8

Oh, sure, either way

This revision was automatically updated to reflect the committed changes.