[all-commits] [llvm/llvm-project] e9fad0: [lldb] Refactor away UB in SBValue::GetLoadAddress...

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Jun 2 00:40:17 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9fad0e91c49ca0f2669989dbad95664cbc9cbf3
      https://github.com/llvm/llvm-project/commit/e9fad0e91c49ca0f2669989dbad95664cbc9cbf3
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2025-06-02 (Mon, 02 Jun 2025)

  Changed paths:
    M lldb/include/lldb/ValueObject/ValueObject.h
    M lldb/include/lldb/ValueObject/ValueObjectConstResult.h
    M lldb/include/lldb/ValueObject/ValueObjectConstResultChild.h
    M lldb/include/lldb/ValueObject/ValueObjectConstResultImpl.h
    M lldb/source/API/SBValue.cpp
    M lldb/source/Commands/CommandObjectWatchpoint.cpp
    M lldb/source/DataFormatters/CXXFunctionPointer.cpp
    M lldb/source/DataFormatters/FormattersHelpers.cpp
    M lldb/source/DataFormatters/TypeFormat.cpp
    M lldb/source/DataFormatters/ValueObjectPrinter.cpp
    M lldb/source/Expression/Materializer.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
    M lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
    M lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
    M lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.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/ObjCLanguageRuntime.cpp
    M lldb/source/ValueObject/ValueObject.cpp
    M lldb/source/ValueObject/ValueObjectChild.cpp
    M lldb/source/ValueObject/ValueObjectConstResult.cpp
    M lldb/source/ValueObject/ValueObjectConstResultChild.cpp
    M lldb/source/ValueObject/ValueObjectConstResultImpl.cpp
    M lldb/source/ValueObject/ValueObjectVTable.cpp
    M lldb/test/API/python_api/value/TestValueAPI.py

  Log Message:
  -----------
  [lldb] Refactor away UB in SBValue::GetLoadAddress (#141799)

The problem was in calling GetLoadAddress on a value in the error state,
where `ValueObject::GetLoadAddress` could end up accessing the
uninitialized "address type" by-ref return value from `GetAddressOf`.
This probably happened because each function expected the other to
initialize it.

We can guarantee initialization by turning this into a proper return
value.

I've added a test, but it only (reliably) crashes if lldb is built with
ubsan.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list