Page MenuHomePhabricator

Fix a crasher due to an assert when two files have the same UUID but different paths.

Authored by clayborg on Sep 26 2019, 2:40 PM.



The PlaceholderObjectFile has an assert in SetLoadAddress that fires if "m_base == value" is not true. To avoid this, we create check that the base address matches, and if it doesn't we clear the module that was found using the UUID so that we create a new PlaceholderObjectFile. Added a test to cover this issue.

Diff Detail

Event Timeline

clayborg created this revision.Sep 26 2019, 2:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2019, 2:40 PM
clayborg updated this revision to Diff 222032.Sep 26 2019, 2:42 PM

Remove printf that was left in.

Harbormaster completed remote builds in B38624: Diff 222032.
labath accepted this revision.Sep 27 2019, 12:41 AM

Looks good, modulo the comment about shadowing.


This implements something very similar to the GetBaseAddress function on line 81 (it is equivalent to const_cast<PlaceholderObjectFile *>(this)->GetBaseAddress().GetFileAddress()). In fact, the only reason you could define this function is because it is const, while the other method is not. Having two methods with the same name returning different types is very confusing. I think you should just drop this and replace the call on line 417 with objfile->GetBaseAddress().GetFileAddress(). That way, you don't even need to cast anything.

This revision is now accepted and ready to land.Sep 27 2019, 12:41 AM
This revision was automatically updated to reflect the committed changes.