This is an archive of the discontinued LLVM Phabricator instance.

Fix MinidumpParser::GetFilteredModuleList() and test it
ClosedPublic

Authored by clayborg on Dec 12 2018, 1:35 PM.

Details

Summary

The MinidumpParser::GetFilteredModuleList() code was attempting to iterate through the entire module list and if it found more than one entry for a given module name, it wanted to pick the MinidumpModule with the lowest address. A bug existed where it wasn't doing that due to "exists" variable being inverted. "exists" was set to true if it was inserted, not if it existed. Furthermore, the order of the modules would be modified by sorting all modules from low address to high address (using MinidumpModule::base_of_image). This fix also maintains the original order which means your executable is at index 0 as intended instead of some random shared library.

Tests were added to ensure this functionality doesn't regress.

Diff Detail

Repository
rL LLVM

Event Timeline

clayborg created this revision.Dec 12 2018, 1:35 PM

The order in the modules list is maintained by changing the llvm::StringMap to map from module name to "filtered_modules" index. This avoids having to iterate across the StringMap in the end and make the filtered_modules in a different ordering.

clayborg edited the summary of this revision. (Show Details)Dec 12 2018, 1:37 PM
labath accepted this revision.Dec 13 2018, 12:57 AM

Looks good to me.

This revision is now accepted and ready to land.Dec 13 2018, 12:57 AM
This revision was automatically updated to reflect the committed changes.