This is an archive of the discontinued LLVM Phabricator instance.

Ignore DBGArchitecture from DebugSymbols DBGShellCommands outputs
ClosedPublic

Authored by jasonmolenda on Dec 4 2020, 2:17 PM.

Details

Summary

The plist returned by a DBGShellCommands program (dsymForUUID etc) may include an architecture in the DBGArchitecture kv. lldb uses this to fill in the ArchSpec of the ModuleSpec it returns along with the executable/dsym file path. The bug I'm fixing here is that lldb and the provider of DBGArchitecture may *disagree* about what the architecture is called, and when lldb tries to load the actual binary, it will find that the ArchSpec of the binary does not match the ModuleSpec it is looking for, and ignore the binary.

In the specific case I'm fixing, it was an arm cortex-m corefile where lldb calls it armv7em, but dwarfdump (I suspect) was calling it thumbv7em to for MC to treat the instructions as pure thumb (lldb does the same when it creates the MCDisassembler). The process of picking the matching ModuleSpec is looking for an exact match, and this fails.

The architecture in the plist is of little importance, we're working with binaries with UUIDs and that is what we need to be depending on. I thought about different ways of trying to address this, and ultimately, ignoring DBGArchitecture which adds no benefits to lldb, is the best.

rdar://problem/71612561

Diff Detail

Event Timeline

jasonmolenda created this revision.Dec 4 2020, 2:17 PM
jasonmolenda requested review of this revision.Dec 4 2020, 2:17 PM

Ah, I forgot to add. I added a test by having an existing corefile test (which loads an x86_64 binary) have a plist that claims it is i386. It's close to the same thing, and results in the same kind of erroring if lldb trusts the arch from the plist.

This revision is now accepted and ready to land.Dec 8 2020, 1:12 PM
This revision was automatically updated to reflect the committed changes.