[all-commits] [llvm/llvm-project] b40ee7: [lldb/MemoryHistoryAsan] Fix address resolution fo...

fredriss via All-commits all-commits at lists.llvm.org
Wed Mar 18 13:18:21 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b40ee7ff1b16982b39582eee04ca82cac5f3d154
      https://github.com/llvm/llvm-project/commit/b40ee7ff1b16982b39582eee04ca82cac5f3d154
  Author: Fred Riss <friss at apple.com>
  Date:   2020-03-18 (Wed, 18 Mar 2020)

  Changed paths:
    M lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
    M lldb/source/Plugins/Process/Utility/HistoryThread.cpp
    M lldb/source/Plugins/Process/Utility/HistoryThread.h
    M lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp
    M lldb/source/Plugins/Process/Utility/HistoryUnwind.h

  Log Message:
  -----------
  [lldb/MemoryHistoryAsan] Fix address resolution for recorded backtraces

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.

Reviewers: jasonmolenda, kubamracek

Subscribers: kristof.beyls, danielkiss, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D76341




More information about the All-commits mailing list