llvm-project/lldb/source/Expression
Adrian Prantl 188b0747c1 Support dereferencing a DWARF scalar stack value
Swift async functions receive function arguments inside a
heap-allocated data structure, similar to how ObjC block captures or
C++ coroutine arguments are implement. In DWARF they are described
relative to an entry value that produces a pointer into that heap
object. At typical location looks like

DW_OP_entry_value [ DW_OP_reg14 ] DW_OP_deref DW_OP_plus_uconst 32 DW_OP_deref

This allows the unwinder (which has special ABI knowledge to restore
the contents of r14) to push the base address onto the stack thus
allowing the deref/offset operations to continue. The result of the
entry value is a scalar, because DW_OP_reg14 is a register location —
as it should be since we want to restore the pointer value contained
in r14 at the beginning of the function and not the historical memory
contents it was pointing to. The entry value should restore the
address, which is still valid, not the contents at function entry.

To make this work, we need to allow LLDB to dereference Scalar stack
results like load addresses, which is what this patch
does. Unfortunately it is difficult to test this in isolation, since
the DWARFExpression unit test doesn't have a process.

Differential Revision: https://reviews.llvm.org/D96549
2021-02-12 16:12:32 -08:00
..
CMakeLists.txt [CMake] Make `intrinsics_gen` dependency unconditional. 2020-07-17 16:43:17 -07:00
DWARFExpression.cpp Support dereferencing a DWARF scalar stack value 2021-02-12 16:12:32 -08:00
DiagnosticManager.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Expression.cpp [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
ExpressionVariable.cpp Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish) 2020-07-27 13:26:35 -07:00
FunctionCaller.cpp Make the error condition in Value::ValueType explicit (NFC) 2021-02-12 16:12:31 -08:00
IRExecutionUnit.cpp Use !hasLocalLinkage instead of listing the symbol types 2020-10-29 14:44:06 -07:00
IRInterpreter.cpp [lldb] Remove redundant WithFormat suffixes (NFC) 2020-07-20 23:00:32 -07:00
IRMemoryMap.cpp [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
LLVMUserExpression.cpp Handle the case where a thread exits while we are running a function on it. 2020-05-21 17:55:53 -07:00
Materializer.cpp [lldb/Utility] Add unit tests for RegisterValue::GetScalarValue 2020-11-03 16:12:32 +01:00
REPL.cpp Use zu rather than llu format specifier for size_t (-Wformat warning fix). 2020-09-16 19:28:05 -07:00
UserExpression.cpp [lldb] Fix that running a top level expression without a process fails with a cryptic error 2021-02-11 17:07:11 +01:00
UtilityFunction.cpp [lldb] Fix missing initialization in UtilityFunction ctor (NFC) 2020-10-22 21:12:27 -07:00