Skip to content

[LLDB][Minidump] Add some buffer directories #138943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025

Conversation

Jlalond
Copy link
Contributor

@Jlalond Jlalond commented May 7, 2025

Add a generous amount of buffer directories. I found out some LLDB forks (internal and external) had custom ranges that could fail because we didn't pre-account for those. To prevent this from being a problem, I've added a large number of buffer directories at the cost of 240 bytes.

@Jlalond Jlalond requested a review from JDevlieghere as a code owner May 7, 2025 19:21
@llvmbot llvmbot added the lldb label May 7, 2025
@llvmbot
Copy link
Member

llvmbot commented May 7, 2025

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

Add a generous amount of buffer directories. I found out some LLDB forks (internal and external) had custom ranges that could fail because we didn't pre-account for those. To prevent this from being a problem, I've added a large number of buffer directories at the cost of 240 bytes.


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

1 Files Affected:

  • (modified) lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp (+5)
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 38806dfc8e5b5..b6c7e66e28793 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -75,6 +75,11 @@ Status MinidumpFileBuilder::AddHeaderAndCalculateDirectories() {
     }
   }
 
+  // Add a generous buffer of directories, these are quite small
+  // and forks may add new directories upstream LLDB hadn't accounted for
+  // when we started pre-calculating directory size, so this should account for that
+  m_expected_directories += 100;
+
   m_saved_data_size +=
       m_expected_directories * sizeof(llvm::minidump::Directory);
   Status error;

@Jlalond Jlalond requested a review from mbucko May 7, 2025 19:22
Copy link

github-actions bot commented May 7, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@Jlalond Jlalond force-pushed the extra-directories branch from d93881d to 2395615 Compare May 7, 2025 19:37
@Jlalond Jlalond merged commit 40941f1 into llvm:main May 7, 2025
6 of 9 checks passed
petrhosek pushed a commit to petrhosek/llvm-project that referenced this pull request May 8, 2025
Add a generous amount of buffer directories. I found out some LLDB forks
(internal and external) had custom ranges that could fail because we
didn't pre-account for those. To prevent this from being a problem, I've
added a large number of buffer directories at the cost of 240 bytes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants