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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 14:43:31 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

<details>
<summary>Changes</summary>

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.



---
Full diff: https://github.com/llvm/llvm-project/pull/68262.diff


1 Files Affected:

- (modified) llvm/lib/DebugInfo/DWARF/DWARFContext.cpp (+5-2) 


``````````diff
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 1e1ab814673f423..6a91be97255b8bb 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -575,8 +575,11 @@ 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, "", nullptr, nullptr,
+        FileName.find(".dwp") != StringRef::npos);
     *Entry = S;
     auto *Ctxt = S->Context.get();
     return std::shared_ptr<DWARFContext>(std::move(S), Ctxt);

``````````

</details>


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


More information about the llvm-commits mailing list