[Lldb-commits] [lldb] [lldb][API] Add Find(Ranges)InMemory() to Process SB API (PR #95007)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 12 11:17:15 PDT 2024


================
@@ -810,6 +809,65 @@ const char *SBProcess::GetBroadcasterClass() {
   return ConstString(Process::GetStaticBroadcasterClass()).AsCString();
 }
 
+lldb::SBAddressRangeList
+SBProcess::FindRangesInMemory(const void *buf, uint64_t size,
+                              SBAddressRangeList &ranges, uint32_t alignment,
+                              uint32_t max_matches, SBError &error) {
+  LLDB_INSTRUMENT_VA(this, buf, size, ranges, alignment, max_matches, error);
+
+  Log *log = GetLog(LLDBLog::Process);
+  lldb::SBAddressRangeList matches;
+
+  ProcessSP process_sp(GetSP());
+  if (!process_sp) {
+    LLDB_LOGF(log, "SBProcess::%s SBProcess is invalid.", __FUNCTION__);
+    return matches;
+  }
+  Process::StopLocker stop_locker;
+  if (!stop_locker.TryLock(&process_sp->GetRunLock())) {
+    LLDB_LOGF(
+        log,
+        "SBProcess::%s Cannot find process in memory while process is running.",
----------------
clayborg wrote:

Fill in error as well here.

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


More information about the lldb-commits mailing list