diff options
| author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-14 14:25:20 +0000 |
|---|---|---|
| committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-14 14:25:20 +0000 |
| commit | 7311bb34f63df58edb4819e5b483b49932b371bd (patch) | |
| tree | 180ec62d84c450e4a99ae3551c16b47aaa594524 /lldb/source/Target/ABI.cpp | |
| parent | 4c2ae3a171262b15ceb6a4ec7d1e95cdd201169c (diff) | |
| download | bcm5719-llvm-7311bb34f63df58edb4819e5b483b49932b371bd.tar.gz bcm5719-llvm-7311bb34f63df58edb4819e5b483b49932b371bd.zip | |
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
Diffstat (limited to 'lldb/source/Target/ABI.cpp')
| -rw-r--r-- | lldb/source/Target/ABI.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp index 6cea996a296..f5fd594877f 100644 --- a/lldb/source/Target/ABI.cpp +++ b/lldb/source/Target/ABI.cpp @@ -205,3 +205,27 @@ ABI::PrepareTrivialCall (Thread &thread, assert( !"Should never get here!" ); return false; } + +bool +ABI::GetFallbackRegisterLocation (const RegisterInfo *reg_info, + UnwindPlan::Row::RegisterLocation &unwind_regloc) +{ + // Did the UnwindPlan fail to give us the caller's stack pointer? + // The stack pointer is defined to be the same as THIS frame's CFA, so return the CFA value as + // the caller's stack pointer. This is true on x86-32/x86-64 at least. + if (reg_info->kinds[eRegisterKindGeneric] == LLDB_REGNUM_GENERIC_SP) + { + unwind_regloc.SetIsCFAPlusOffset(0); + return true; + } + + // If a volatile register is being requested, we don't want to forward the next frame's register contents + // up the stack -- the register is not retrievable at this frame. + if (RegisterIsVolatile(reg_info)) + { + unwind_regloc.SetUndefined(); + return true; + } + + return false; +} |

