Skip to content

[LLDB][Minidump] Fix bug in generating 64b memory minidumps #141995

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 29, 2025

Conversation

Jlalond
Copy link
Contributor

@Jlalond Jlalond commented May 29, 2025

In #129307, we introduced read write in chunks, and during the final revision of the PR I changed the behavior for 64b memory regions and did not test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region.

64b regions has been a problem in testing for some time as it's a waste of test resources to generation a 5gb+ Minidump. I will work with @clayborg and @labath to come up with a way to specify creating a 64b list instead of a 32b list (likely via the yamilizer).

@Jlalond Jlalond requested a review from clayborg May 29, 2025 17:35
@Jlalond Jlalond requested a review from JDevlieghere as a code owner May 29, 2025 17:35
@llvmbot llvmbot added the lldb label May 29, 2025
@llvmbot
Copy link
Member

llvmbot commented May 29, 2025

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

In #129307, we introduced read write in chunks, and during the final revision of the PR I changed the behavior for 64b memory regions and did not test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region.

64b regions has been a problem in testing for some time as it's a waste of test resources to generation a 5gb+ Minidump. I will work with @clayborg and @labath to come up with a way to specify creating a 64b list instead of a 32b list (likely via the yamilizer).


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

1 Files Affected:

  • (modified) lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp (+2-1)
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 2818d31eb2301..806f256d9da48 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -1170,7 +1170,6 @@ MinidumpFileBuilder::AddMemoryList_64(std::vector<CoreFileMemoryRange> &ranges,
               "(%" PRIx64 "bytes) "
               "[%" PRIx64 ", %" PRIx64 ")",
               region_index, ranges.size(), size, addr, addr + size);
-    ++region_index;
 
     progress.Increment(1, "Adding Memory Range " + core_range.Dump());
     uint64_t bytes_read = 0;
@@ -1186,6 +1185,8 @@ MinidumpFileBuilder::AddMemoryList_64(std::vector<CoreFileMemoryRange> &ranges,
       cleanup_required = true;
       descriptors[region_index].DataSize = bytes_read;
     }
+
+    ++region_index;
   }
 
   // Early return if there is no cleanup needed.

@Jlalond
Copy link
Contributor Author

Jlalond commented May 29, 2025

MINIDUMP_MEMORY64_LIST:
NumberOfMemoryRanges = 0x0000000000000042
BaseRva              = 0x00007f1963c00000
MemoryRanges[0]      = [0x0000000000000000 - 0x00007f1a40200000)
MemoryRanges[1]      = [0x0000000000000000 - 0x00007f1e08200000)
MemoryRanges[2]      = [0x0000000000000000 - 0x00007f20c960d000)
MemoryRanges[3]      = [0x0000000000000000 - 0x00007f2de3c00000)
MemoryRanges[4]      = [0x0000000000000000 - 0x00007f2df22f0000)
MemoryRanges[5]      = [0x0000000000001000 - 0x00007f2df22f2000)
MemoryRanges[6]      = [0x0000000000002000 - 0x00007f2df22f5000)
MemoryRanges[7]      = [0x0000000000000000 - 0x00007f2df22f6000)
MemoryRanges[8]      = [0x0000000000000000 - 0x00007f2df22ff000)
MemoryRanges[9]      = [0x0000000000000000 - 0x00007f2df2303000)
MemoryRanges[10]     = [0x0000000000001000 - 0x00007f2df2305000)
MemoryRanges[11]     = [0x0000000000000000 - 0x00007f2df2326000)
MemoryRanges[12]     = [0x0000000000000000 - 0x00007f2df238e000)
MemoryRanges[13]     = [0x0000000000000000 - 0x00007f2df23de000)
MemoryRanges[14]     = [0x0000000000003000 - 0x00007f2df23e4000)
MemoryRanges[15]     = [0x0000000000000000 - 0x00007f2df23e6000)
MemoryRanges[16]     = [0x0000000000000000 - 0x00007f2df23f8000)
MemoryRanges[17]     = [0x0000000000000000 - 0x00007f2df23fd000)
MemoryRanges[18]     = [0x0000000000002000 - 0x00007f2df2401000)
MemoryRanges[19]     = [0x0000000000001000 - 0x00007f2df2401000)
MemoryRanges[20]     = [0x0000000000000000 - 0x00007f2df43d6000)
MemoryRanges[21]     = [0x0000000000000000 - 0x00007f2df820c000)
MemoryRanges[22]     = [0x0000000000288000 - 0x00007f2df871c000)
MemoryRanges[23]     = [0x0000000000136000 - 0x00007f2df8701000)
MemoryRanges[24]     = [0x0000000000008000 - 0x00007f2df85db000)
MemoryRanges[25]     = [0x0000000000000000 - 0x00007f2df85d6000)
MemoryRanges[26]     = [0x0000000000000000 - 0x00007f2df85dd000)
MemoryRanges[27]     = [0x0000000000000000 - 0x00007f2df85e1000)
MemoryRanges[28]     = [0x0000000000001000 - 0x00007f2df85e3000)
MemoryRanges[29]     = [0x0000000000000000 - 0x00007f2df85ed000)
MemoryRanges[30]     = [0x0000000000000000 - 0x00007f2df861f000)
MemoryRanges[31]     = [0x0000000000000000 - 0x00007f2df8629000)
MemoryRanges[32]     = [0x0000000000002000 - 0x00007f2df862d000)
MemoryRanges[33]     = [0x0000000000004000 - 0x00007f2df8633000)
MemoryRanges[34]     = [0x0000000000000000 - 0x00007f2df8630000)
MemoryRanges[35]     = [0x0000000000000000 - 0x00007f2df8631000)
MemoryRanges[36]     = [0x0000000000000000 - 0x00007f2df8633000)
MemoryRanges[37]     = [0x0000000000001000 - 0x00007f2df8635000)
MemoryRanges[38]     = [0x0000000000000000 - 0x00007f2df8637000)
MemoryRanges[39]     = [0x0000000000000000 - 0x00007f2df8649000)
MemoryRanges[40]     = [0x0000000000000000 - 0x00007f2df864d000)
MemoryRanges[41]     = [0x0000000000003000 - 0x00007f2df8653000)
MemoryRanges[42]     = [0x0000000000000000 - 0x00007f2df8653000)
MemoryRanges[43]     = [0x0000000000000000 - 0x00007f2df866f000)
MemoryRanges[44]     = [0x0000000000000000 - 0x00007f2df867a000)
MemoryRanges[45]     = [0x0000000000001000 - 0x00007f2df867c000)
MemoryRanges[46]     = [0x0000000000001000 - 0x00007f2df867d000)
MemoryRanges[47]     = [0x0000000000000000 - 0x00007f2df868a000)
MemoryRanges[48]     = [0x0000000000000000 - 0x00007f2df869b000)
MemoryRanges[49]     = [0x0000000000000000 - 0x00007f2df86ac000)
MemoryRanges[50]     = [0x0000000000001000 - 0x00007f2df86ae000)
MemoryRanges[51]     = [0x0000000000000000 - 0x00007f2df86af000)
MemoryRanges[52]     = [0x0000000000000000 - 0x00007f2df86bf000)
MemoryRanges[53]     = [0x0000000000000000 - 0x00007f2df86c6000)
MemoryRanges[54]     = [0x0000000000001000 - 0x00007f2df86c8000)
MemoryRanges[55]     = [0x0000000000000000 - 0x00007f2df86d6000)
MemoryRanges[56]     = [0x0000000000000000 - 0x00007f2df8748000)
MemoryRanges[57]     = [0x0000000000000000 - 0x00007f2df87a0000)
MemoryRanges[58]     = [0x0000000000003000 - 0x00007f2df87a6000)
MemoryRanges[59]     = [0x0000000000004000 - 0x00007f2df87ab000)
MemoryRanges[60]     = [0x0000000000002000 - 0x00007f2df87ab000)
MemoryRanges[61]     = [0x0000000000000000 - 0x00007f2df87aa000)
MemoryRanges[62]     = [0x0000000000000000 - 0x00007f2df87d3000)
MemoryRanges[63]     = [0x0000000000000000 - 0x00007f2df87df000)
MemoryRanges[64]     = [0x0000000000022000 - 0x00007ffc7e2ce000)
MemoryRanges[65]     = [0x0000000000003000 - 0x0000000000006000)

Tested against a process with 64b memory

@Jlalond Jlalond merged commit 9ca41b6 into llvm:main May 29, 2025
10 of 11 checks passed
svkeerthy pushed a commit that referenced this pull request May 29, 2025
In #129307, we introduced read write in chunks, and during the final
revision of the PR I changed the behavior for 64b memory regions and did
not test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region. 

64b regions has been a problem in testing for some time as it's a waste
of test resources to generation a 5gb+ Minidump. I will work with
@clayborg and @labath to come up with a way to specify creating a 64b
list instead of a 32b list (likely via the yamilizer).
google-yfyang pushed a commit to google-yfyang/llvm-project that referenced this pull request May 29, 2025
)

In llvm#129307, we introduced read write in chunks, and during the final
revision of the PR I changed the behavior for 64b memory regions and did
not test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region. 

64b regions has been a problem in testing for some time as it's a waste
of test resources to generation a 5gb+ Minidump. I will work with
@clayborg and @labath to come up with a way to specify creating a 64b
list instead of a 32b list (likely via the yamilizer).
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
)

In llvm#129307, we introduced read write in chunks, and during the final
revision of the PR I changed the behavior for 64b memory regions and did
not test an actual 64b memory range.

This caused LLDB to crash whenever we generated a 64b memory region. 

64b regions has been a problem in testing for some time as it's a waste
of test resources to generation a 5gb+ Minidump. I will work with
@clayborg and @labath to come up with a way to specify creating a 64b
list instead of a 32b list (likely via the yamilizer).
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