[lldb][Mach-O] Initialize cputype/cpusubtype in test corefiles (#120518) #9772
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.
TestFirmwareCorefiles.py has a helper utility,
create-empty-corefile.cpp, which creates corefiles with different metadata to specify the binary that should be loaded. It normally uses an actual binary's UUID for the metadata, and it uses the binary's cputype/cpusubtype for the corefile's mach header.
There is one test where it creates a corefile with metadata for a UUID that cannot be found -- it is given no binary -- and in that case, the cputype/cpusubtype it sets in the core file mach header was uninitialized data. Through luck, on Darwin systems, the uninitialized data typically matched a CPU_TYPE from machine.h and the test would work. But when the value doens't match one of thoes defines, lldb would reject the corefile entirely, and the test would fail. This has been an infrequent failure on the CI bots for a while and I couldn't ever repo it. There's a recent configuration where it was happening every time and I was able to track it down.
rdar://141727563
(cherry picked from commit 527595f)