[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
Mon Apr 12 19:03:23 PDT 2021


jasonmolenda added a comment.

Hm, a little more thinking.  Target::ReadMemory prefers a file cache if it is available.  Process::ReadMemory only uses live memory.  But Process::ReadMemory doesn't work when we have run lldb on a file and not run yet.  e.g.

  % lldb
  (lldb) tar cr -d /tmp/b.out
  Current executable set to '/tmp/b.out' (x86_64).
  (lldb) disass -n main
  b.out`main:
  b.out[0x100003f90] <+0>:  pushq  %rbp
  b.out[0x100003f91] <+1>:  movq   %rsp, %rbp
  b.out[0x100003f94] <+4>:  movq   0x65(%rip), %rax          ; (void *)0x0000000000000000
  b.out[0x100003f9b] <+11>: movl   $0x0, -0x4(%rbp)
  
  (lldb) ima loo -va 0x100003f9b+0x65
        Address: b.out[0x0000000100004000] (b.out.__DATA_CONST.__got + 0)
        Summary: (void *)0x0000000000000000
         Module: file = "/tmp/b.out", arch = "x86_64"
  
  (lldb) x/gx 0x100003f9b+0x65
  0x100004000: 0x0000000000000000
  (lldb) 

I don't have a Process, so I must be using Target::ReadMemory here.  and even though this section is read-write, we don't have any live memory so we're fetching it from the file.  So that's an interesting extra wrinkle I didn't remember from Target::ReadMemory.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100338



More information about the lldb-commits mailing list