[Lldb-commits] [PATCH] D100338: Add a setting that enables memory to be read from the file cache instead of process when the section LLDB is reading from is read-only

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 13 11:23:10 PDT 2021

jasonmolenda added a comment.

In D100338#2686410 <https://reviews.llvm.org/D100338#2686410>, @augusto2112 wrote:

> Thanks for the input @jasonmolenda. FWIW I also think it's worth implementing this correctly.
> Could you help me figure out which callers I should change to `force_live_memory` though?

> Maybe force live memory only for the functions in `DynamicLoaderDarwinKernel.cpp` and `DynamicLoaderDarwin.cpp`?

Taking a quick look at the dynamic loader plugins, DynamicLoaderDarwin is calling ReadMemory in DynamicLoaderDarwin::GetThreadLocalData and I'm pretty sure the thread load storage address it is reading will be in a writable section, so our reimagined Target::ReadMemory will read from memory anyway.

DynamicLoaderDarwinKernel is calling Target::ReadMemory in ReadKextSummaryHeader and ReadKextSummaries -- it needs to read live memory, but

  (lldb) ima loo -vs gLoadedKextSummaries
  1 symbols match 'gLoadedKextSummaries' in /tmp/dl/mach.development.t8002:
          Address: mach.development.t8002[0x808c66b8] (mach.development.t8002.__DATA.__common + 394936)
  (lldb) tar mod dump sect
    0x00000011 zero-fill        [0x0000000080866000-0x00000000808c8294)  rw-  0x00000000 0x00000000 0x00000001 mach.development.t8002.__DATA.__common

they're reading from a writable Section so we would do the right thing.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list