[Lldb-commits] [lldb] [LLDB][Minidump] Fix ProcessMinidump::GetMemoryRegions to include 64b regions when /proc/pid maps are missing. (PR #101086)

via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 15 16:53:13 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 4e078e3797098daa40d254447c499bcf61415308 aab60b78229a26114a2e919039b6eb89fa56c352 --extensions cpp,h -- lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp lldb/source/Plugins/Process/minidump/MinidumpParser.cpp lldb/source/Plugins/Process/minidump/MinidumpParser.h lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp lldb/source/Plugins/Process/minidump/MinidumpTypes.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
index afe8b134d2..91d890508f 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -458,22 +458,22 @@ MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
 
   if (!GetStream(StreamType::Memory64List).empty()) {
     llvm::Error err = llvm::Error::success();
-    for (const auto &memory_desc :  GetMinidumpFile().getMemory64List(err)) {
+    for (const auto &memory_desc : GetMinidumpFile().getMemory64List(err)) {
       // Explicit error check so we can return from within
-      if (memory_desc.first.StartOfMemoryRange <= addr 
-          && addr < memory_desc.first.StartOfMemoryRange + memory_desc.first.DataSize 
-          && !err) {
-        return minidump::Range(memory_desc.first.StartOfMemoryRange, memory_desc.second);
+      if (memory_desc.first.StartOfMemoryRange <= addr &&
+          addr < memory_desc.first.StartOfMemoryRange +
+                     memory_desc.first.DataSize &&
+          !err) {
+        return minidump::Range(memory_desc.first.StartOfMemoryRange,
+                               memory_desc.second);
       }
     }
 
     if (err)
-      // Without std::move(err) fails with 
+      // Without std::move(err) fails with
       // error: call to deleted constructor of '::llvm::Error'
       LLDB_LOG_ERROR(log, std::move(err), "Failed to read memory64 list: {0}");
   }
-  
-
 
   return std::nullopt;
 }
@@ -501,7 +501,8 @@ llvm::ArrayRef<uint8_t> MinidumpParser::GetMemory(lldb::addr_t addr,
   return range->range_ref.slice(offset, overlap);
 }
 
-llvm::iterator_range<FallibleMemory64Iterator> MinidumpParser::GetMemory64Iterator(llvm::Error &err) {
+llvm::iterator_range<FallibleMemory64Iterator>
+MinidumpParser::GetMemory64Iterator(llvm::Error &err) {
   llvm::ErrorAsOutParameter ErrAsOutParam(&err);
   return m_file->getMemory64List(err);
 }
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.h b/lldb/source/Plugins/Process/minidump/MinidumpParser.h
index 222c0ef47f..46596081eb 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.h
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.h
@@ -47,7 +47,8 @@ struct Range {
   }
 };
 
-using FallibleMemory64Iterator = llvm::object::MinidumpFile::FallibleMemory64Iterator;
+using FallibleMemory64Iterator =
+    llvm::object::MinidumpFile::FallibleMemory64Iterator;
 
 class MinidumpParser {
 public:
@@ -94,7 +95,8 @@ public:
   /// complete (includes all regions mapped into the process memory).
   std::pair<MemoryRegionInfos, bool> BuildMemoryRegions();
 
-  llvm::iterator_range<FallibleMemory64Iterator> GetMemory64Iterator(llvm::Error &err);
+  llvm::iterator_range<FallibleMemory64Iterator>
+  GetMemory64Iterator(llvm::Error &err);
 
   static llvm::StringRef GetStreamTypeAsString(StreamType stream_type);
 

``````````

</details>


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


More information about the lldb-commits mailing list