[all-commits] [llvm/llvm-project] 057efa: Make the error condition in Value::ValueType expli...

adrian-prantl via All-commits all-commits at lists.llvm.org
Fri Feb 12 16:12:54 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 057efa9916cdc354ef4653bcd128a578cc43125e
      https://github.com/llvm/llvm-project/commit/057efa9916cdc354ef4653bcd128a578cc43125e
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2021-02-12 (Fri, 12 Feb 2021)

  Changed paths:
    M lldb/include/lldb/Core/Value.h
    M lldb/include/lldb/Expression/ExpressionVariable.h
    M lldb/source/Core/Value.cpp
    M lldb/source/Core/ValueObject.cpp
    M lldb/source/Core/ValueObjectChild.cpp
    M lldb/source/Core/ValueObjectConstResult.cpp
    M lldb/source/Core/ValueObjectConstResultImpl.cpp
    M lldb/source/Core/ValueObjectMemory.cpp
    M lldb/source/Core/ValueObjectRegister.cpp
    M lldb/source/Core/ValueObjectVariable.cpp
    M lldb/source/DataFormatters/TypeFormat.cpp
    M lldb/source/Expression/DWARFExpression.cpp
    M lldb/source/Expression/FunctionCaller.cpp
    M lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
    M lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
    M lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
    M lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
    M lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    M lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    M lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
    M lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
    M lldb/source/Target/ABI.cpp
    M lldb/source/Target/RegisterContextUnwind.cpp
    M lldb/source/Target/ThreadPlanTracer.cpp
    M lldb/unittests/Expression/DWARFExpressionTest.cpp

  Log Message:
  -----------
  Make the error condition in Value::ValueType explicit (NFC)

The comment for ValueType claims that all values <1 are errors, but
not all switch statements take this into account. This patch
introduces an explicit Error case and deletes all default: cases, so
we get warned about incomplete switch coverage.

https://reviews.llvm.org/D96537


  Commit: 188b0747c1664d962e94f00b5e3caac529fa1e26
      https://github.com/llvm/llvm-project/commit/188b0747c1664d962e94f00b5e3caac529fa1e26
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2021-02-12 (Fri, 12 Feb 2021)

  Changed paths:
    M lldb/source/Expression/DWARFExpression.cpp
    M lldb/unittests/Expression/CMakeLists.txt
    M lldb/unittests/Expression/DWARFExpressionTest.cpp

  Log Message:
  -----------
  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


Compare: https://github.com/llvm/llvm-project/compare/532d4bf02544...188b0747c166


More information about the All-commits mailing list