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

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 24 15:00:55 PDT 2024


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

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.

>From d675ccf2313d6605c28357029e4a2014a9591dcd Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Mon, 24 Jun 2024 14:51:03 -0700
Subject: [PATCH] Change expected directories to the correct type; size_t

---
 lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp | 2 +-
 lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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



More information about the lldb-commits mailing list