[all-commits] [llvm/llvm-project] b0b2b6: [lldb][PlatformDarwin] Parse SDK path for module c...

MiB137 via All-commits all-commits at lists.llvm.org
Wed Jul 26 10:26:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0b2b6bab4d25122b2259dfac500fd83d60fa154
      https://github.com/llvm/llvm-project/commit/b0b2b6bab4d25122b2259dfac500fd83d60fa154
  Author: Michael Buch <mbuch at apple.com>
  Date:   2023-07-26 (Wed, 26 Jul 2023)

  Changed paths:
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
    M lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp

  Log Message:
  -----------
  [lldb][PlatformDarwin] Parse SDK path for module compilation from debug-info

When we build the Clang module compilation command (e.g., when
a user requests import of a module via `expression @import Foundation`),
LLDB will try to determine which SDK directory to use as the `sysroot`.
However, it currently does so by simply enumerating the `SDKs` directory
and picking the last one that's appropriate for module compilation
(see `PlatformDarwin::GetSDKDirectoryForModules`). That means if we have
multiple platform SDKs installed (e.g., a public and internal one), we
may pick the wrong one by chance.

On Darwin platforms we emit the SDK path that a object
file was compiled against into DWARF (using `DW_AT_LLVM_sysroot`
and `DW_AT_APPLE_sdk`). For Swift debugging, we already parse the SDK
path from debug-info if we can.

This patch mimicks the Swift behaviour for non-Swift languages. I.e.,
if we can get the SDK path from debug-info, do so. Otherwise, fall back
to the old heuristic.

rdar://110407148

Differential Revision: https://reviews.llvm.org/D156020




More information about the All-commits mailing list