Page MenuHomePhabricator

[MSan] Add meaningful debug locations to [K]MSan hooks poisoning local variables
Needs RevisionPublic

Authored by glider on Sep 25 2018, 7:47 AM.

Details

Summary

Add DILocation pointing to the local variable declaration site to every MSan/KMSAN hook that poisons that local variable.
The DILocation is picked from one of the debug intrinsics referencing the corresponding alloca instruction and being:

  • either a llvm.dbg.declare intrinsic;
  • or a llvm.dbg.addr intrinsic;
  • or a llvm.dbg.value intrinsic with DW_OP_deref tag.

Diff Detail

Event Timeline

glider created this revision.Sep 25 2018, 7:47 AM
aprantl requested changes to this revision.Sep 25 2018, 9:05 AM
aprantl added inline comments.
lib/Transforms/Instrumentation/MemorySanitizer.cpp
3282

See my reply to llvm-dev; this is not the right condition to check for.

This revision now requires changes to proceed.Sep 25 2018, 9:05 AM
aprantl added a reviewer: vsk.Sep 25 2018, 9:06 AM
aprantl added a subscriber: debug-info.

Why is the DILocation

lib/Transforms/Instrumentation/MemorySanitizer.cpp
3308

This is backwards. You can't infer the DILocation for a dbg.value from the SSA value its pointing to. One SSA Value may holds the value of many source variables.