Page MenuHomePhabricator

[lldb/MemoryHistoryAsan] Fix address resolution for recorded backtraces
ClosedPublic

Authored by friss on Mar 17 2020, 8:03 PM.

Details

Summary

The memory history plugin for Asan creates a HistoryThread with the
recorded PC values provided by the Asan runtime. In other cases,
thoses PCs are gathered by LLDB directly.

The PCs returned by the Asan runtime are the PCs of the calls in the
backtrace, not the return addresses you would normally get when
unwinding the stack (look for a call to GetPreviousIntructionPc in
AsanGetStack).

When the above addresses are passed to the unwinder, it will subtract
1 from each address of the non zero frames because it treats them as
return addresses. This can lead to the final report referencing the
wrong line.

This patch fixes this issue by threading a flag through HistoryThread
and HistoryUnwinder that tells them to treat every frame like the
first one. The Asan MemoryHistory plugin can then use this flag.

This fixes running TestMemoryHistory on arm64 devices, although it's
hard to guarantee that the test will continue to exhibit the boundary
condition that triggers this bug.

Diff Detail

Event Timeline

friss created this revision.Mar 17 2020, 8:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2020, 8:03 PM
This revision is now accepted and ready to land.Mar 18 2020, 11:57 AM
This revision was automatically updated to reflect the committed changes.