This is an archive of the discontinued LLVM Phabricator instance.

DebugInfo/Symbolize: Don't differentiate function/data symbolization
ClosedPublic

Authored by MaskRay on Feb 8 2021, 11:55 PM.

Details

Summary

Before d08bd13ac8a560c4645e17e192ca07e1bdcd2895, only SymbolRef::ST_Function
symbols were used for .symtab symbolization. That commit added a "DATA" mode
to llvm-symbolizer which used SymbolRef::ST_Data symbols for symbolization.

Since function and data symbols have different addresses, we don't need to
differentiate the two modes. This patch unifies the two modes to simplify code.

"DATA" is used by compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp.
check-hwasan and check-tsan have runtime tests.

Diff Detail

Event Timeline

MaskRay created this revision.Feb 8 2021, 11:55 PM
MaskRay requested review of this revision.Feb 8 2021, 11:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2021, 11:55 PM
MaskRay edited the summary of this revision. (Show Details)Feb 9 2021, 12:05 AM
jhenderson requested changes to this revision.Feb 9 2021, 12:43 AM

Let's not rely on testing in compiler-rt to test llvm-symbolizer behaviour. Tests should be kept to the modules where the behaviour in question is. In this case, either DebugInfo or tools/llvm-symbolizer (probably the former in this case). I don't think it's hard to add a test case for this at all - all it needs to show is that a DATA directive can symbolize a function as data and CODE symbolizes an object as code.

This revision now requires changes to proceed.Feb 9 2021, 12:43 AM

To be clear, the rest of the change is fine. I just disagree with the testing strategy.

MaskRay updated this revision to Diff 322464.Feb 9 2021, 11:52 AM

Add a test

jhenderson accepted this revision.Feb 10 2021, 12:42 AM

LGTM, thanks!

This revision is now accepted and ready to land.Feb 10 2021, 12:42 AM
MaskRay updated this revision to Diff 323206.Feb 11 2021, 7:20 PM
MaskRay edited the summary of this revision. (Show Details)

Rebase

MaskRay edited the summary of this revision. (Show Details)Feb 11 2021, 7:21 PM
This revision was landed with ongoing or failed builds.Feb 11 2021, 7:23 PM
This revision was automatically updated to reflect the committed changes.
dmajor added a subscriber: dmajor.Feb 11 2021, 7:48 PM

coff-dwarf.test started failing after this commit: http://lab.llvm.org:8011/#/builders/109/builds/8398

coff-dwarf.test started failing after this commit: http://lab.llvm.org:8011/#/builders/109/builds/8398

The code used non-stable llvm::sort. Fixed by 0fd7c31a098efdfaa5a57dbac6e9c0921b00a999