[Lldb-commits] [lldb] [LLDB][Minidump] Change expected directories to the correct type; size_t (PR #96564)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 24 15:01:27 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

<details>
<summary>Changes</summary>

In !95312 I incorrectly set `m_expected_directories` to uint, this broke the windows build and is the incorrect type. 

`size_t` is more accurate because this value only ever represents the expected upper bound of the directory vector.

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


2 Files Affected:

- (modified) lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp (+1-1) 
- (modified) lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h (+1-1) 


``````````diff
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 7a09c6104d08c..de212c6b20da7 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -109,7 +109,7 @@ Status MinidumpFileBuilder::AddDirectory(StreamType type,
   if (m_directories.size() + 1 > m_expected_directories) {
     error.SetErrorStringWithFormat(
         "Unable to add directory for stream type %x, exceeded expected number "
-        "of directories %d.",
+        "of directories %zu.",
         (uint32_t)type, m_expected_directories);
     return error;
   }
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
index b606f925f9912..20564e0661f2a 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
@@ -146,7 +146,7 @@ class MinidumpFileBuilder {
   lldb_private::DataBufferHeap m_data;
   lldb::ProcessSP m_process_sp;
 
-  uint m_expected_directories = 0;
+  size_t m_expected_directories = 0;
   uint64_t m_saved_data_size = 0;
   lldb::offset_t m_thread_list_start = 0;
   // We set the max write amount to 128 mb, this is arbitrary

``````````

</details>


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


More information about the lldb-commits mailing list