LLVMSymbolizer in getOrCreateObjects() takes ownership of the Binary object it creates, so it's not deallocated early (we're storing pointers to Binary objects in ObjectFileForArch). However, when getObjectFileFromBinary fails (e.g. when the specified architecture is not found), we currently fail to take ownership of Binary. Instead we end up deallocating the object too early and storing a dangling pointer in ObjectFileForArch. This fix calls addOwningBinary even when an error is returned from getObjectFileFromBinary.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
This is wrong for several reasons: first of all, there are many calls to getObjectFileFromBinary, and you likely need to do smth. similar for all of them. But then it somewhat defeats the purpose of caching: we essentially keep object files in memory even if they don't have object file for appropriate architecture. Looks like this code needs to be reworked, and at the very least ObjectFileForArch should not have raw pointers as keys. I'll look into that.