Files
clang-p2996/lldb/source/Plugins/Process/Linux/SingleStepCheck.h
Pavel Labath 605b51b84e Work around a stepping bug in arm64 android M
Summary:
On arm64, linux<=4.4 and Android<=M there is a bug, which prevents single-stepping from working when
the system comes back from suspend, because of incorrectly initialized CPUs. This did not really
affect Android<M, because it did not use software suspend, but it is a problem for M, which uses
suspend (doze) quite extensively.  Fortunately, it seems that the first CPU is not affected by
this bug, so this commit implements a workaround by forcing the inferior to execute on the first
cpu whenever we are doing single stepping.

While inside, I have moved the implementations of Resume() and SingleStep() to the thread class
(instead of process).

Reviewers: tberghammer, ovyalov

Subscribers: aemerson, rengolin, tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D17509

llvm-svn: 261636
2016-02-23 13:56:30 +00:00

42 lines
1.3 KiB
C++

//===-- SingleStepCheck.h ------------------------------------- -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_SingleStepCheck_H_
#define liblldb_SingleStepCheck_H_
namespace lldb_private
{
namespace process_linux
{
namespace impl
{
extern bool
SingleStepWorkaroundNeeded();
}
// arm64 linux had a bug which prevented single-stepping and watchpoints from working on non-boot
// cpus, due to them being incorrectly initialized after coming out of suspend. This issue is
// particularly affecting android M, which uses suspend ("doze mode") quite aggressively. This
// code detects that situation and makes single-stepping work by doing all the step operations on
// the boot cpu.
//
// The underlying issue has been fixed in android N and linux 4.4. This code can be removed once
// these systems become obsolete.
inline bool
SingleStepWorkaroundNeeded()
{
static bool value = impl::SingleStepWorkaroundNeeded();
return value;
}
} // end namespace process_linux
} // end namespace lldb_private
#endif // #ifndef liblldb_SingleStepCheck_H_