Skip to content

[lldb] add de-duplication and working dir support for fmodule-file #4039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

rmaz
Copy link

@rmaz rmaz commented Mar 8, 2022

This PR adds correct handling of the -fmodule-file= flag when
deserializing Swift debugging info. This flag is of the form
-fmodule-file=[<name>=]<file>, so we need to split on the final
= to get the path component in all cases.

This PR adds correct handling of the `-fmodule-file=` flag. This
flag is of the form `-fmodule-file=[<name>=]<file>`, so we need
to split on the final = to get the path component in all cases.
@kastiglione
Copy link

@swift-ci test

// We need special handling for -fmodule-file as we need to
// split on the final = after the module name.
if (arg.startswith("-fmodule-file=")) {
prefix = arg.substr(0, arg.rfind("=") + 1);

Choose a reason for hiding this comment

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

I assume this is safe, even if arg is either "foo", or "foo="?

Copy link
Author

Choose a reason for hiding this comment

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

The two valid cases are -fmodule-file=some/path and -fmodule-file=modulename=some/path. We know the first = is present as we checked the prefix above, so this will split correctly in both cases. There is no form -fmodule-file some/path so we don't need to handle that case.


// fmodule-file needs to handle different cases:
// -fmodule-file=path/to/pcm
// -fmodule-file=name=path/to/pcm

Choose a reason for hiding this comment

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

here it says -fmodule-file=name=path/to/pcm but all the tests use -fmodule-file=modulename=path/to/pcm is that a tricky test for the edge-case of passing in something that ends with name= or a typo?

Choose a reason for hiding this comment

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

Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

The name string can be anything, it is used to indicate the name of the module that you are providing the path to. I can make these the same if you think it is clearer? It shouldn't make any difference to the flag splitting logic though.

Choose a reason for hiding this comment

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

Oh, this isn't a key=value pair whre the key is "name", it's [name of the module]=[file name]!

Copy link
Author

Choose a reason for hiding this comment

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

Exactly, yes. I believe the idea is that the compiler can avoid loading pcm files until they are imported.

@kastiglione kastiglione merged commit 8836b23 into swiftlang:stable/20211026 Mar 9, 2022
adrian-prantl pushed a commit that referenced this pull request Mar 9, 2022
…4039)

This PR adds correct handling of the `-fmodule-file=` flag. This
flag is of the form `-fmodule-file=[<name>=]<file>`, so we need
to split on the final = to get the path component in all cases.

(cherry picked from commit 8836b23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants