Add new ABI callback to provide fallback unwind register locations
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 14 Apr 2016 14:25:20 +0000 (14:25 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 14 Apr 2016 14:25:20 +0000 (14:25 +0000)
commit7311bb34f63df58edb4819e5b483b49932b371bd
tree180ec62d84c450e4a99ae3551c16b47aaa594524
parent4c2ae3a171262b15ceb6a4ec7d1e95cdd201169c
Add new ABI callback to provide fallback unwind register locations

If the UnwindPlan did not identify how to unwind the stack pointer
register, LLDB currently assumes it can determine to caller's SP
from the current frame's CFA.  This is true on most platforms
where CFA is by definition equal to the incoming SP at function
entry.

However, on the s390x target, we instead define the CFA to equal
the incoming SP plus an offset of 160 bytes.  This is because
our ABI defines that the caller has to provide a register save
area of size 160 bytes.  This area is allocated by the caller,
but is considered part of the callee's stack frame, and therefore
the CFA is defined as pointing to the top of this area.

In order to make this work on s390x, this patch introduces a new
ABI callback GetFallbackRegisterLocation that provides platform-
specific fallback register locations for unwinding.  The existing
code to handle SP unwinding as well as volatile registers is moved
into the default implementation of that ABI callback, to allow
targets where that implementation is incorrect to override it.

This patch in itself is a no-op for all existing platforms.
But it is a pre-requisite for adding s390x support.

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

llvm-svn: 266307
lldb/include/lldb/Symbol/UnwindPlan.h
lldb/include/lldb/Target/ABI.h
lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/source/Target/ABI.cpp