This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Avoid triple corruption while merging core info from platform and target triples
ClosedPublic

Authored by omjavaid on Nov 12 2019, 6:14 PM.

Details

Summary

This patch fixes a bug where when target triple created from elf information is arm-*-linux-eabihf and platform triple is armv8l-*-linux-gnueabihf. Merging both triple results in armv8l--unknown-unknown.

This happens because we order a triple update while calling CoreUpdated and CoreUpdated creates a new triple with no vendor or environment information.

Making sure we do not update triple and just update to more specific core fixes the issue.

Diff Detail

Event Timeline

omjavaid created this revision.Nov 12 2019, 6:14 PM

Can you add a test case for this? I assuming it could be similar to one of the existing ArchSpec::MergeFrom tests in https://github.com/llvm/llvm-project/blob/7dd7a3607596a51044b8706ebf6df2e613ce1e9b/lldb/unittests/Utility/ArchSpecTest.cpp#L137

omjavaid updated this revision to Diff 229971.Nov 18 2019, 9:18 PM

Added a unittest as suggested by @labath.

Thanks. This behavior makes sense to me. @jasonmolenda, @clayborg, do you see any problems with this?

Ping @jasonmolenda

Any comments or LGTM?

jasonmolenda accepted this revision.Dec 4 2019, 12:36 PM

Thanks for the ping, yes this looks good to me.

This revision is now accepted and ready to land.Dec 4 2019, 12:36 PM
omjavaid added a project: Restricted Project.Dec 4 2019, 10:59 PM
This revision was automatically updated to reflect the committed changes.