[llvm] [LLVM][DWARF] Create thread safe context for DWP DWARFContext (PR #68262)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 15:58:01 PDT 2023


https://github.com/ayermolo updated https://github.com/llvm/llvm-project/pull/68262

>From f8f99ff1b6885706f395756c0e61ef78de9e82a7 Mon Sep 17 00:00:00 2001
From: Alexander Yermolovich <ayermolo at meta.com>
Date: Wed, 4 Oct 2023 14:39:41 -0700
Subject: [PATCH] [LLVM][DWARF] Create thread safe context for DWP DWARFContext

Right now DWARFContext is created is the same when input is DWO or DWP file.
Changed so that for DWP it creates a thread safe context.
---
 llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 1e1ab814673f423..0648ccca16cf2ae 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -575,8 +575,12 @@ class ThreadUnsafeDWARFContextState : public DWARFContext::DWARFContextState {
 
     auto S = std::make_shared<DWOFile>();
     S->File = std::move(Obj.get());
-    S->Context = DWARFContext::create(*S->File.getBinary(),
-                                      DWARFContext::ProcessDebugRelocations::Ignore);
+    StringRef FileName = S->File.getBinary()->getFileName();
+    S->Context = DWARFContext::create(
+        *S->File.getBinary(), DWARFContext::ProcessDebugRelocations::Ignore,
+        nullptr, "", WithColor::defaultErrorHandler,
+        WithColor::defaultWarningHandler,
+        FileName.find(".dwp") != StringRef::npos);
     *Entry = S;
     auto *Ctxt = S->Context.get();
     return std::shared_ptr<DWARFContext>(std::move(S), Ctxt);



More information about the llvm-commits mailing list