[Lldb-commits] [PATCH] D145624: [lldb] Make MemoryCache::Read more resilient

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 13 10:50:43 PDT 2023


clayborg added inline comments.


================
Comment at: lldb/source/Target/Memory.cpp:133-135
+  if (pos != m_L2_cache.end()) {
+    return pos->second;
+  }
----------------
remove braces for single line if statement per llvm coding guidelines


================
Comment at: lldb/source/Target/Memory.cpp:210-211
+  DataBufferSP first_cache_line = GetL2CacheLine(cache_line_base_addr, error);
+  uint8_t *dst_buf = (uint8_t *)dst;
+  size_t bytes_left = dst_len;
 
----------------
move these two lines below the 2 if statements below that return early?


================
Comment at: lldb/source/Target/Memory.cpp:245-246
+    if (m_invalid_ranges.FindEntryThatContains(cache_line_base_addr)) {
+      error.SetErrorStringWithFormat("memory read failed for 0x%" PRIx64,
+                                     cache_line_base_addr);
+      return dst_len - bytes_left;
----------------
Is this an error here? We already got something from the first read and we are just returning partial data, do we need an error? If we fail the first read, then this is an error. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145624/new/

https://reviews.llvm.org/D145624



More information about the lldb-commits mailing list