[Lldb-commits] [lldb] [lldb] Fix handling of unaligned results in DoFindInMemory (PR #189950)

via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 1 05:57:19 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: mentha

<details>
<summary>Changes</summary>

While encountering an unaligned result in DoFindInMemory, instead of skipping already searched memory, the function incorrectly restart the search from almost the beginning of the search range.

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


1 Files Affected:

- (modified) lldb/source/Target/Process.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 34d8b91a42833..da6d193f6364b 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2008,7 +2008,7 @@ void Process::DoFindInMemory(lldb::addr_t start_addr, lldb::addr_t end_addr,
     if (found_addr % alignment) {
       // We need to check the alignment because the FindInMemory uses a special
       // algorithm to efficiently search mememory but doesn't support alignment.
-      start = llvm::alignTo(start + 1, alignment);
+      start = llvm::alignTo(found_addr + 1, alignment);
       continue;
     }
 

``````````

</details>


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


More information about the lldb-commits mailing list