This is an archive of the discontinued LLVM Phabricator instance.

[SafeStack] Set debug location for calls to __safestack_pointer_address.
ClosedPublic

Authored by efriedma on Aug 21 2018, 4:53 PM.

Details

Summary

Otherwise, the debug info is incorrect. On its own, this is mostly harmless, but safe-stack also later inlines the call to __safestack_pointer_address, which leads to debug info with the wrong scope, which eventually causes an assertion failure (and incorrect debug info in release mode).

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Aug 21 2018, 4:53 PM
eugenis added inline comments.Aug 21 2018, 5:05 PM
lib/CodeGen/SafeStack.cpp
781 ↗(On Diff #161849)

Should this be checked in module verifier?

782 ↗(On Diff #161849)

In ASan we do this:

if (auto SP = F.getSubprogram())
   EntryDebugLocation = DebugLoc::get(SP->getScopeLine(), 0, SP);

Is that better? I think it will point to the opening curling bracket of the function instead of line 0.

efriedma planned changes to this revision.Aug 21 2018, 5:52 PM
efriedma added inline comments.
lib/CodeGen/SafeStack.cpp
781 ↗(On Diff #161849)

We do, if both the caller and callee have debug info.

782 ↗(On Diff #161849)

I guess so, given we're inserting this code at the beginning of the function. I'll change it.

efriedma updated this revision to Diff 162064.Aug 22 2018, 2:57 PM

Use opening line of the function as debug location.

eugenis accepted this revision.Aug 24 2018, 10:18 AM
This revision is now accepted and ready to land.Aug 24 2018, 10:18 AM

(Please add a comment "LGTM" when you accept a patch; otherwise, Phabricator doesn't send a notification to llvm-commits.)

LGTM

How interesting, "accept revision" goes to reviewers only, not to the mailing list.

This revision was automatically updated to reflect the committed changes.