[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 18:38:07 PDT 2021
jasonmolenda added a comment.
In D100338#2684550 <https://reviews.llvm.org/D100338#2684550>, @aprantl wrote:
> Another question for @jasonmolenda: Do you happen to know if the existing `prefer_file_cache` mechanism applies relocations?
We can test it to make sure like
% cat >a.c
char *globstr = "hello";
% clang -dynamiclib -o liba.dylib a.c
% cat >b.c
extern char *globstr;
int main() { char *c = globstr; return c[0]; }
% clang -g -o b.out b.c -L. -la
% lldb b.out
(lldb) disass -b -n main
b.out`main:
b.out[0x100003f90] <+0>: 55 pushq %rbp
b.out[0x100003f91] <+1>: 48 89 e5 movq %rsp, %rbp
b.out[0x100003f94] <+4>: 48 8b 05 65 00 00 00 movq 0x65(%rip), %rax ; (void *)0x0000000000000000
(lldb) br s -n main
(lldb) r
(lldb) disass -b -n main
b.out`main:
0x100003f90 <+0>: 55 pushq %rbp
0x100003f91 <+1>: 48 89 e5 movq %rsp, %rbp
0x100003f94 <+4>: 48 8b 05 65 00 00 00 movq 0x65(%rip), %rax ; (void *)0x0000000100128000: globstr
0x100003f9b <+11>: c7 45 fc 00 00 00 00 movl $0x0, -0x4(%rbp)
(lldb) ima loo -va 0x100003f9b+0x65
Address: b.out[0x0000000100004000] (b.out.__DATA_CONST.__got + 0)
Summary: (void *)0x0000000100128000: globstr
Module: file = "/tmp/b.out", arch = "x86_64"
(lldb) x/gx 0x100003f9b+0x65
0x100004000: 0x0000000100128000
(lldb) tar mod dump sect b.out
0x00000003 data-ptrs [0x0000000100004000-0x0000000100004008) rw- 0x00004000 0x00000008 0x00000006 b.out.__DATA_CONST.__got
This __DATA,got section is marked as rw, so we read it from memory.
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