Page MenuHomePhabricator

[symbolizer] Avoid collecting symbols belonging to invalid sections.
ClosedPublic

Authored by mattd on Feb 12 2019, 1:45 PM.

Details

Summary

llvm-symbolizer would originally report symbols that belonged to an invalid object file section.
Specifically the case where: *Symbol.getSection() == ObjFile.section_end()
This patch prevents the Symbolizer from collecting symbols that belong to invalid sections.

The test (from PR40591) introduces a case where two symbols have address 0,
one symbol is defined, 'foo', and the other is not defined, 'bar'. This patch will cause
the Symbolizer to keep 'foo' and ignore 'bar'.

As a side note, the logic for adding symbols to the Symbolizer's store
(SymbolizableObjectFile::addSymbol) replaces symbols with the
same <address, size> pair. At some point that logic should be revisited as in the
aforementioned case, 'bar' was overwriting 'foo' in the Symbolizer's store,
and 'foo' was forgotten.

This fixes PR40591

Diff Detail

Repository
rL LLVM

Event Timeline

mattd created this revision.Feb 12 2019, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2019, 1:45 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
rupprecht accepted this revision.Feb 14 2019, 2:38 PM
This revision is now accepted and ready to land.Feb 14 2019, 2:38 PM
This revision was automatically updated to reflect the committed changes.

FWIW, I think this test belongs in the DebugInfo directory of the testsuite rather than tools/llvm-symbolizer, because it is testing functionality in the library rather than in the tool layer.