[all-commits] [llvm/llvm-project] 542d52: [lldb][Expression] Allow specifying a preferred Mo...

Michael Buch via All-commits all-commits at lists.llvm.org
Thu Mar 6 13:07:45 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 542d52b1e8a0a7e04538f608487603124c70e1ab
      https://github.com/llvm/llvm-project/commit/542d52b1e8a0a7e04538f608487603124c70e1ab
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
    M lldb/include/lldb/Expression/IRExecutionUnit.h
    M lldb/include/lldb/Target/Target.h
    M lldb/source/Expression/IRExecutionUnit.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    M lldb/source/Plugins/InstrumentationRuntime/Utility/CMakeLists.txt
    M lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
    A lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
    A lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.h
    M lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp

  Log Message:
  -----------
  [lldb][Expression] Allow specifying a preferred ModuleList for lookup during expression evaluation (#129733)

The `TestMemoryHistory.py`/`TestReportData.py` are currently failing on
the x86 macOS CI (started after we upgraded the Xcode SDK on that
machien). The LLDB ASAN utility expression is failing to run with
following error:
```
(lldb) image lookup -n __asan_get_alloc_stack
1 match found in /usr/lib/system/libsystem_sanitizers.dylib:
        Address: libsystem_sanitizers.dylib[0x00007ffd11e673f7] (libsystem_sanitizers.dylib.__TEXT.__text + 11287)
        Summary: libsystem_sanitizers.dylib`__asan_get_alloc_stack
1 match found in /Users/michaelbuch/Git/lldb-build-main-no-modules/lib/clang/21/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:
        Address: libclang_rt.asan_osx_dynamic.dylib[0x0000000000009ec0] (libclang_rt.asan_osx_dynamic.dylib.__TEXT.__text + 34352)
        Summary: libclang_rt.asan_osx_dynamic.dylib`::__asan_get_alloc_stack(__sanitizer::uptr, __sanitizer::uptr *, __sanitizer::uptr, __sanitizer::u32 *) at asan_debugging.cpp:132
(lldb) memory history 'pointer'
Assertion failed: ((uintptr_t)addr == report.access.address), function __asan_get_alloc_stack, file debugger_abi.cpp, line 62.
warning: cannot evaluate AddressSanitizer expression:
error: Expression execution was interrupted: signal SIGABRT.
The process has been returned to the state before expression evaluation.
```

The reason for this is that the system sanitizer dylib and the locally
built libclang_rt contain the same symbol `__asan_get_alloc_stack`, and
depending on the order in which they're loaded, we may pick the one from
the wrong dylib (this probably changed during the buildbot upgrade and
is why it only now started failing). Based on discussion with @wrotki we
always want to pick the one that's in the libclang_rt dylib if it was
loaded, and libsystem_sanitizers otherwise.

This patch addresses this by adding a "preferred lookup context list" to
the expression evaluator. Currently this is only exposed in the
`EvaluateExpressionOptions`. We make it a `SymbolContextList` in case we
want the lookup contexts to be contexts other than modules (e.g., source
files, etc.). In `IRExecutionUnit` we make it a `ModuleList` because it
makes the symbol lookup implementation simpler and we only do module
lookups here anyway. If we ever need it to be a `SymbolContext`, that
transformation shouldn't be too difficult.



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