This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Handle call sites with indirect call targets
ClosedPublic

Authored by vsk on Nov 11 2019, 2:49 PM.

Details

Summary

Split CallEdge into DirectCallEdge and IndirectCallEdge. Teach
DWARFExpression how to evaluate entry values in cases where the current
activation was created by an indirect call.

Writing tests for this is challenging, at the moment, because llvm emits
DW_AT_call_targets describing clobbered register values (llvm.org/PR43926).
I found a way to cover the non-tail call case, but would have to resort to
flaky assembly gadgets to test indirect tail-calls. I've left this for later.

rdar://57094085

Diff Detail

Event Timeline

vsk created this revision.Nov 11 2019, 2:49 PM

Mechanically, this seems reasonable.

lldb/include/lldb/Symbol/Function.h
350–354

You might want to briefly explain what the difference between direct and indirect is here.

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
3848–3897

the = {} is redundant with the default constructor of Optional.

3912

Can we make it so that work is only done when logging is requested?

vsk updated this revision to Diff 228920.Nov 12 2019, 10:37 AM
vsk marked 3 inline comments as done.
  • Add doxygen comments describing {Direct,Indirect}CallEdge & address the rest of Adrian's comments.
vsk updated this revision to Diff 228921.Nov 12 2019, 10:38 AM
  • Remove a few more redundant Optional initializations.
aprantl accepted this revision.Nov 21 2019, 1:06 PM
aprantl added inline comments.
lldb/include/lldb/Symbol/Function.h
453

Since DWARFExpression has a copy constructer, perhaps we should get rid of the unique_ptr to make it faster to allocate/deconstruct?

This revision is now accepted and ready to land.Nov 21 2019, 1:06 PM
vsk marked an inline comment as done.Nov 21 2019, 1:23 PM
vsk added inline comments.
lldb/include/lldb/Symbol/Function.h
453

I don't think it's possible to store CallEdge directly, as it's unsized (CallEdge::GetCallee is pure virtual).

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2019, 11:57 AM