[LLDB][NativePDB] Check function type before casting #166090
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I ran the shell tests on Windows locally, LLDB crashed on
TestIRMemoryMapWindows.test. It crashed, because it tried to create a function type for a type index that wasn't a function type.CreateFunctionDeclFromId(the function changed in this PR) creates a function decl forLF_FUNC_IDandLF_MFUNC_IDrecords. These records are in the IPI stream, which only contains IDs and references to the main type stream, TPI. Specifically, it crashed when handling the0x32BBIPI record:The type of
0x32BBhere is obviously wrong, as it's not a function type.The confusing part is that
invoke_mainhas twoLF_FUNC_IDrecords. The other one is a bit earlier in the stream and has a correct TPI record:Unfortunately, I can't reproduce this anymore. I experimented with using lld-link instead of MS' link. There, I couldn't reproduce it. Switching back to MS' link resulted in the correct PDB again.
I suspect the issue is related to incremental linking.