[Lldb-commits] [PATCH] D65826: Add support for deterministically linked binaries on macOS to lldb.

Phabricator via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 12:29:22 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL368199: Add support for deterministically linked binaries on macOS to lldb. (authored by nico, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65826?vs=213962&id=213967#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65826/new/

https://reviews.llvm.org/D65826

Files:
  lldb/trunk/lit/SymbolFile/DWARF/deterministic-build.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -420,7 +420,11 @@
         // than the one from the CU.
         auto oso_mod_time = std::chrono::time_point_cast<std::chrono::seconds>(
             FileSystem::Instance().GetModificationTime(oso_file));
-        if (oso_mod_time != comp_unit_info->oso_mod_time) {
+        // A timestamp of 0 means that the linker was in deterministic mode. In
+        // that case, we should skip the check against the filesystem last
+        // modification timestamp, since it will never match.
+        if (comp_unit_info->oso_mod_time != llvm::sys::TimePoint<>() &&
+            oso_mod_time != comp_unit_info->oso_mod_time) {
           obj_file->GetModule()->ReportError(
               "debug map object file '%s' has changed (actual time is "
               "%s, debug map time is %s"
Index: lldb/trunk/lit/SymbolFile/DWARF/deterministic-build.cpp
===================================================================
--- lldb/trunk/lit/SymbolFile/DWARF/deterministic-build.cpp
+++ lldb/trunk/lit/SymbolFile/DWARF/deterministic-build.cpp
@@ -0,0 +1,11 @@
+// Test that binaries linked deterministically (N_OSO has timestamp 0) can still
+// have their object files loaded by lldb. Note that the env var ZERO_AR_DATE
+// requires the ld64 linker, which clang invokes by default.
+// REQUIRES: system-darwin
+// RUN: %clang %s -g -c -o %t.o
+// RUN: ZERO_AR_DATE=1 %clang %t.o -g -o %t
+// RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s
+// CHECK: stop reason = breakpoint
+
+
+int main() { return 0; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65826.213967.patch
Type: text/x-patch
Size: 1824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190807/a270c8b7/attachment.bin>


More information about the lldb-commits mailing list