[Lldb-commits] [PATCH] D76341: [lldb/MemoryHistoryAsan] Fix address resolution for recorded backtraces

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 17 20:32:10 PDT 2020


friss created this revision.
friss added reviewers: jasonmolenda, kubamracek.
Herald added subscribers: danielkiss, kristof.beyls.
Herald added a project: LLDB.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76341

Files:
  lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
  lldb/source/Plugins/Process/Utility/HistoryThread.cpp
  lldb/source/Plugins/Process/Utility/HistoryThread.h
  lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp
  lldb/source/Plugins/Process/Utility/HistoryUnwind.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76341.250975.patch
Type: text/x-patch
Size: 4354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200318/4d2d5ba6/attachment.bin>


More information about the lldb-commits mailing list